Changeset 43ddb7a


Ignore:
Timestamp:
Oct 2, 2010, 10:24:17 PM (14 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
master, debian, mac, no-cups
Children:
e83b2d7
Parents:
ca8acb7
git-author:
Jessica B. Hamrick <jhamrick@…> (10/02/10 22:24:17)
git-committer:
Jessica B. Hamrick <jhamrick@…> (10/02/10 22:24:17)
Message:

Added a -n flag to gbr, to specify the number of files to play

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbr

    rca8acb7 r43ddb7a  
    2222        -s, --shuffle           Randomize the order that the songs are queued in
    2323        -r, --recursive         Recursively find files if a directory is passed in
     24        -n, --number NUMBER     Only print NUMBER files, if more than NUMBER are given
     25                                (this will print the first NUMBER files if -s is not given)
    2426        -h, --help              Print this message
    2527USAGE
     
    3133my $shuffle = 0;
    3234my $recursive = 0;
     35my $number = 0;
    3336
    3437# parse the options
     
    3740            'h|help' => \$help,
    3841            's|shuffle' => \$shuffle,
    39             'r|recursive' => \$recursive);
     42            'r|recursive' => \$recursive,
     43            'n|number=i' => \$number);
    4044
    4145# if the -h flag was passed, then print the usage and exit
     
    7781if ($shuffle) {
    7882    @files = shuffle(@files);
     83}
     84
     85# if the number flag was specified, then only play the specified
     86# number of files
     87if ($number > 0 and $number < $#files) {
     88    @files = @files[0 .. $number-1]
    7989}
    8090
Note: See TracChangeset for help on using the changeset viewer.