Skip to content

Commit

Permalink
No longer fails when Transmission is not open.
Browse files Browse the repository at this point in the history
  • Loading branch information
archangelic committed Sep 15, 2016
1 parent 8799147 commit 72eb85b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
31 changes: 17 additions & 14 deletions cistern/cistern.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,6 @@ def refresh_feed(feed, downloaded=False):


def cistern():
if config['require_auth']:
tremote = transmissionrpc.Client(
address=config['url'],
port=int(config['port']),
user=config['username'],
password=config['password']
)
else:
tremote = transmissionrpc.Client(
address=config['url'],
port=int(config['port'])
)
click.clear()
for feed in Feed.select().where(Feed.enabled == True):
refresh_feed(feed)
Expand All @@ -109,8 +97,23 @@ def cistern():
if feed.download_dir:
transmission_args['download_dir'] = feed.download_dir
for torrent in torrents:
tremote.add_torrent(torrent.url, **transmission_args)
torrent.set_downloaded()
try:
if config['require_auth']:
tremote = transmissionrpc.Client(
address=config['url'],
port=int(config['port']),
user=config['username'],
password=config['password']
)
else:
tremote = transmissionrpc.Client(
address=config['url'],
port=int(config['port'])
)
tremote.add_torrent(torrent.url, **transmission_args)
torrent.set_downloaded()
except transmissionrpc.error.TransmissionError:
click.echo("Saving " + torrent.name + " for later")
else:
click.echo("No torrents to download in this feed")

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

setup(
name="cistern",
version="0.1.1",
version="0.1.2",
license="MIT",
url="https://github.com/archangelic/cistern",
description="Command line tool for downloading torrents from RSS feeds.",
author="Michael Hancock",
author_email="[email protected]",
download_url=(
"https://github.com/archangelic/cistern/archive/v0.1.1.tar.gz"
"https://github.com/archangelic/cistern/archive/v0.1.2.tar.gz"
),
install_requires=[
'click',
Expand Down

0 comments on commit 72eb85b

Please sign in to comment.