Example #1
0
    def convert_aiw(self, source_file, target_file):
        shutil.copy(source_file, target_file)

        # generate the thumbnail if there isn't somebody already
        rest, ext = os.path.splitext(source_file)
        trest, text = os.path.splitext(target_file)
        source_mini_file = os.path.join(rest + "mini.tga")
        target_mini_file = os.path.join(trest + "mini.tga")

        logging.info("generating track thumbnail: %s", target_mini_file)
        if not rfactortools.lookup_path_icase(source_mini_file) or self.cfg.force_track_thumbnails:
            aiw = rfactortools.parse_aiwfile(source_file)
            img = rfactortools.render_aiw(aiw, 252, 249)
            img.save(target_mini_file)
Example #2
0
    def convert_aiw(self, source_file, target_file):
        shutil.copy(source_file, target_file)

        # generate the thumbnail if there isn't somebody already
        rest, ext = os.path.splitext(source_file)
        trest, text = os.path.splitext(target_file)
        source_mini_file = os.path.join(rest + "mini.tga")
        target_mini_file = os.path.join(trest + "mini.tga")

        logging.info("generating track thumbnail: %s", target_mini_file)
        if not rfactortools.lookup_path_icase(
                source_mini_file) or self.cfg.force_track_thumbnails:
            aiw = rfactortools.parse_aiwfile(source_file)
            img = rfactortools.render_aiw(aiw, 252, 249)
            img.save(target_mini_file)
Example #3
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


import argparse

import rfactortools


if __name__ == "__main__":
    def size(s):
        return [int(x) for x in s.split('x', 1)]

    parser = argparse.ArgumentParser(description="rFactor Tools .aiw processor")
    parser.add_argument('FILE', action='store', type=str,
                        help=".aiw file to process")
    parser.add_argument("-o", "--output", metavar='FILE', type=str, required=True,
                        help=".aiw file to process")
    parser.add_argument("-s", "--size", metavar='INT', type=size, default=(512, 512),
                        help="size for the rendered image")
    args = parser.parse_args()

    aiw = rfactortools.parse_aiwfile(args.FILE)
    img = rfactortools.render_aiw(aiw, args.size[0], args.size[1])

    img.save(args.output)


# EOF #
Example #4
0
    def size(s):
        return [int(x) for x in s.split('x', 1)]

    parser = argparse.ArgumentParser(
        description="rFactor Tools .aiw processor")
    parser.add_argument('FILE',
                        action='store',
                        type=str,
                        help=".aiw file to process")
    parser.add_argument("-o",
                        "--output",
                        metavar='FILE',
                        type=str,
                        required=True,
                        help=".aiw file to process")
    parser.add_argument("-s",
                        "--size",
                        metavar='INT',
                        type=size,
                        default=(512, 512),
                        help="size for the rendered image")
    args = parser.parse_args()

    aiw = rfactortools.parse_aiwfile(args.FILE)
    img = rfactortools.render_aiw(aiw, args.size[0], args.size[1])

    img.save(args.output)

# EOF #