If you want to import playlists into the Audio Station, you will search the menus in vain for a corresponding option. It’s actually very easy. However, there are a few hurdles to be considered. In this article, I not only explain how to do it, but also give you a little tool at hand.
Supported formats
The Audio Station supports playlists in the formats M3U, PLS and WPL. If your playlist is in one of the formats, you have almost won. M3U is one of the more popular formats. If you have created the playlist in audio software or your own playlist software, you can usually export the playlist in different formats. If your list is in a format that Audio Station does not support, you will have to try to convert the format using software.
Import the playlist
To “import” a playlist, all you have to do is copy it to the right place. In addition to smart lists, the Audio Station knows two types of playlists, group playlists and personal playlists. Depending on whether you want to keep your playlist to yourself or want to make it accessible to all users of the Audio Station, you have to copy the list to different locations.
For group playlists you simply copy the file into the /music folder of your DiskStation.
/volumeX/music
For personal playlists you have to copy the file into the playlist folder of your personal Audio Station (this must be activated).
/volumeX/homes/<User>/music/playlists
Adapt paths
It would all be so easy, if there wasn’t a problem: The individual songs are entered in the playlist with their file paths and since you did not create the playlist on your DiskStation, the paths under which the songs are on your computer are entered there , e.g. M:\Music\Queen\…
instead of /volume1/music/Queen/…
.
Create the script
But that’s easy to fix. I created a script that replaces the paths. So that you can use the script you do the following:
- Download the script here.
- Copy the script to your DiskStation. Alternatively, you can create the script yourself via the command line, the content can be found below.
Attention
If you create scripts yourself, then always via the text editor of the command line (e.g. vi). Never use the text editor of the DS or an editor on your computer and then upload the file to the DS. Line breaks are used – especially under Windows – which cannot then be processed from the command line. The formatting of individual characters (e.g. single and double quotation marks) can also lead to problems on the command line. Do you copy scripts e.g. here from the blog it is best to delete all quotation marks in the command line editor and reinsert them yourself.
- Save the file. You can now use the script to adjust the paths of your playlist.
Use the script
You run the script on the command line (e.g. via PuTTY) and give the desired information as parameters.
- Activates the SSH access under DSM > Control Panel > Terminal & SNMP.
- Connect to your DiskStation via PuTTY.
- Use
cd
to switch to the folder in which the script is located. and run the script:
sh PlaylistReplacer.sh <PlaylistDatei> <OriginalPfad> <PfadAufDerDS> sh PlaylistReplacer-sh /volume1/music/MyMusic.m3u M:/Musik /volume1/music
Important
Use slashes (/) when specifying the original path, even if Windows paths use backslashes (\). These are used for something else in Unix and the find and replace command would not be able to process the path. The script converts all backslashes in the playlist file itself.
- If you do not change to the folder in which the script is located beforehand, you have to specify the path to the script when calling it:
sh /volume…../PlaylistReplacer.sh
- If the playlist file is in the folder in which you are located, it is sufficient to specify the file name, otherwise you must also enter the entire path here.
Adapt the script
The script is quite small and simple:
#!/bin/bash FILE=$1 OLD_PATH=$2 NEW_PATH=$3 #Here all backslashes in the file are converted into slashes and the changed content is saved in a temp file. sed 's!\\!/!g' "${FILE}" > temp #Here all occurrences of OLD_PATH are replaced with NEW_PATH. The content is then written to the original file. sed s!${OLD_PATH}!${NEW_PATH}!g temp > "${FILE}" #The temporary file is deleted again. Yes, I am aware that it would work without a temporary file, but the script was done quick and dirty and after it worked I left it as it is. rm temp
The script overwrites the original file, if you don’t want that, insert NEW_FILE = $4
in line 6 and in line 10 you replace FILE
with NEW_FILE
. Then you can enter a new file name as the fourth parameter when calling the script. Or you can replace "${FILE}"
with a file name (e.g. output.m3u) and then rename the file yourself.