Exploding Garrmondo Weiner Interactive Swiss Army Penis

Exploding Garrmondo Weiner Interactive Swiss Army Penis (http://www.gamingforce.org/forums/index.php)
-   Help Desk (http://www.gamingforce.org/forums/forumdisplay.php?f=36)
-   -   Re-organizing folders from #gamemp3s releases (http://www.gamingforce.org/forums/showthread.php?t=14998)

Rock Nov 21, 2006 07:41 AM

Re-organizing folders from #gamemp3s releases
 
What I need to do is the following:

Organize my #gamemp3s music so they match their original folder scheme (i.e. 2006-11-3/folders/).

Right now I have all the seperate albums in a single folder, but just displaying its contents takes ages with 400+ subfolders. So I want to seperate the albums back into their original release date (year-month-day) folders.

Needless to say, I can't do this manually, since it would take forever. I need some sort of script/macro that takes information from the #gamemp3s release history and organizes my folders accordingly. All subfolders (album names) are untouched, so this should work out well.

Any suggestions on how to get started?

Rock Nov 22, 2006 03:34 PM

Anyone, please.

This can't be an impossible task. I do have some experience with VisualBasic scripting, but I just need some pointers on this. At least I think VB would be a good way of getting something like this done.

Duminas Nov 23, 2006 04:59 AM

Helps if I read.
As I assume slashes, colons, ampersands, and the like are not valid in Windows file/directory names, what do you use for special characters?

Super Metroid “Sound In Action” being an example here--I know double-quotes aren't valid in filenames, but I have very little experience with gamemp3s' rips and naming conventions. Trying to figure out how things are named in case of special characters so I can whip up a script for you.

Rock Nov 23, 2006 06:04 AM

The actual folder for Super Metroid "Sound in Action" has normal quotes in it.

Still, I don't want to rename these folders, but rather have them moved to their respective YEAR-MONTH-DAY\ subfolder, so all I need to do is compare my folder names from that release list and put them in the right subfolder. All of them are currently in the same folder.

If there are some special characters that can't be read, I might as well sort those folders out manually.

Thanks a lot for your reply, any help is greatly appreciated.

Duminas Nov 23, 2006 07:36 PM

1 Attachment(s)
Alright, a couple things.

First, there's an archive attached--you need this, as it has two files. One has a list of all the albums (I extracted that with another script I forgot to save =\ ), and another is the Perl script itself; the script also expects that file to be with your albums, so drop it into the $source you'll be defining below.

I also did not test this much, but when I did, it was in the same directory as the empty album directories were. Also, there's a small edit you need to make to the third line of the script, which is (as in the archive):
Code:

$source      = '/home/duminas';
Change that to wherever the big album directory is. You may need to change it to something like C:\Music due to how Windows naming works.
The same applies to line 39, which is:
Code:

                `move "$source/$relinfo[1]" "$lastrelease/$relinfo[1]"`;
The forward-slashes may need to be changed to back-slashes.

Third, this will say it succeeded if it _FINDS_ the directory--it may fail to move it, due to some odd characters here and there (ampersands as an example). These you will need to deal with on your own.

Fourth, it changes the release dates from, say, 2006/11/14 to 2006-11-14. This is really minor, but just bringing it up. I'm also going to put the code straight away below for anyone who wishes to see it, but you'll need both.

You'll also need to install Perl if you want to use this. I'll help you with that if you need it.

I hope this works for you, Rock.

Code:

#!/usr/bin/perl
# Where is the current massive folder? No trailing slash.
$source          = '/home/duminas';

if(!chdir($source)) {
        die("$! ($source)\n");
}

open(FILE, 'gamemp3s_albums.txt');
@list = <FILE>;
close(FILE);

my $lastrelease;
my @relinfo;
foreach $line ( @list ) {
        chomp($line);

        # Break it into an array at the three dashes.
        # First part will be the date, second is the name.
        @relinfo = split(/---/, $line);

        # New release?
        if($relinfo[0] ne $lastrelease) {
                $lastrelease = $relinfo[0]; $lr_dir = $lastrelease;
               
                $lr_dir =~ s/\//-/gi;
                # Try to make the album directory.
                if(!mkdir($lr_dir)){
                        die("Failed to make directory! $! ($lr_dir)\n");
                }

                print "$lastrelease\n";
        }

        # Now print the album...
        # You MAY need to change the forward slashes here to a backslash.
        if( -d "$relinfo[1]") {
                # rename() is pretty crazy, so I'm using a move DOS call here.
                `move "$source/$relinfo[1]" "$lastrelease/$relinfo[1]"`;
                # `mv "$relinfo[1]" "$lr_dir/$relinfo[1]"`;
                print ": Moved album:\n\t";
        }
        else {
                print ": Could not find album to move:\n\t";
        }
        print "\t$relinfo[1]\n";
}


Sir VG Nov 23, 2006 11:43 PM

Another method that could be used is using a program called ClrMamePro. If you (or somebody else) builds a database and then runs your files through it, it'll sort everything on its own. It confirms a file is a match via CRC codes and can fix file and folder names if necessary.

I've thought about doing something like this at some point, but I haven't done so yet. I'm still learning about the program for making databases. I might try fooling around with it some more later.


All times are GMT -5. The time now is 10:25 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2026, vBulletin Solutions, Inc.