Jump to content

Export Playlist to HTML/Log File - BASH (linux/cygwin)


GregMo

Recommended Posts

GregMo

Several times it has happened that I have done something (like moving my library around) that has caused items to be removed from my playlists to the point that it bugged me enough to write the following BASH script. What this does is to write out a VERY PRIMITIVE html file for each playlist on the server that the defined user has access to.  It also creates an even more PRIMITIVE index file, with the current timestamp as its file name, with each of the playlists hyperlinked in it.

In each playlist file,  the name of each item on the list is written, and it's hyperlinked to the page on the Emby server for that item.  Makes it real handy when you want more info about a particular item on the playlist.  This also includes the overview of each item which solves another aggravation of mine which is not being able to see the overview in the playlist unless you go in and edit the metadata.

I would point out, the script has to run under an OS that supports BASH and other common linux utilities, HOWEVER, the server can run on any system Emby supports.  I'm running this on my linux machine to access the playlists from my Windows server. If you don't have such an OS running, I highly recommend, at the very least, getting cygwin, but preferably grab the FREE Windows version of VM Player and install a linux distro on it (I personally prefer Debian <g>).  Also, this script relies heavily on JQ (https://stedolan.github.io/jq/download/) to parse the JSON data from the Emby server so if you don't have it installed already, you will need to do that first.

Other than that, this script is VERY simple.  Just set the 4 variables at the top and your good to go.

If you use this, please let me know.  Down the road, I might add more to it if there's a desire for it.  One thought I'm toying with now is to zip up a week's worth of backups for archival reasons.  Of course, if I did this, would likely also just add the option of deleting old ones, but we'll see down the road.

As a final note, I've only tried this on playlists with movies and TV shows in them.  No idea how it would handle with music or other such lists.

 

save_playlist.sh

Edited by GregMo
Link to comment
Share on other sites

GregMo

And then, if you wanted to get super fancy, and you have PHP installed, you can grab a better directory viewer from here (https://css-tricks.com/snippets/php/display-styled-directory-contents/).  Just throw it in the directory and start the php server with something like 'php -S 192.168.1.30:8080' and then open it with something like "http://192.168.1.30:8080/.index.php", paying close attention to the period before the word index.  The really nice thing about this is that you can edit the index.php file and on line 62 change the sort command to RSORT and then the newest files will be on top.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...