Menu

Linux

Martin Scarratt
Attachments
Instructions-linux.pdf (87384 bytes)

Randirplay 2.1( 23/03/12) for Linux
Manual

by Martin Scarratt 30/04/2010
Randirplay for Linux 2.1 - instructions
NOTE: This program only works if you have your music files organised in such a way that each album is contained in one directory.
Randirplay creates a playlist of files from selected directories such that the order of the files within the directories is preserved but the order of the directories themselves is random. So playing the playlist will result in entire albums being played in a random order.
To install, place the randirplay file in your path and make executable.

The custom_dir file
Before you run the program you may wish to set up the custom_dir file. This file tells Randirplay which directories to include in your playlist file (without the custom_dir file randirplay just scans the folders in the path that it is being run from). To do this, create a text file and add a path to scan for files. eg.
/home/name/music
You can put any number of paths into this file, one per line. The program will scan these paths and their sub-directories and enter all of the music files contained within the paths into a playlist.
Excluding directories
If there is a particular directory contained within one of your paths that you don’t wish to include in your playlist, then you need to add an extra line to the custom_dir file which consists of the path to the unwanted directory preceded with a ‘-‘ sign.
eg.
/home/music
-/home/music/single tracks
This will create a playlist of all files in “/home/music” but will not include files contained within “/home/music/single tracks”. It will still include files within the sub-directories of “/home/music/single tracks” though, so files in “/home/music/single tracks/rock” will be included.
To exclude a directory and all its sub-directories you need to precede the path with ‘-r’ (r for recursive).
eg.
/home/music
-r/home/music/single tracks
This will create a playlist of all files in “/home/music” but will not include files or directories contained within “/home/music/single tracks”. So it will not include “/home/music/single tracks/rock” or even “/home/music/single tracks/rock/whatever”.
Exclusion exceptions
You may want to exclude an entire directory but keep just one or two albums from within it. You can create exceptions to your exclusion lines by starting a new line with –e, or –er for a recursive exception.
Eg.
/home/music
-r/home/music/single tracks
-er/home/music/single tracks/particulardirectory
-e/home/music/single tracks/other/directory
This example would create a playlist of all files in “/home/music” but will not include files or directories contained within “/home/music/single tracks” apart from those within the directory /particulardirectory with its sub-directories and /other/directory/ without its sub-directories.

Permanent directories
Together with the use of some other options (see ‘Options’ below) you are able to limit the size of your playlist. If your playlist size is limited, then not all of the directories within your chosen paths will be included, but your playlist will consist of a random selection of directories from your paths.
If you want a certain album to always appear in your playlist then you must make it a permanent directory. To do this, add a line to the custom_dir file containing the path to that album’s directory preceded with a ‘+’ sign.
eg.
/home/music
+/home/music/favourites
When using a size limitation, this will create a playlist of a random selection of albums contained within “/home/music” but will always include the files contained in the directory “/home/music/favourites”. However it may not include albums contained in the sub-directories of “/home/music/favourites” (this depends on whether they are randomly chosen or not).
To make a directory and all of its sub-directories permanent you must precede your path with ‘+r’.
eg.
/home/music
+r/home/music/favourites
With a size limitation, this will create a playlist of a random selection of albums contained within “/home/music” but will always include the files and directories contained in the directory “/home/music/favourites”.
If there is no size limitation then
/home/music
and
/home/music
+r/home/music/favourites
and
/home/music
+/home/music/favourites
are equivalent.
The ‘+’ prefix can still be useful without a size limitation. If you want to include a certain directory without its subdirectories outside your specified paths, then you need the following lines in your custom_dir file:
/home/music
+/home/documents/podcasts
If there is no size limitation and you want to include the sub-directories of “/home/documents/podcasts” though, the ‘+r’ is not needed, as
/home/music
+r/home/documents/podcasts
is equivalent to
/home/music
/home/documents/podcasts

Options
The command line syntax is as follows:
randirplay [-c filepath] [-s size] [-d device] [-p filepath] [-e "extensions"] [-q]
There are five ‘flags’ that you can use. These are -c, -s, -p, -e and -d. A flag followed by its argument is called an option.

What the flags do:
-c
This flag, along with its argument, points to the location of the custom_dir file. eg -c /home/dirs would point to a file called dirs in the /home directory.
If you have already set up your custom dir file then this option is necessary to enable it. You must make sure you have already created the custom_dir file before you run randirplay with this option. If randirplay can’t find the specified custom_dir file or you haven’t added this option, then randirplay will scan all directories in the current working directory.
-p
-p, along with its argument, tells the program where to save and what to call the final playlist file.
eg -p /home/playlists/playlist would create a playlist in the /home/playlists directory called playlist.m3u
-s and -d
-s and -d are size limiting flages. -d takes precedence over -s, so if you include both the -s flag will be ignored.
The argument that needs to follow -s is the size in Kb that you wish the files in your playlist to be. So adding the option ‘-s 4000000’ will create a playlist which is 4000000Kb in size (about 3.8Gb).
The -d flag automatically determines the free space on whichever drive you choose and sets this number as the size of the playlist. So adding the option ‘-d sda1’ will create a playlist which will fit onto your sda1 drive - you need to make sure the drive is plugged in (but not necessarily mounted) before you run randirplay with this option.
-q
Quick mode - quicker, but not as good a fit to requested size. only use if randirplay seems to run particularly slowly. This flag must be used in conjunction with –s or –d. If –s or –d is not also flagged then –q will be ignored.
-e
This flag allows you to state the extensions that all of the files in the playlist must have. There is a special notation that you must use for the argument that follows the flag.
i. The argument must always start and finish with double quotes
ii. Any period character (dot) must come after a backslash
iii. If you want more than one file extension they must be separated by |

eg.
-e “.mp3” All files ending .mp3
-e "" Everything, whether music files or not.
-e ".mp3|.m4a|.m4b|.wav" All files ending .mp3, .m4a, .m4b and .wav
-e "mp3|m4a|m4b|wav" All files ending mp3, m4a, m4b, and wav (no periods)
If the -e flag is not included then the included files are .mp3, .m4a, .m4b and .wav (which is perfect for iPods).

Example
Command:
randirplay -c /home/dirs -p /home/playlists/playlist -s 4000000 -e “.mp3”
/home/dirs file:
/home/music
+r /home/music/favourites
The above would create a playlist of random albums 3.8Gb in size, called playlist.m3u consisting of mp3 files residing in /home/music. This would include all albums contained within /home/music/favourites.


Related

Wiki: Randirplay