aboutsummaryrefslogtreecommitdiff
path: root/sync.py
blob: ba9a22bac719deb30c5526a2ecfe71562aab9483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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}"')