Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Oct 2005

    Playlist synch with Linux and Windows

    I have a Slimserver running on Linux and a Windows workstation that is used to rip music and organize playlists with Media Jukebox. All music is stored on a Samba Share on the Linux box and works fine since the slimserver uses the same directory.

    However one problem is that the playlists that I export from MJ in .m3u format doesn't work. The problem is that the workstation sees that path to the music as M:\ and the Server sees it as /usr/mp3. The workstation uses \ where the server uses / in the path.

    I've noticed that a lot of people seem to have similar problems but I really haven't found a good solution so I did a quick-and-dirty solution that works ok for me. It's a small script on the Linux-server that looks like this:

    ls /usr/playlists/*.m3u | while read -e FNAME
    sed -e 's/M:\\/\/usr\/mp3\//g' "$FNAME" > "${FNAME}2"
    rm -f "$FNAME"
    sed -e 's/\\/\//g' "${FNAME}2" > "$FNAME"
    rm -f "${FNAME}2"

    The first sed line changes the M:\ to /usr/mp3 and the second one changes \ to /. Whenever the script is run it changes this for all files named .m3u in the playlist directory. Every time I've exported a playlist I run the scripts. It can also be scheduled.

    To make it work for another setup the paths (M:\ and /usr/mp3) needs to be changed. Hope someone finds it useful. It's been at least 10 years since I did any shell programming so it's not exactly beautiful but it works. Any suggestions on improvements are welcome

    I briefly checked what other possible solution might exist and I found two roads that might be better.

    1) Using a Samba VFS (Virtual File System) and change the read and write functions so that these changes are being made during read and write. Possibly this could work both ways so that the files could be both opened and writtten to from the workstation.

    2) Also there is a sw called FAM (File Alteration Maonitor) that possibly could be used to automate file changes as soon as a file is dropped in the playlist directory.

    If anyone have had success with these two options please share your experences. Even better would of course be if something similar could be built in to the slimserver. Maybe a configurable importfilter for playlists that can change the playlists as they are imported and exported.

    / Peter

  2. #2
    Join Date
    Apr 2005
    Ketelhaven, the Netherlands

    Playlist synch with Linux and Windows

    > ls /usr/playlists/*.m3u | while read -e FNAME
    > do
    > sed -e 's/M:\\/\/usr\/mp3\//g' "$FNAME" > "${FNAME}2"
    > rm -f "$FNAME"
    > sed -e 's/\\/\//g' "${FNAME}2" > "$FNAME"
    > rm -f "${FNAME}2"
    > done
    > Any suggestions on improvements are welcome

    A few points:

    - The '-e' is not necessary (and it even seems syntactically wrong,
    as it should expect a script file to read).
    - The first char right after the 's' in the sed command is the field
    separator. You have it set to '/', which then forces you to escape
    it when you want to use it as part of the string. If you instead
    choose a different separator, your sed command will become more
    - You could use a generic temp file, which makes the code more readable.


    ls /usr/playlists/*.m3u | while read -e FNAME
    sed 's|M:\\|/usr/mp3/|g' "$FNAME" > "${TMPFILE}"
    sed 's|\\|/|g' "${TMPFILE}" > "${FNAME}"
    rm -f "${TMPFILE}"


  3. #3
    Junior Member
    Join Date
    Oct 2005


    for the suggestions Niek. They make the code much more readable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts