aboutsummaryrefslogtreecommitdiff
path: root/automedia.py
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-07-09 20:46:03 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commit66b364d218062acc91260780ce28ecb03f942657 (patch)
tree5cf4495173bdf8ae658be7da1caed61ed1d702ca /automedia.py
parente429784dc2b75097a0e31e00d53e6f797f2381ed (diff)
Compare torrents by id instead of name, fixes spamming finished torrent notification
Diffstat (limited to 'automedia.py')
-rwxr-xr-xautomedia.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/automedia.py b/automedia.py
index 5345129..a8bbac0 100755
--- a/automedia.py
+++ b/automedia.py
@@ -43,10 +43,12 @@ class TrackedHtml:
self.plugin = plugin
class TorrentProgress:
+ id = None
name = None
progress = None
- def __init__(self, name, progress):
+ def __init__(self, id, name, progress):
+ self.id = id
self.name = name
self.progress = progress
@@ -150,7 +152,7 @@ def add_torrent(torrent_link):
def get_torrent_progress(tc):
torrent_progress = []
for torrent in tc.get_torrents():
- torrent_progress.append(TorrentProgress(torrent.name, torrent.progress))
+ torrent_progress.append(TorrentProgress(torrent.id, torrent.name, torrent.progress))
return torrent_progress
def get_finished_torrents(torrents):
@@ -171,7 +173,7 @@ def get_matching_torrents_by_name(torrents1, torrents2):
matching_torrents = []
for torrent1 in torrents1:
for torrent2 in torrents2:
- if torrent1.name == torrent2.name:
+ if torrent1.id == torrent2.id:
matching_torrents.append(torrent1.name)
return matching_torrents