Menu

Android

Martin Scarratt
Attachments
Instructions-android.pdf (82671 bytes)

Randirplay_android 2.1( 23/03/12)
Manual

by Martin Scarratt 30/04/2010

Randirplay_android 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.
This is an offshoot of randirplay and contains some minor modifications and some thinning down of the feature set. Namely the inability to specify a limiting size for the playlist. This is due to a limitation of busybox (the absence of the 'grep -x' command).
I haven't found this to be a problem though as due to the nature of android systems the directories that you will wish to scan will be on the device itself and you will want to use the playlist on that device to play songs on the device, rather than transfer them to another device.
Randirplay_android 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.

Installation
There are a number of modifications you need to make to your device before you can use bash scripts.

I) you need to root your device
II) Make sure busybox and terminal emulator are installed
III) Copy Bash into /system/bin (you’ll need a rooted file browser to do this, eg. es file explorer or you can do it from the terminal emulator after an ‘su’) I use version 4.2 but any version should do the trick – you can find the file on the internet...google it!
IV) make sure ‘ls’ is symlinked (type "ls -1p" to check. If the command doesnt work, type "ln -s /system/xbin/busybox ls" and try again)
V) make a folder /system/myapps (you can call it anything you like as long as it is in /system) copy the file randirplay_android into this folder.
VI) In terminal emulator go to ‘preferences’ and scroll down to ‘initial command’ replce the text there with “PATH=/data/local/bin:$PATH:/system/myapps; su -c bash"
VII) Exit terminal emulator and open it again – hopefully you should see “bash-4.2#” omn the command line
VIII) Type randirplay_android into the terminal and press enter...hopefully it should run...

The custom_dir file
Before you run the program you may wish to set up the custom_dir file. This file tells Randirplay_android which directories to include in your playlist file (without the custom_dir file randirplay_android 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
This feature has been severely affected by the stripping of options and now the only use of this feature is the following:
If you want to include a certain directory without its subdirectories which is outside your specified paths, then you need the following lines in your custom_dir file:
/home/music
+/home/documents/podcasts

Options
The command line syntax is as follows:
randirplay_android [-c filepath] [-p filepath] [-e "extensions"]
There are three ‘flags’ that you can use. These are -c, -p and -e. 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_android_android with this option. If randirplay_android_android can’t find the specified custom_dir file or you haven’t added this option, then randirplay_android 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

-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

Example
Command:
randirplay_android -c /home/dirs -p /home/playlists/playlist -e “.mp3”

/home/dirs file:
/home/music

The above would create a playlist of random albums called playlist.m3u consisting of mp3 files residing in /home/music.


Related

Wiki: Randirplay