Changeset a5cf43b for client


Ignore:
Timestamp:
Oct 2, 2010, 9:32:56 PM (14 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
master, debian, mac, no-cups
Children:
addd785
Parents:
fc8707b
git-author:
Jessica B. Hamrick <jhamrick@…> (10/02/10 21:32:56)
git-committer:
Jessica B. Hamrick <jhamrick@…> (10/02/10 21:32:56)
Message:

Add a randomization option to gbr (Trac #30)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbr

    rfc8707b ra5cf43b  
    1111use Getopt::Long;
    1212use Image::ExifTool qw(ImageInfo);
     13use List::Util 'shuffle';
    1314
    1415# the usage for this script
     
    1819        -q, --queue             Specify a queue other than the default
    1920        -d, --dryrun            Just list what would be done
     21        -r, --random            Randomize the order that the songs are queued in
    2022        -h, --help              Print this message
    2123USAGE
     
    2527my $dryrun = 0;
    2628my $help = 0;
     29my $random = 0;
    2730
    2831# parse the options
    2932GetOptions ('q|queue=s' => \$q,
    3033            'd|dryrun' => \$dryrun,
    31             'h|help' => \$help);
     34            'h|help' => \$help,
     35            'r|random' => \$random);
    3236
    3337# if the -h flag was passed, then print the usage and exit
     
    3741}
    3842
     43# get the files to print from the arguments
    3944my @files = @ARGV[0 .. $#ARGV];
     45
     46# if the random flag was passed, then randomize the order of the files
     47if ($random) {
     48    @files = shuffle(@files);
     49}
    4050
    4151# if the -q option is not specified, then assume we're using the
Note: See TracChangeset for help on using the changeset viewer.