From 19644d41f3ce115a92142f09d7ffec5690faa44c Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Wed, 22 Feb 2023 03:21:42 +0000 Subject: Add 'sync.py' --- sync.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sync.py 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}"') -- cgit v1.2.3-70-g09d2