Sharing Playlists between two Volumio Instances

Looking for a little help in sharing playlists between two Volumio instances. Both are running on RPi’s (one’s an RPi2 the other an RPi3). The music content for each is a separate USB stick - but both have the same content. I suppose I may at some point move the music to an NAS, but I just haven’t gotten there yet.

I read a thread from a couple of years about about sharing the playlists by using the Backup and Restore plugin. This involves using scp to copy the resulting backup file from one machine to another. This does result in the playlists showing up on the second unit, but they will not play.

Looking at the actual playlist, I can clearly see that there’s a specific mount point for each item in the playlist. And that this USB identifier is different between the two units. I took one of the playlist files and did a search and replace for the ‘old’ USB identifier replacing it with the ‘new’ identifier. But that didn’t work either.

Don’t really want to recreate the playlists manually when some have over 100 songs.

Anyone else experience this issue and how did you resolve it (other than implementing an NAS solution)?



I’m going to answer my own question here since I’ve had a little time to think and experiment.

Since my original post I threw together an RPi based NAS since I have these two player instances. My two players originally had USB sticks as the music source, but that meant trying to keep them sync’d, so going to NAS made more sense. And along the way I learned how to convert a playlist on one player from the USB stick based library to the NAS library. And I think that what I’ve learned can apply to people who do have two instances based on USB sticks but can’t for some reason use an NAS solution.

The way to convert one playlist for another purpose - either NAS or USB - is to get ahold of the actual playlist that’s on one player and make some text substitutions. This can be done either on the Volumio player or on a Mac or PC. For my example I’ll use the RPi based player and a PC, but make references to how this might be done on the player alone.

First, where are the playlists? - They are in /data/playlist. They are regular text files, nothing special there. The key is to know what things to look for and substitute.

For each item in the playlist there’s a number of fields that are filled out:

  • “service” - service used for this song [that’s a guess on my part, so if someone can educate me, I’d appreciate it]
  • “uri” - where the song file lives. I am guessing that ‘uri’ may mean Universal Resource Indicator, but that is also a guess, so please educate me if you can.
  • “title” - the title of the song
  • “artist” - the artist of the song
  • “album” - the album on which the song is found
  • “albumart” - where Volumio can find the artwork for the album

Each field in the playlist is contained within brackets ( “{ … }” ) and within each set of brackets are the headers that I mentioned above.

Initially I was focusing on the information in the “uri” section of the playlist item. This section has the format:

  • “uri”:""

When dealing with the mount points, I am aware of two types:

  • USB mount point - “mnt/USB///”
  • NAS mount point - “mnt/NAS///”

For the USB sticks I used I found that the USB ID looked something like “1833-F421”. I’m guessing that if you had a USB based disk you would see a similar identifier. Each USB stick has a different identifier. So my initial attempt to convert playlists focused on doing a search and replace on the identifier swapping out one identifier for another. This did not work and is what prompted my initial post.

For the NAS ID, it is the name of the NAS system seen on the network. This is the same name that you put in in the “Settings/Sources” section of the Volumio app.

Upon further inspection, the “albumart” section of the playlist item also contains information about the mount point and the location of the song. This is contained in the ‘path’ part of the “albumart” section. The information in the ‘path’ is the same as that found in the “uri” as shown above. But the format here is a bit different in that instead of a “/” between items in the path, you will see a “%2F”. I’ve found that the mount point information in this section of the playlist item must also be changed or the altered playlist will not work.

With this understood, modifying playlists from one USB stick to another, or from a USB playlist to a NAS playlist (or the reverse) is fairly straightforward assuming that the structure of folders that the songs are in are the same between the two.

The process can be described simply by these 5 generic steps:

  1. Find the original playlist
  2. Do a search and replace for every instance of the mount type - USB or NAS - if required.
  3. Do a search and replace for every instance of the USB or NAS ID
  4. Save the file with a different name to avoid confusion.
  5. Move the file to the target player.

In doing the search and replace independently for the mount type and the USB or NAS ID, you will find and fix the information in both the “uri” and “albumart” sections of each playlist item. I tried doing a search and replace for both at the same time, but this didn’t catch the information in the “albumart” section.

If you want to do this on the player (like on the RPi) you can use Linux tools like bash, and sed. I was tempted to figure out how to create a bash script that would do this given the old path and the new path as inputs, but it’s been too long since I’ve worked with bash, so I’ll leave that to more talented people. Maybe if someone comes up with a script they’ll post it here or somewhere else.

If you have a PC (sorry, don’t have a Mac, so I can’t talk about that), you can use tools like WinSCP to copy the playlist file to your PC, and then use a tool like Notepad++ to do the search and replace operations. Then copy the modified file to the target player. Please do note that with Notepad++ it will append a “.txt” to the end of the filename you create, so what I did was once I copied the new file to the target player I simply did a “mv filename.txt filename” and all was good.

Sorry for the long narrative, but I’ve learned a lot from the folks in this community while working on my Volumio projects and wanted to return the favor.