diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e65d9ba..86fe8c7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,11 @@ - + - - + + + @@ -37,7 +38,7 @@ - + @@ -172,7 +173,7 @@ - + @@ -190,10 +191,10 @@ - + - + @@ -235,18 +236,18 @@ - - + + - + - - + + @@ -268,11 +269,11 @@ - + - - + + @@ -333,46 +334,41 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -475,12 +471,12 @@ @@ -515,6 +511,7 @@ + @@ -612,7 +609,6 @@ - @@ -794,12 +790,6 @@ - + - + - + @@ -1129,7 +1125,6 @@ - @@ -1154,7 +1149,8 @@ - @@ -1489,14 +1485,6 @@ - - - - - - - - @@ -1505,76 +1493,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1704,9 +1625,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -1744,33 +1757,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/Core.py b/Core.py index 67fc592..1383dfc 100644 --- a/Core.py +++ b/Core.py @@ -478,11 +478,26 @@ class Core: xbmc.executebuiltin('Container.Refresh') showMessage(self.localize('Watched History'), self.localize('Deleted!')) - if action2 == 'play': + if action2 == 'open': filename, path, url, seek, length, ind = db.get('filename, path, url, seek, length, ind', 'addtime', str(addtime)) - seek = int(seek) if int(seek) > 3*60 else 0 - if seek > 0: - seek = seeking_warning(seek) + if os.path.exists(path): + self.__settings__.setSetting("lastTorrent", path) + else: + torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) + path = torrent.saveTorrent(url) + self.__settings__.setSetting("lastTorrent", path) + xbmc.executebuiltin( + 'XBMC.ActivateWindow(%s)' % 'Videos,plugin://plugin.video.torrenter/?action=%s&url=%s' + % ('torrentPlayer', path)) + + if action2 == 'playnoseek' or action2 == 'playwithseek': + filename, path, url, seek, length, ind = db.get('filename, path, url, seek, length, ind', 'addtime', str(addtime)) + + if action2 == 'playwithseek': + #seek = seeking_warning(seek) + seek = int(seek) + else: + seek = 0 if os.path.exists(path): self.__settings__.setSetting("lastTorrent", path) else: @@ -502,12 +517,17 @@ class Core: ListString = 'XBMC.RunPlugin(%s)' % (sys.argv[0] + '?action=%s&action2=%s&%s=%s') #for favbool, bbstring in favlist: for addtime, filename, path, url, seek, length, ind, size in items: + seek = int(seek) if int(seek) > 3*60 else 0 watchedPercent = int((float(seek) / float(length)) * 100) duration = '%02d:%02d:%02d' % ((length / (60*60)), (length / 60) % 60, length % 60) title = '[%d%%][%s] %s [%d MB]' % (watchedPercent, duration, filename.encode('utf-8'), int(size)) - contextMenu = [(self.localize('Play'), ListString % ('WatchedHistory', 'play', 'addtime', str(addtime))), - (self.localize('Search Control Window'), - 'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'controlcenter.py'))] + if self.torrent_player == '2' and seek > 0: + seek_text = '%02d:%02d:%02d' % ((seek / (60*60)), (seek / 60) % 60, seek % 60) + contextMenu = [(self.localize('Play (from %s)') % seek_text, ListString % ('WatchedHistory', 'playwithseek', 'addtime', str(addtime))), + (self.localize('Play (from start)'), ListString % ('WatchedHistory', 'playnoseek', 'addtime', str(addtime))),] + else: + contextMenu = [(self.localize('Play'), ListString % ('WatchedHistory', 'playnoseek', 'addtime', str(addtime))),] + contextMenu.append((self.localize('Open Torrent'), ListString % ('WatchedHistory', 'open', 'addtime', str(addtime))),) if watchedPercent >= 85: img = self.ROOT + '/icons/stop-icon.png' else: @@ -517,7 +537,7 @@ class Core: ListString % ('WatchedHistory', 'delete', 'addtime', str(addtime)))) link = {'url': str(ind), 'action2': 'play', 'addtime': str(addtime)} - self.drawItem(title, 'WatchedHistory', link, image=img, contextMenu=contextMenu, replaceMenu=False) + self.drawItem(title, 'context', link, image=img, contextMenu=contextMenu, replaceMenu=False) view_style('History') xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) diff --git a/Localization.py b/Localization.py index 3c88151..2e33faa 100644 --- a/Localization.py +++ b/Localization.py @@ -281,7 +281,9 @@ def localize(text): 'Torrent2HTTP enabled! Can be changed in Settings.':'Torrent2HTTP включен! Можно изменить в Настройках.', 'Seeking':'Перемотка', 'Would you like to resume from %s?':'Хотите начать проигрывать с %s?', - 'Seeking is working only with player Torrent2HTTP.':'Перемотка работает только с плеером Torrent2HTTP.', + 'Seeking is working only with player Torrent2HTTP.':'Перемотка работает только с плеером Torrent2HTTP.',\ + 'Play (from %s)':'Играть (c %s)', + 'Play (from start)':'Играть (с начала)', }, 'uk': { diff --git a/addon.xml b/addon.xml index 67f2519..19c683e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - +