Changeset ca8acb7
- Timestamp:
- Oct 2, 2010, 10:15:20 PM (14 years ago)
- Branches:
- master, debian, mac, no-cups
- Children:
- 43ddb7a
- Parents:
- addd785
- git-author:
- Jessica B. Hamrick <jhamrick@…> (10/02/10 22:15:20)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (10/02/10 22:15:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/bin/gbr
raddd785 rca8acb7 12 12 use Image::ExifTool qw(ImageInfo); 13 13 use List::Util 'shuffle'; 14 use File::Find; 14 15 15 16 # the usage for this script … … 19 20 -q, --queue Specify a queue other than the default 20 21 -d, --dryrun Just list what would be done 21 -r, --shuffle Randomize the order that the songs are queued in 22 -s, --shuffle Randomize the order that the songs are queued in 23 -r, --recursive Recursively find files if a directory is passed in 22 24 -h, --help Print this message 23 25 USAGE … … 28 30 my $help = 0; 29 31 my $shuffle = 0; 32 my $recursive = 0; 30 33 31 34 # parse the options … … 33 36 'd|dryrun' => \$dryrun, 34 37 'h|help' => \$help, 35 's|shuffle' => \$shuffle); 38 's|shuffle' => \$shuffle, 39 'r|recursive' => \$recursive); 36 40 37 41 # if the -h flag was passed, then print the usage and exit … … 43 47 # get the files to print from the arguments 44 48 my @files = @ARGV[0 .. $#ARGV]; 49 my @allfiles; 50 51 # if the recursive flag was passed, then recursively find files 52 if ($recursive) { 53 54 # helper function to add a file to the end of the list, but only 55 # if it is a file (and not a directory) 56 sub append { 57 my $name = $File::Find::name; 58 if (-f $name) { 59 push(@allfiles, $name); 60 } 61 } 62 63 # recursively find all the files and add them to @allfiles 64 find(\&append, @files); 65 66 # if we're not shuffling the list, then sort the files. If we are 67 # shuffling the list, then don't bother sorting (since we're going 68 # to shuffle it anyway) 69 unless ($shuffle) { 70 @files = sort(@allfiles); 71 } else { 72 @files = @allfiles; 73 } 74 } 45 75 46 76 # if the shuffle flag was passed, then shuffle the order of the files
Note: See TracChangeset
for help on using the changeset viewer.