Command-line based shuffle music player that remembers songs between sessions
randomplay [options] [directory ...] [file ...]
Options: --help brief help message --man full man page --version show the version number and exit -q, --quiet quiet output: don't report name of each song as it is played -v, --verbose verbose output: include output from player program on console -d n, --days=n minimum days since track was last played for it to be considered (default 10 days) n can be number of days, or add suffix (W = week, M = month, Y= year), or can be an absolute date -0 special case to ignore history entirely (equivalent to --days=0) --random shuffle track listing (default random) --norandom --remember remember tracks played for future sessions (default remember) --noremember --utf8 use UTF-8 encoding for output (default utf8) --noutf8 -w, --weight weight random shuffle to prefer songs rated as favorites (default weight) --noweight -r, --regexp=regexp string only play files where filename matches regexp string -n, --names-only don't play tracks, only give list of filenames -t n, --tracks=n how many tracks to play (or display) total (default unlimited) --maxsize=number of bytes maximum number of bytes of music to play or display (default unlimited) --maxtime=duration how long to play before stopping (minutes or hours) (default unlimited) -l n, --last=n play last X songs in same order as they were played before --newer-than n, --newer n only play songs newer than n days old (e.g., W = week, M = month, Y = year, default days) or newer than date n --older-than n, --older n only play songs older than n days old or older than date n --basedir=directory directory to which all other directory specifications will be relative --history=filename file to use for randomplay history (default ~/.randomplay_history) --clear permanently clear (delete) the history file, start over with new history --pause=n delay between songs in seconds (default one second) --announce=command program to run to announce each new track track information is piped into program set to a blank string if you don't want any on screen announcements (default is xosd if it is installed) --player extension=command play files with extension with specified command (default mp3=mpg321, ogg=ogg123) --key function=keystroke define alternative keystrokes for player actions (defaults below) Default keys while playing: h, ? show keystrokes (set with --key help=keystrokes) + increase the currently playing song's random weight (set with --key like=keystrokes) - decrease the currently playing song's random weight (set with --key dislike=keystrokes) 0, = reset the currently playing song's randow weight to 0 (set with --key reset=keystrokes) f skip to the next song (set with --key next=keystrokes) b skip to the previous song (set with --key back=keystrokes) p pause the playback (toggle) (set with --key pause=keystrokes) l quit randomplay after the current song is finished (set with --key quit=keystrokes) q quit randomplay (set with --key last=keystrokes)
randomplay is a shuffle music file player with a memory across sessions. randomplay also can remember which songs you like better and weight them more heavily in the random shuffle. It can also be used to play a directory or set of directories nonrandomly, remembering where you left off between seessions. You can specify any number of directories to be recursively searched for music files, as well as how long since a track was last played for it to re-enter the rotation. You can also keep track of different playlist histories (for example, for different users of the same account) by specifying a different history filename. All options can also be kept in ~/.randomplayrc, with one option per line, option name followed by a space followed by the option value. Command line settings will override settings specified in ~/.randomplayrc; later settings will override earlier settings. There is a default randomplayrc that comes with this package and includes all possible settings.
Play all ogg files in dir1 and dir2 under your home directory, and dir3 under the base directory specified in ~/.randomplayrc, which have not been played for 15 days in random order with 5 seconds between songs:
randomplay --days=15 --pause=5 --player ogg=ogg123 ~/dir1 ~/dir2 =dir3
Play all ogg, wav, and mp3 files under the current directory (or base directory, if specified in .randomplayrc file) which have not been played for 10 days in alphabetical order, switch the 'skip to next song' keystroke to 'G' or 'g' and 'quit' to 'q' or 'c':
randomplay --norandom --key next=Gg --key quit=qc
Play all files under the current directory with the strings \*(L"frisell\*(R" and \*(L"bill\*(R" in the filename, in any order, (saves having to hunt down a file in a hierarchy), ignore whether the file has been played recently, but stop playing after 15 minutes:
randomplay --regexp 'frisell bill' -0 --maxtime=15m
Display 100M worth of music files, randomly sorted, without recording the history of tracks, using the default music directory (or the current directory if not specified):
randomplay --maxsize=100M --noremember --names-only
Play the last 10 songs played over again:
randomplay --last=10
Play songs test.ogg, test2.ogg, test3.ogg, and all files in musicdir in random order without weighting preferred songs:
randomplay --noweight test.ogg test2.ogg test3.ogg musicdir
Copy 128M of songs into a Neuros Audio Player, using positron:
positron add `randomplay --names-only --maxsize=128M`
Pick a random jpeg or png file that has not been displayed in the last week from the 'images' directory and display it with ImageMagick 'display' command:
randomplay --player jpg=display --player gif=display --days 7 ~/images
Most options can be abbreviated as a single letter; e.g., -t for --tracks, -d for --days, -r for --regexp. You can also omit the \*(L"=\*(R" sign between the option and the value if you prefer. If many options start with the same letter (e.g., --maxtime, --maxsize), then you must use the full name for the option.
For maxsize, you can use \*(L"k\*(R" for kilobytes and \*(L"m\*(R" for megabytes, or just enter the number of bytes.
For maxtime, you can use \*(L"s\*(R" for seconds (default units), \*(L"m\*(R" for minutes, \*(L"h\*(R" for hours, or \*(L"d\*(R" for days.
You might want to specify a \*(L"basedir\*(R" setting in your .randomplayrc, if all your music is under a certain directory. Then you can just give the relative names of the directories on the command line\*(--e.g., you have \*(L"basedir=~/music\*(R" in ~/.randomplayrc, and rock is a directory under ~/music, so just enter \*(L"randomplay rock\*(R".
Randomplay will search for music in specified subdirectories first under the current working directory, and then relative to the basedir setting, if any. If the specified directory name begins with =, it will be searched relative to the basedir setting, even if the specified directory also exists under the current working directory.
Spaces in regexps are turned into \*(L"ands,\*(R" making it more convenient to find the files you want. For example, --regexp 'thelonious monk blues' will play all songs with the words thelonious, monk, and blues in the filename, regardless of the order in which those words occur. Regexp searching is case-insensitive.
If you specify an extension and a player for that extension, either in ~/.randomplayrc or on the command-line, only files with that extension will be played. You can, however, specify multiple players/extensions in either place, and all extensions listed will be played.
The --last option implies --norandom and --noremember.
Copyright (c) 2003-2006 Adam Rosi-Kessel. This is free software; see the source for copying conditions. There is \s-1NO\s0 warranty; not even for \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0, to the extent permitted by law.
Your history file will grow indefinitely. This could either be a bug or a feature. You may want to clear the history at some point. It might also compromise your privacy if other people can see your history file and you are concerned about people knowing which songs you have listened to.
The system used to kill the music player when you decide to skip to the next track looks up the process IDs using 'ps'; this may not work on all platforms.
The --maxtime option only works if you actually play the songs; it calculates actual time elapsed, rather than totalling the length of the tracks. This may or may not be the behavior you expect.
Adam Rosi-Kessel, [email protected] <mailto:[email protected]>