|
||
|
|
|||||||
| Welcome to the Exploding Garrmondo Weiner Interactive Swiss Army Penis. |
|
GFF is a community of gaming and music enthusiasts. We have a team of dedicated moderators, constant member-organized activities, and plenty of custom features, including our unique journal system. If this is your first visit, be sure to check out the FAQ or our GFWiki. You will have to register before you can post. Membership is completely free (and gets rid of the pesky advertisement unit underneath this message).
|
![]() |
|
|
Thread Tools |
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. Jam it back in, in the dark.
Last edited by Duminas; Nov 23, 2006 at 05:05 AM.
|
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'; The same applies to line 39, which is: Code:
`move "$source/$relinfo[1]" "$lastrelease/$relinfo[1]"`; 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";
}
Most amazing jew boots
Last edited by Duminas; Nov 23, 2006 at 07:41 PM.
|