Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Shared playlist on NAS?
#11
Hi @Tim Curtis,

The final working solution is:
1) Exclude the playlists from the backup. This is optional
2) Run the script I made. 

The script removes everything ( when "all" as argument) and creates symlinks to the playlists and playlist covers on the NAS, or just replaces local files with symlinks to the NAS content

Code:
#!/bin/bash
DESTINATION_FOLDER_PLAYLISTS=/var/lib/mpd/playlists
DESTINATION_FOLDER_PLAYLIST_COVERS=/var/local/www/imagesw/playlist-covers

# all as argument removes everything
if [[ "$1" == "all" ]]
then
   echo "Removing all playlists and playlist covers"
   sudo rm $DESTINATION_FOLDER_PLAYLISTS/*.m3u 2>/dev/null
   sudo rm $DESTINATION_FOLDER_PLAYLIST_COVERS/*.jpg 2>/dev/null
fi


# Playlists
echo "Patch playlists"
SOURCE_FOLDER=/mnt/NAS/Music/Playlists/*.m3u
for filepath in $SOURCE_FOLDER; do
       file=$(basename -- "$filepath")
       symlink_file="$DESTINATION_FOLDER_PLAYLISTS/$file"
       sudo rm "$symlink_file" 2>/dev/null
       sudo ln -s "$filepath" "$symlink_file"
done


# Playlist covers
echo "Patch playlist covers"
SOURCE_FOLDER=/mnt/NAS/Music/Playlists/*.jpg
for filepath in $SOURCE_FOLDER; do
       file=$(basename -- "$filepath")
       symlink_file="$DESTINATION_FOLDER_PLAYLIST_COVERS/$file"
       sudo rm "$symlink_file" 2>/dev/null
       sudo ln -s "$filepath" "$symlink_file"
done
Reply


Messages In This Thread
Shared playlist on NAS? - by ils1974 - 04-19-2025, 06:35 PM
RE: Shared playlist on NAS? - by TheOldPresbyope - 04-19-2025, 07:35 PM
RE: Shared playlist on NAS? - by Tim Curtis - 04-19-2025, 07:52 PM
RE: Shared playlist on NAS? - by ils1974 - 04-19-2025, 11:18 PM
RE: Shared playlist on NAS? - by TheOldPresbyope - 04-19-2025, 08:26 PM
RE: Shared playlist on NAS? - by Tim Curtis - 04-19-2025, 08:38 PM
RE: Shared playlist on NAS? - by ils1974 - 04-19-2025, 10:11 PM
RE: Shared playlist on NAS? - by ils1974 - 04-19-2025, 11:52 PM
RE: Shared playlist on NAS? - by ils1974 - 04-20-2025, 12:09 AM
RE: Shared playlist on NAS? - by Tim Curtis - 04-20-2025, 01:29 AM
RE: Shared playlist on NAS? - by ils1974 - 04-20-2025, 08:08 AM
RE: Shared playlist on NAS? - by TheOldPresbyope - 04-20-2025, 11:13 AM

Forum Jump: