Page 1 of 1

Custom Random Playlists

PostPosted: Wed Jul 06, 2016 4:11 am
by cybersaga
I thought I'd share something I setup. I wanted random video playlists, which isn't supported out of the box in Serviio right now. So I setup something to do it for me. This will work for audio too.

I ended up writing a pretty basic program (Windows-only, .NET 4 required) to read all the files in a folder and put them all in random order into an m3u playlist file. Then I setup a scheduled task in Windows to run that every hour.

For anyone else wanting to set this up, I put the little program on GitHub. The exe can be downloaded here: https://github.com/gabeluci/Random-Play ... ses/latest

In its simplest form, you run this:
  Code:
Random.Playlist.exe [folder with files]


So for example, in my case I run (Yes, this is mainly for the kids):
  Code:
Random.Playlist.exe "K:\Video\Baby Einstein"


That creates the file "K:\Video\Baby Einstein\Random Baby Einstein.m3u" with all the media files inside that folder listed. It will only include audio OR video files, but not both.

There are more options. For example, you can include several folders and search all subfolders. Here are all the options:
  Code:
Random.Playlist.exe [-d folder1 folder2] [-p playlistName] [-r] [-t audio|video]
                    [-m maxLength] [-x types] [-i types] [-h]

  -d    A list of folders to include, separated by spaces.
        If this is not included, the current folder is used.
  -p    The name of the playlist file. If not specified,
        the playlist will be named after the first folder being searched,
        preceded by the word Random. e.g. Random Music.m3u
  -r    Recurse subfolders.
  -t    Specify whether to look for audio or video files. If not specified,
        the first file found will determine if it looks for audio or video
        files. e.g. If it comes across an audio file first, then only audio
        files will be included.
  -m    Limit the playlist to this many files.
  -x    A list of file extensions to exclude, separated by semicolons.
        e.g. -x m4a;wav
  -i    A list of file extensions to include, separated by semicolons.
        All other files will be ignored. e.g. -i mp3;m4a
  -h    Show this help screen


Set that up as a scheduled task in Windows to run, say, every hour, and Serviio will pick up the changes when they happen.

If you want to create multiple playlists, it's simpler to create a batch file and list each one:
  Code:
Random.Playlist.exe "K:\Video\Baby Einstein"
Random.Playlist.exe "K:\Video\Signing TIme"
Random.Playlist.exe "K:\Video\Octonauts"


Then set up the scheduled task to run that batch file.

I hope this helps someone! I tried a *ton* of different DLNA server software, and Serviio fit my needs the best. This was the only feature I wanted that Serviio didn't have.

Re: Random Video Playlists

PostPosted: Wed Jul 06, 2016 1:46 pm
by jhb50
Great Idea. You should repost this in the 3rd Party Tools Integration section as a [TOOL], or send zip a note and ask him to move it, so it does not get lost in this support section. I'm thinking this could also be used for music and image playlists and would be very popular for random songs and random slideshows.

Re: Random Video Playlists

PostPosted: Wed Jul 06, 2016 2:25 pm
by cybersaga
Thanks, I sent him a note. I didn't notice that forum when I posted. Maybe I just didn't scroll down far enough :)

I'm thinking of developing this further into a general purpose command line playlist generator. I had done some searching, and I couldn't find any out there. There were several playlist generators with GUI's but nothing command line that I could setup as a scheduled task.

Right now it just dumps the file names into the m3u file, but later I might add the extended information (the "EXTM3U" and "EXTINF" lines). Serviio doesn't seem to care, but other programs might.

Re: Random Video Playlists

PostPosted: Fri Jul 08, 2016 2:25 am
by cybersaga
Turns out that it does work great with music files, and it's a good workaround for an existing problem between Serviio and Sony devices. See here: viewtopic.php?f=11&t=22190

Re: Custom Random Playlists

PostPosted: Wed Dec 21, 2016 10:55 pm
by Tedward
Thanks! I have been looking for a way to do this, it works perfectly! :D

Re: Custom Random Playlists

PostPosted: Fri Dec 23, 2016 3:23 pm
by DenyAll
Agree, nice app that works perfectly. I've come across it just in time to randomise about a gig's worth of Christmas carols/songs ready to drive the family crazy :lol:

Re: Custom Random Playlists

PostPosted: Fri Dec 23, 2016 3:31 pm
by cybersaga
My condolences to your family. :)

Re: Custom Random Playlists

PostPosted: Thu Nov 09, 2017 12:28 am
by utaaanaga
You can use this on linux

  Code:
cd /media/Music/
find . -type f  -name "*.mp3" -o -name "*.ogg"  -name "*.flac" -o -name "*.wav" -name "*.m4a" |sort -R |head -n 100 > /media/Music/random.m3u

Re: Custom Random Playlists

PostPosted: Sat Mar 16, 2019 11:28 am
by corysmith
cybersaga wrote:I thought I'd share something I setup. I wanted random video playlists, which isn't supported out of the box in Serviio right now. So I setup something to do it for me. This will work for audio too.

I ended up writing a pretty basic program (Windows-only, .NET 4 required) to read all the files in a folder and put them all in random order into an m3u playlist file. Then I setup a scheduled task in Windows to run that every hour.

For anyone else wanting to set this up, I put the little program on GitHub. The exe can be downloaded here: https://github.com/gabeluci/Random-Playlist-Generator/releases/latest/cheapessay


There is likewise setting menu for Recycle Bin. I don't have the foggiest idea how to expel it from that point.

You can't include envelope with spaces from right snap. (Be that as it may, your principle envelope could have spaces, won't be an issue.)

Re: Custom Random Playlists

PostPosted: Sat Mar 16, 2019 7:10 pm
by cybersaga
corysmith wrote:You can't include envelope with spaces from right snap. (Be that as it may, your principle envelope could have spaces, won't be an issue.)


I'm not sure I understand what you are saying. Do you mean that the folder names have spaces in them? If so, put the folder names in quotes:

Random.Playlist.exe -d "C:\Folder One" "C:\Folder Two"

Custom Random Playlists

PostPosted: Mon Nov 11, 2019 6:35 pm
by AlikRuids
At me a similar situation. Is ready to help.

Re: Custom Random Playlists

PostPosted: Thu Jan 14, 2021 2:15 pm
by Gregorius
Exactly the feature I wanted to have in Serviio for years now. Does anybody have a solution for this?

I just found this here:
https://github.com/gabeluci/Random-Playlist-Generator

Re: Custom Random Playlists

PostPosted: Thu Jan 14, 2021 5:09 pm
by cybersaga
Gregorius wrote:Exactly the feature I wanted to have in Serviio for years now. Does anybody have a solution for this?

I just found this here:
https://github.com/gabeluci/Random-Playlist-Generator


What you linked to is the same application I described in the first post of this thread. Did you have trouble with it?

Re: Custom Random Playlists

PostPosted: Wed Aug 30, 2023 8:22 pm
by g121
Excellent cybersaga .. your "Generate Randomized Playlist" fits my need perfectly .. Thank you.

I listen to standup comedy late nights & I auto run your "Generate Randomized Playlist" nightly so I always have a fresh order of comedy routines to enjoy.

Its been working like a charm for a month now.

My only issue is that just in the last few of days, my Serviio Shared Folder has stopped auto-refreshing & so I'm seeing the old, not the newly generated playlist. Why the Auto Refresh stopped working after a month I don't know.

I'm looking for a Serviio batch command/routine to add to my batch file to Force Refresh of my shared folders .. but no success yet.