Hello, My problem is this one : I want to create a playlist via a cron job. Inside the playlist generated, I want to put full path to songs and insert full path to sweepers at defined interval. I do not want to use a browser interface or a database and here is how I imagine it to work : 1/ the cron job will create two files including the full path to the stored files, one file per line. It will delete the old playlist destination file. 2/ the playlist generator will be started provided the variables (see below), it puts its counters ($counternb and $countersongs) to 0 3/ it starts by creating a playlist destination file and put #EXTM3U as its first line 4/ it will randomly choose a line from the songs playlist and put it in the destination playlist as its last line. It deletes the choosen line from the songs playlist (anti repeating solution). 5/ it counts $counternb +1 and $countersongs +1 6/ it continues to choose files from the songs playlist still $counternb has reached a defined value by a variable 7/ when it reaches the counter ($counternb) value, it takes randomly a line from the sweepers playlist. As the sweepers playlist will have less number of lines than the songs playlist, its line won't be deleted and the reading must loop (random repeating allowed) 8/ the $counternb is set to 0 again 9/ the generator continues till the number of $countersongs hasen't reached a defined value 10/ when $countersongs has reached a defined value it must send a signal Variables : --------- Files : 1/ songs = full path to the file containing the path to the songs file. For example: /home/user/[url removed, login to view] 2/ sweepers = full path to the file containing the path to the sweepers file. For example: /home/user/[url removed, login to view] 3/ destfile = full path to the generated playlist. For example: /home/user/[url removed, login to view] Counters : 1/ nbsongs = number of songs to put inside a playlist 2/ interval = number of songs before a sweeper Signal : For example : killall -USR1 sc_trans
Script or binary Notes : ---- 1/ you can name the variables exactly as you want 2/ if you create a binary, it should be very usefull to provide the variables and their usage when from prompt calling ./binary --help 3/ if creating a binary, it could be very interesting to compile it as static to make it portable as possible 4/ some file names can have UTF-8 names (stressed letters) Usage : ----- I will use this system to operate a little web radio broadcasting Creative Commons. This is a personal use only and absolutely not commercial.
- Linux - you can use perl, python or C, still it can be started as a cron job. This is your choice.