I have a pretty simple script that finds songs in a plex playlist containing all my music, and creates a plex playlist from an existing m3u file:
#!/bin/bash
file=$(echo $1)
echo Doing "$file"
echo "-----"
echo "#EXTM3U" >> Plex/"$file"8
echo "#Written by WebTools for Plex" >> Plex/"$file"8
echo '#{"playlistType": "audio", "title": "Music", "leafCount": "13474", "content": null, "ServerID": "8854525f8d9eb2bac12228bb9ab2a6142eb933aa", "smart": "0"}' >> Plex/"$file"8
echo "#" >> Plex/"$file"8
echo "#" >> Plex/"$file"8
while read p ; do
if grep -q "$p" ~/Downloads/Music.m3u8; then
grep -B 2 "$p" ~/Downloads/Music.m3u8 >> Plex/"$file"8
else
echo "$p" not found.
echo "$p" >> "$file".notfound
fi
done < "$file"
echo "-----"
This has worked on ~15 playlists and ~1500 songs so far without a hitch- however I'm getting some weird output when running on this new batch.
The playlists that worked had a structure like this:
/home/shared/plex/Music/Video Game - PC/Cave Story/On To Grasstown.mp3
/home/shared/plex/Music/Video Game - PC/Cave Story/Eyes Of Flame (Boss Theme #2).mp3
/home/shared/plex/Music/Video Game - PC/Cave Story/Cave Story (Plantation Main Theme).mp3
And the new playlists that don't have the exact same structure:
/home/shared/plex/Music/Liz Callaway/Anastasia/Once Upon A December.mp3
/home/shared/plex/Music/Liz Callaway/Anastasia/Journey To The Past.mp3
/home/shared/plex/Music/Phil Collins, 'N Sync/Tarzan/Trashin' The Camp.mp3
The old playlists don't have any notfound entries, but the new one each entry is not found but it looks like this:
not found.d/plex/Music/Elton John/The Road To El Dorado/Queen Of Cities.mp3
not found.d/plex/Music/Mandy Moore & Zachary Levi/Tangled/I See The Light.mp3
not found.d/plex/Music/Randy Newman/Toy Story/You've Got A Friend In Me.mp3
I understand that it's somehow not hitting grep but the output shouldn't be putting "not found" in the middle of "shared"
I am able to successfully grep for each line in the file to ~/Downloads/Music.m3u8. Something's definitely off. Any ideas?