diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po
index cc6de32..9ad3e32 100644
--- a/resources/language/English/strings.po
+++ b/resources/language/English/strings.po
@@ -172,8 +172,12 @@ msgctxt "#32805"
msgid "Stop all torrents on video playback"
msgstr ""
+msgctxt "#32806"
+msgid "When finished, also restart torrents that were previously seeding"
+msgstr ""
+
#Errors
-#empty strings from id 32806 to 32899
+#empty strings from id 32807 to 32899
msgctxt "#32900"
msgid "An unexpected error occurred"
diff --git a/resources/lib/common.py b/resources/lib/common.py
index f73b51d..1e1106f 100644
--- a/resources/lib/common.py
+++ b/resources/lib/common.py
@@ -12,7 +12,8 @@ def get_settings():
'port': __settings__.getSetting('rpc_port'),
'user': __settings__.getSetting('rpc_user'),
'password': __settings__.getSetting('rpc_password'),
- 'stop_all_on_playback': __settings__.getSetting('stop_all_on_playback')
+ 'stop_all_on_playback': __settings__.getSetting('stop_all_on_playback'),
+ 'restart_if_was_seeding': __settings__.getSetting('restart_if_was_seeding')
}
return params
diff --git a/resources/lib/player.py b/resources/lib/player.py
index c53b102..17f79f1 100644
--- a/resources/lib/player.py
+++ b/resources/lib/player.py
@@ -17,6 +17,7 @@ class SubstitutePlayer(xbmc.Player):
def __init__(self):
xbmc.Player.__init__(self)
self.prev_settings = {}
+ self.wasSeeding = []
self.refreshSettings()
def onPlayBackStarted(self):
@@ -30,15 +31,23 @@ class SubstitutePlayer(xbmc.Player):
self.startAllTorrents()
def startAllTorrents(self):
+ settings = common.get_settings()
if self.transmission:
torrents = self.transmission.list()
for tid, torrent in torrents.iteritems():
- self.transmission.start(tid)
+ if settings['restart_if_was_seeding'] == 'true':
+ self.transmission.start(tid)
+ else :
+ if tid not in self.wasSeeding:
+ self.transmission.start(tid)
def stopAllTorrents(self):
+ settings = common.get_settings()
if self.transmission:
torrents = self.transmission.list()
for tid, torrent in torrents.iteritems():
+ if settings['restart_if_was_seeding'] == 'true' and torrent.status == "seeding":
+ self.wasSeeding.append(tid)
self.transmission.stop(tid)
def refreshSettings(self):
diff --git a/resources/settings.xml b/resources/settings.xml
index f2f4243..5617394 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -6,4 +6,5 @@
+