Skip to content

Commit

Permalink
Fix python 3 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudd-O committed Jul 21, 2019
1 parent 2b5bb75 commit 83c4287
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/seedboxtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

__version__ = '1.4.5'
__version__ = '1.4.6'
8 changes: 4 additions & 4 deletions src/seedboxtools/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,22 +349,22 @@ def _upload(self, **params):
if r.status_code == 500:
raise TemporaryMalfunction(
"Server is experiencing a temporary 500 status code: %s"%\
r.content
r.text
)
if r.status_code == 404:
raise Misconfiguration(
"Server address (%s) is likely misconfigured: %s"%\
self.hostname
)
if 'addTorrentSuccess' in r.content:
if 'addTorrentSuccess' in r.text:
return
elif 'addTorrentFailed' in r.content:
elif 'addTorrentFailed' in r.text:
if "data" in params:
raise InvalidTorrent(params['data']['url'])
else:
raise InvalidTorrent(params['files']['torrent_file'][0])
else:
assert 0, (r.status_code, r.content)
assert 0, (r.status_code, r.text)

def remove_remote_download(self, filename):
# in this implementation, get_finished_torrents MUST BE called first
Expand Down
6 changes: 4 additions & 2 deletions src/seedboxtools/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def main():
util.report_error("Cannot load configuration (%s) -- run configleecher first" % (e))
sys.exit(7)
cfg = config.load_config(config_fobject)
local_download_dir = cfg.general.local_download_dir
client = config.get_client(cfg)

# separate the wheat from the chaff
Expand All @@ -27,7 +26,10 @@ def main():
for uploadable in args.torrents:
try:
if type(uploadable) is str:
uploadable = uploadable.decode(sys.getfilesystemencoding())
try:
uploadable = uploadable.decode(sys.getfilesystemencoding())
except AttributeError:
pass
if is_magnet(uploadable):
client.upload_magnet_link(uploadable)
util.report_message("%s submitted to seedbox" % uploadable)
Expand Down

0 comments on commit 83c4287

Please sign in to comment.