Extra:No-Intro Packs

From Wah!ki
Revision as of 03:56, 31 December 2010 by Sairuk (talk | contribs) (→‎About)
Jump to navigation Jump to search

About

The No-Intro Screenshot Archive contains (maintains?) a number of artwork packs for different systems, these are perfect if you want to make add some candy to your Wah!Cade installation.

The No-Intro Screenshot project currently name their images by rom CRC32 value, not by the rom name as has been the norm for all screenshot packs in the past. This method has its own virtues but unfortunately the result is directly incompatible with Wah!Cade, even if using No-Intro file sets.

To convert the No-Intro screenshot packs to use rom names in place of the CRC32 value you can use the attached python script. The script itself is very much in an alpha state, use at your own risk. The script will run over a single directory while reading a dat file (it does not recurse directories) and rename all files matching the required CRC32 based filename.

The result will be a set of artwork images named to match the rom filename as used with No-Intro file sets. If you wish to use these with Goodnamed sets you will need to do further processing or use a version of Wah!Cade which supports fuzzy artwork matching

Usage

  1. Save the script below to <filename>.py
  2. Download a screenshot pack from the No-Intro Screenshot Archive
  3. Download the corresponding dat file for the screenshot pack from No-Intro Screenshot Archive
  4. Extract the screenshot pack
  5. Run the script with python <scriptname> <dat file> <working path> <file extension>

Batch Example

Linux

To run this script as a batch process you could attach the script to a find command

find . -type d -exec python <scriptname> <dat file> {} <file extension> \;

Python Script

#!/usr/bin/python
# -*- coding=iso-8859-15 -*-
 
##### Rom Center Archive Renamer
# author: sairuk
# released: 20101231
# 
# Rename CRC named files to the romname using a
# romcenter dat as input
#
import re
import os
import sys

for arg in sys.argv:
    if len(sys.argv[1:]) == 3:
        wrkfile = sys.argv[1]
        wrkdir = sys.argv[2]
        wrkext = sys.argv[3]
        if not os.path.exists(wrkfile) and os.path.isfile(wrkfile):
            print wrkdir + " not found"
            exit(0)
        if not os.path.exists(wrkdir) and os.path.isdir(wrkdir):
            print wrkdir + " not found"
            exit(0)
        if len(wrkext) < 1:
            print "File extension error"
            exit(0)
    else:
        print "Usage: " + sys.argv[0] + " <dat file> <working path> <file extension>"
        print " Example: "  + sys.argv[0] + " " + chr(34) + "Atari 5200 (20050104_RC).dat" + chr(34) + " " + chr(34) + "Atari 5200/CRC_Snaps/" + chr(34) + " " + chr(34) + "png" + chr(34)
        exit(0) 
           
with open(wrkfile) as ifile:
    for record in ifile:
        result = re.split('\xac',record)
        
        # defaults
        imgext = "." + wrkext                
        romname = ""
        romfile = ""
        romcrc = ""
        i = 1
        for x in result:
                #clear rom details
                if i == 2:
                    romname = str(x)
                if i == 6:
                    romfile = str(x)
                if i == 7:
                    romcrc = str.upper(x)
                # Print Results to screen                
                if romname and romfile and romcrc:
                    if os.path.exists(wrkdir + romcrc + imgext):
                        print "Renaming " + romcrc + imgext + " to " + romname + imgext + " in " + wrkdir
                        os.rename(wrkdir + romcrc + imgext, wrkdir + romname + imgext)
                        romname = ""
                        romfile = ""
                        romcrc = ""
                    else:
                        print romcrc + imgext + " requested but not found in " + wrkdir
                # Move Next
                i = i + 1