aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2023-02-22 03:21:42 +0000
committerAnthony Wang2023-02-22 03:21:42 +0000
commit19644d41f3ce115a92142f09d7ffec5690faa44c (patch)
treec0f254427769f9ff9707a6231bbb5494a776ccdd
parent3a2c6fd388a7e04fd3cc4708efa5dfaf4c940a00 (diff)
Add 'sync.py'
-rw-r--r--sync.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/sync.py b/sync.py
new file mode 100644
index 0000000..ba9a22b
--- /dev/null
+++ b/sync.py
@@ -0,0 +1,19 @@
+import os
+import shutil
+import sys
+
+playlist = sys.argv[1]
+playlistpath = playlist[:playlist.rfind('/')]
+
+for i in open(playlist).read().split('\n'):
+ target = i[i.rfind('/') + 1:i.rfind('.')] + '.mp3'
+ if i == '' or os.path.exists(target):
+ continue
+
+ print(i)
+ if i.endswith('.mp3'):
+ print('mp3')
+ shutil.copy(i, target)
+ else:
+ print('transcoding')
+ os.system(f'ffmpeg -i "{playlistpath}/{i}" "{target}"')