-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload-music
executable file
·57 lines (42 loc) · 1.7 KB
/
upload-music
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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\ Library/iTunes\ Library.xml
# Location of your iTunes music media (actual music files)
# Must include final slash
music_location=~/Music/iTunes\ Media/Music/
playlists_folder="playlists"
# Folder inside the Android music folder to store music (to keep
# separate from playlists)
music_folder="music"
# Location of where to store music on your Android device
# Must include final slash
android_music_path="/data/data/com.arachnoid.sshelper/home/SDCard/Music/"
############################
echo "android-itunes-rsync, Jake Coppinger 2017"
echo "https://github.com/jakecoppinger/android-itunes-rsync"
echo ""
# Generate playlists from iTunes
echo "Generating playlists from iTunes..."
java -jar iTunesExportScala-2.2.2/Itunesexport.jar -library="$xml_location" -outputDir=playlists/
# Rename paths in M3U playlist files to be relative
echo ""
echo "Generating playlists to be relative..."
sed -i '' "s?file://$music_location?../$music_folder/?g" playlists/*.m3u
# See https://arachnoid.com/android/SSHelper/ for notes on SSHelper and
# Android rsync quirks
# Sync playlists, delete old
echo ""
echo "Syncing playlists..."
rsync -azv --no-perms --no-times --size-only playlists/ phone:$android_music_path/playlists/ --delete
# Sync music, delete old
echo ""
echo "Syncing music..."
rsync -azv --no-perms --no-times --size-only --exclude=.DS_Store --progress --stats --human-readable --delete "$music_location" phone:$android_music_path$music_folder/
# Delete exported playlists
echo ""
echo "Deleting exported playlists..."
rm -rf playlists/
echo ""
echo "Done!"