kuuko pushed a commit to branch master. http://git.enlightenment.org/apps/epour.git/commit/?id=c69df45075b963fd1b5043bae225b19e0d3af783
commit c69df45075b963fd1b5043bae225b19e0d3af783 Author: Kai Huuhko <kai.huu...@gmail.com> Date: Wed Apr 1 17:32:21 2015 +0300 Fix libtorrent-0.16.x compatibility for hash constructor --- epour/Epour.py | 12 ++++++------ epour/session.py | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/epour/Epour.py b/epour/Epour.py index 110bf39..c87f310 100644 --- a/epour/Epour.py +++ b/epour/Epour.py @@ -212,10 +212,10 @@ class EpourDBus(dbus.service.Object): "save_path": self.conf.get("Settings", "storage_path"), "flags": 592 } - if os.path.isfile(t): - self.session.add_torrent_from_file(add_dict, t) - elif t.startswith("magnet:"): + if t.startswith("magnet:"): self.session.add_torrent_from_magnet(add_dict, t) + elif os.path.isfile(t): + self.session.add_torrent_from_file(add_dict, t) else: self.session.add_torrent_from_hash(add_dict, t) except Exception: @@ -230,10 +230,10 @@ class EpourDBus(dbus.service.Object): "save_path": self.conf.get("Settings", "storage_path"), "flags": 592 } - if os.path.isfile(t): - self.session.add_torrent_from_file(add_dict, t) - elif t.startswith("magnet:"): + if t.startswith("magnet:"): self.session.add_torrent_from_magnet(add_dict, t) + elif os.path.isfile(t): + self.session.add_torrent_from_file(add_dict, t) else: self.session.add_torrent_from_hash(add_dict, t) except Exception: diff --git a/epour/session.py b/epour/session.py index 8dcd497..3fe99f1 100644 --- a/epour/session.py +++ b/epour/session.py @@ -382,7 +382,10 @@ class Session(lt.session): self.async_add_torrent(tmp_dict) def add_torrent_from_hash(self, add_dict, t_uri): - add_dict["info_hash"] = lt.sha1_hash(bytes(t_uri)) + if "sha1_hash" in dir(lt): + add_dict["info_hash"] = lt.sha1_hash(bytes(t_uri)) + else: + add_dict["info_hash"] = lt.big_number(bytes(t_uri)) self.log.debug("Adding %s", t_uri) self.async_add_torrent(add_dict) --