I am attempting to unify my playlists so that I can maintain them on one system (madsonic) and have them automatically transformed and maintained on my other systems (primarily Sonos, maybe XBMC and Plex). To accomplish this I wanted to create a script that will transform my playlists and automatically save them in another folder, after I have created them in madsonic.
/mnt/music/playlists/madsonic/ <--I want to auto-export all playlists created to this folder (every 5 minutes should be fine). I have the option set in Madsonic > Settings > General under export playlists to, but the playlists don't get exported unless use Export Playlists under Settings > Playlist. Any way to schedule this to run automatically? Also the playlists are in .m3u8 format. It appears that I can simply rename them to .m3u with no problems so I was just planning to do that with the script below.
Then (using cron) run this script every 5 minutes or so. The purpose here is to change (for all .m3u8 files in /mnt/music/playlists/madsonic) the paths from /mnt to //10.0.10.91 and save the new (.m3u) file to /mnt/music2. I need some help getting this finished - the sed rename part works when I run it for one file, but I am not sure how to make it run for each .m3u* file in a given directory and save them with the same names in another directory:
Code: Select all
#!/bin/sh MADSONICPLAYLISTS=/mnt/music/playlists/madsonic/* for *.m3u8 in $MADSONICPLAYLISTS sed -n ' s| /mnt| //10.0.10.91| gpw '/mnt/music2/$MADSONICPLAYLISTS.m3u' $MADSONICPLAYLISTS.m3u done
Madsonic 5.0.3830 running on dedicated Debain 7.3 vm.
Thanks in advance for any assistance!