Better destination handling
Aparently transmissionrpc also doesnt like having `download_dir = None`. It should actually work now.
This commit is contained in:
parent
4c81b4faae
commit
6d46811732
1 changed files with 5 additions and 1 deletions
|
@ -176,6 +176,7 @@ def main(config_path='config.json', seen_path='seen.txt', dry_run=False, no_seen
|
|||
http_handler=config['rpc'].get('http_handler'),
|
||||
timeout=config['rpc'].get('timeout')
|
||||
)
|
||||
default_download_dir = rpc.get_session().download_dir
|
||||
# Choose the best item
|
||||
for show, torrents in filtered.items():
|
||||
item_config = show.getConfig(config)
|
||||
|
@ -195,8 +196,11 @@ def main(config_path='config.json', seen_path='seen.txt', dry_run=False, no_seen
|
|||
if rpc and not dry_run:
|
||||
destination = item_config.get('destination')
|
||||
if destination:
|
||||
if not destination.startswith('/'):
|
||||
destination = os.path.join(default_download_dir, destination)
|
||||
destination = destination.format(show=show, torrent=torrent)
|
||||
t = rpc.add_torrent(best_entry.link, download_dir=destination)
|
||||
destination = os.path.expanduser(destination)
|
||||
t = rpc.add_torrent(best_entry.link, download_dir=destination or default_download_dir)
|
||||
else:
|
||||
printe("No torrents for {show} pass quality restrictions".format(show=show.name))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue