Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Play songs by tracknum

Re: Play songs by tracknum

From: Matthew A. R. Sherian <mars_at_mars-tmc.hq.themunicenter.com>
Date: Wed, 03 Mar 2004 08:37:43 -0500

Here is a little perl script I I wrote to rename files. If you are using
linux or have Cygwin (www.cygwin.com)

#!/usr/bin/perl

use MP3::Tag;
use Getopt::Long;
my $basedir;
GetOptions(
        "batch" => \$batch,
        "single" => \$single,
        "help" => \$help
);
unless($batch||$single){
        die "usage: mp3rename.pl {--single|--batch}\n";
}
if ( defined($help) ){
        print "usage: mp3rename.pl {--single|--batch}\n";
}

if ( $batch ){
        _at_ls = split(/\n/,`ls -1`);
        foreach $filename (_at_ls){
                chomp($filename);
                if ($filename =~ /\.mp3/){
                        RN();
                }
        }
}

if ( $single ){
        $filename = $ARGV[0] or print "You must supply a file\n";
        chomp($filename);
        if ($filename =~ m#/#){
                _at_path=split(/\//,$filename);
                pop(_at_path);
                foreach $e (_at_path){
                        $basedir .= "$e/";
                }
        }
        if ($filename =~ /\.mp3/){
                RN();
        }
}
sub RN{
        $mp3 = MP3::Tag->new($filename);

        # get some information about the file in the easiest way
        ($song, $track, $artist, $album) = $mp3->autoinfo();
        if ( ! defined $track ){die "No Track Data, please use id3tag to
provide\n";}
        $song =~ s/\?//g;
        if ($track <= 9 ){
                $track =~ s/(\d)/0$1/g;
        }
        $mp3->close();
        if ($basedir){
                print "Moving from $filename -> $basedir/$track $song.mp3\n";
                rename ($filename, "$basedir/$track $song.mp3")
        }
        else{
                print "Moving from $filename -> $track $song.mp3\n";
                rename ($filename, "$track $song.mp3")
        }
}


On Wed, 2004-03-03 at 04:47, David Newhook wrote:
> Hi there,
>
> I'm new to the list but a longtime owner of an archos player 6000. I've
> only got 4.5gb now thanks to an incident with the original drive during a
> very wet hike on a glacier... :p
>
> I just wanted to know if anyone knows how to, or would like to be able to,
> play a directory of tunes sorted by artist, tracknum then title.
>
> I haven't found a way to do this yet. I know this can be achieved with
> playlists, but I haven't found a tool for compiling lists in the order I
> want (any suggestions) and to be honest, I think generating all those
> playlists for achieving a simple sort, would be overkill.
>
> Or maybe everyone simply enjoys listening to their album tracks in
> alphabetical order?
>
> Suggestions on a postcard please...
>
> Dave
>
> _______________________________________________
> http://cool.haxx.se/mailman/listinfo/rockbox
>
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on 2004-03-03

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy