Skip to content

Instantly share code, notes, and snippets.

@dvl
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvl/dbd13b25971abd9930a8 to your computer and use it in GitHub Desktop.
Save dvl/dbd13b25971abd9930a8 to your computer and use it in GitHub Desktop.
# -*- 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