SID2LFN Information Oct. 9, 1997 ------------------- shark@dhp.com What SID2LFN tool do? --------------------- SID2LFN renames PSID files based on their associated TITLE strings. The renamed file will follow the High Voltage SID Collection (HVSC) standard by making the extension ".sid". Such a tool is handy for various reasons. Most people will find it usefull when renaming legacy SID collections which used other naming standards as well as for SIDs with 8.3 MSDOS filenames. The maximum length of a SID filename is set at 31 characters. This includes the extension (also referred to as 27.3). Incidentally, the length of a PSID TITLE string is set to 31 characters. The reason we have limited the base filename to 27 characters instead of 31 is so that the HVSC standard filename will be compatible with all the major OSes. AmigaOS only allows 32 characters for a full filename where as MacOS only allows 31 characters. So once again MacOS is the _least common_ denominator (hi mr.sid). It should be obvious that this tool is not intended for people who are using OSes that do not allow 31 character filenames (MSDOS/Win3.1/Atari Falcon). Also, _do not_ run this tool on HVSC unless you do not care to be compatible with future HVSC updates. The HVSC updates rely on the HVSC SIDs having specific filenames. How do I use SID2LFN? --------------------- Usage: SID2LFN [-j -p -r] [filename] Flags: -j -> Ignore JCH's "TIME: " string and the text that follows. -p -> Turn on prefix mode for filename. Not needed for "PSID.*" files. (read example below for more details) -r -> Renames all valid files in current & sub dirs Examples: SID2LFN -r {converts all files in current and sub-directories} SID2LFN -j Hollow.dat {see example further in file...search for "JCH"} SID2LFN -jr {flags can be merged} SID2LFN -j -r {...or separated} SID2LFN * {supports wildcards...does files in current dir only} SID2LFN -p dat.Agima {This option is somewhat complicated. By default, SID2LFN handles "PSID.*" files with no problem. Further, SID2LFN handles all files, regardless of prefix or suffix, provided that the TITLE string can successfully be converted to a filename based on the rules described in this file. If the TITLE string cannot be converted, the file still gets renamed by keeping the base filename, but appending a ".sid" as the extension (suffix). The only time SID2LFN will rename files undesirably is when the file has a prefix that is not "PSID." _and_ the SID's TITLE string cannot be used for the filename. As an example, Current Filename: MUS.The_Shark SID TITLE STRING: Resulting Default Filename: MUS.sid Resulting Filename w/ -p: The_Shark.sid The reason why such a flag is needed is because there is no 100% successful way to detect whether the text before the period in a filename is the base filename or if it is the prefix. This flag primarily is for Amiga users, btw. } What are the rules SID2LFN uses to rename SIDs? ----------------------------------------------- Valid characters allowed in filename are: A-Z,a-z,0-9,_,- (exclude the comma) A period will only be used to separate filename and extension. The reason we limit the tool to these characters has to do with portability. The research done by the POSIX committees conclude that this character set is the most portable character set. If the title has a character out of the specified set, it shall either be skipped, replaced with an '_', or be specially handled. Continue reading for more details. If the SID TITLE cannot be used as the filename, the original filename shall be used. The first character of the filename will be in uppercase and the rest of the filename will be in lowercase. The filename will have an extension of ".sid" as well. Examples (and more rules...) -------- # All the filenames below are shown w/o the file extension. # Apostrophe is skipped; spaces become '_'; This one is tricky. # "Ghost'n Goblins would look silly with the 'n' merged. Thus, I search # for the following char. If the char is 'm', 's' or 't', merge. # Otherwise, replace with '_'. TITLE: Edwin's Dream FILENAME: Edwins_Dream # No filename will start or end in an '_' or a '-' TITLE: Just Cool! FILENAME: Just_Cool # Two consecutive '_' or '-' will not appear in a filename. TITLE: Gyroscope (Loader) FILENAME: Gyroscope_Loader # Spaces surrounding a '-' shall be skipped TITLE: Demonic - Part 1 FILENAME: Demonic-Part_1 # Periods get replaced by '_'; Notice a trailing underscore is absent. TITLE: R.I.S.K. FILENAME: R_I_S_K # "The " at the start of the title shall be skipped. TITLE: The Paranoia Complex (Intro) FILENAME: Paranoia_Complex_Intro # '&' shall be replaced with "and" TITLE: Ben & Tony Music FILENAME: Ben_and_Tony_Music # If the title is , no new filename shall be given. This also applies # to any filename that consists purely of characters outside of our # accepted character set. I should note that the filename does not # actually stay the same. The first character of the current filename # will be in uppercase and the rest of the filename will be in lower case. TITLE: FILENAME: {remains the same} # If a title is followed by a "" or "<#>", the special symbol shall be # ignored. TITLE: Miami Dice FILENAME: Miami_Dice # The JCH clause (if turned on). All text after the "TIME: " string is # ignored. TITLE: Batman (long) TIME: 4:52 FILENAME: Batman (long) # Funky foreign char clause. This applies to some of the most popular # European language characters. v-two dots TITLE: Hulsbeck Sings FILENAME: Huelsbeck_Sings # A title ending in the '+' character is replaced with the string "_plus" TITLE: IK+ FILENAME: IK_plus # Tiles longer than the max. filename length shall be truncated at the # max. length. TITLE: Trans Atlantic Balloon Chlng. FILENAME: Trans_Atlantic_Balloon_Chln ********* I believe this covers all the rules. See the source code for more details.