Add 'sync.py'
This commit is contained in:
parent
3a2c6fd388
commit
19644d41f3
19
sync.py
Normal file
19
sync.py
Normal file
|
@ -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}"')
|
Loading…
Reference in a new issue