-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncplaylists.sh
executable file
·37 lines (27 loc) · 1.06 KB
/
syncplaylists.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -e
# Location of your iTunes music library xml file.
# It shouldn't touch this, but back up just to be safe!
xml_location=~/Music/iTunes/iTunes\ Library.xml
# Location of your iTunes music media (actual music files)
# Must include final slash
music_location=~/Music/iTunes/iTunes\ Media/Music/
#location to export playlist files (m3u8)
# Must include final slash
playlists_folder=~/Music/iTunes/iTunes\ Media/Music/
############################
echo "PorcoRosso, 2017"
echo ""
echo "deleting old playlist files"
rm "$playlists_folder"*.m3u8 || echo "no playlists to delete"
# Generate playlists from iTunes
echo "Generating playlists from iTunes..."
java -jar iTunesExportScala-2.2.2/Itunesexport.jar -library="$xml_location" -outputDir="$playlists_folder" -useM3U8Ext -musicPath=""
# Rename paths in M3U playlist files to be relative
echo ""
echo "Generating playlists to be relative..."
sed -i -- 's/Music\///g' "$playlists_folder"*.m3u8
echo "Deleting temp playlist files"
rm "$playlists_folder"*.m3u8--
echo ""
echo "Done! Run again to update."