Last active
August 29, 2015 14:13
-
-
Save dvl/dbd13b25971abd9930a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" Add all torrrents downloaded from what.cd in | |
origin to transmission via transmission-remote and | |
create a separated folder for each artist. """ | |
import glob | |
import os | |
import subprocess | |
import shutil | |
origin = '/home/lido/Downloads/Album' | |
destination = '/home/lido/Music/' | |
os.chdir(origin) | |
for f in glob.iglob('*.torrent'): | |
folder = os.path.join(destination, f.split('-')[0].strip()) | |
if not os.path.exists(folder): | |
os.makedirs(folder) | |
subprocess.call(['transmission-remote', '127.0.0.1:9092', | |
'--auth=transmission:transmission', '-a', f, | |
'-w', folder]) | |
shutil.rmtree(origin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment