From 48e8f0723632c1511bb89ee3f32fe1a085c46c97 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Tue, 13 Jan 2015 21:19:14 +0300 Subject: [PATCH] context instead of open --- .idea/workspace.xml | 966 +++++++++++++++++-------- Core.py | 24 +- Localization.py | 1 + changelog.txt | 5 +- functions.py | 7 +- resources/language/English/strings.xml | 2 + resources/language/Russian/strings.xml | 2 + resources/settings.xml | 30 +- 8 files changed, 708 insertions(+), 329 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 75cd0f2..4f8d075 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,9 +3,12 @@ - + + + + @@ -40,48 +43,29 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -110,40 +94,29 @@ - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -152,11 +125,11 @@ - + - - + + @@ -182,11 +155,148 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -207,12 +317,8 @@ @@ -295,6 +405,50 @@ @@ -544,7 +706,7 @@ - + @@ -585,7 +747,9 @@ - @@ -593,14 +757,6 @@ - - - - - - - - @@ -651,7 +807,134 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -668,44 +951,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -755,44 +1019,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -842,44 +1087,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -913,13 +1139,6 @@ - - - - - - - @@ -927,28 +1146,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -1001,13 +1198,6 @@ - - - - - - - @@ -1037,30 +1227,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -1108,56 +1274,238 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Core.py b/Core.py index b93ed02..c1f0000 100644 --- a/Core.py +++ b/Core.py @@ -45,6 +45,7 @@ class Core: debug = __settings__.getSetting('debug') == 'true' torrent_player=__settings__.getSetting("torrent_player") history_bool = __settings__.getSetting('history') == 'true' + context_open = __settings__.getSetting('context_open') == 'true' language = {0: 'en', 1: 'ru'}.get(int(__settings__.getSetting("language"))) htmlCodes = ( ('&', '&'), @@ -374,14 +375,14 @@ class Core: if status=='pause': contextMenu=[(self.localize('Unpause'), ListString+'unpause)'), - (self.localize('Delete and Stop'), ListString+'delete)'),] + (self.localize('Delete'), ListString+'delete)'),] elif status=='stopped': contextMenu=[(self.localize('Start'), ListString+'start)'), (self.localize('Delete'), ListString+'delete)'),] else: contextMenu=[(self.localize('Pause'), ListString+'pause)'), (self.localize('Stop'), ListString+'stop)'), - (self.localize('Delete and Stop'), ListString+'delete)'),] + (self.localize('Delete'), ListString+'delete)'),] if progress==100 or progress>30 and type=='file': link={'action2':'play', 'type':type, 'path':path.encode('utf-8')} @@ -1123,6 +1124,8 @@ class Core: replaceMenu=True) view_style('uTorrentBrowser') xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) + xbmc.sleep(30000) + xbmc.executebuiltin('Container.Refresh') def clearStorage(self, params={}): clearStorage(self.userStorageDirectory) @@ -1508,7 +1511,14 @@ class Core: return else: for (order, seeds, leechers, size, title, link, image) in filesList: + link_dict = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder} + link_url='' + for key in link_dict.keys(): + link_url = '%s&%s=%s' % (link_url, key, urllib.quote_plus(link_dict.get(key))) contextMenu = [ + (self.localize('Open (no return)'), + 'XBMC.ActivateWindow(Videos,%s)' % ('%s?action=%s%s') % ( + sys.argv[0], 'openTorrent', link_url)), (self.localize('Download via T-client'), 'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % ( sys.argv[0], 'downloadFilesList', urllib.quote_plus(link))), @@ -1517,13 +1527,17 @@ class Core: sys.argv[0], 'downloadLibtorrent', urllib.quote_plus(link))) ] title = self.titleMake(seeds, leechers, size, title) - link = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder} - self.drawItem(title, 'openTorrent', link, image, contextMenu=contextMenu, replaceMenu=False) + + if self.context_open: + self.drawItem(title, 'context', link, image, contextMenu=contextMenu, replaceMenu=False) + else: + self.drawItem(title, 'openTorrent', link_dict, image, contextMenu=contextMenu, replaceMenu=False) view_style('showFilesList') xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) def context(self, params={}): xbmc.executebuiltin("Action(ContextMenu)") + sys.exit() def downloadFilesList(self, params={}): dirname = None @@ -1601,7 +1615,7 @@ class Core: get = params.get storage=get('storage') if not storage: self.userStorage(params) - else: self.userStorageDirectory=urllib.unquote_plus(storage).decode('utf-8') + else: self.userStorageDirectory=urllib.unquote_plus(storage) try: url = urllib.unquote_plus(get("url")) except: diff --git a/Localization.py b/Localization.py index 39630af..748c3fc 100644 --- a/Localization.py +++ b/Localization.py @@ -212,6 +212,7 @@ dictionary = { 'Unpause':'Возобновить', 'Pause':'Пауза', 'Delete':'Удалить', + 'Open (no return)':'Открыть (без возврата)', } } diff --git a/changelog.txt b/changelog.txt index 0cf11f6..46b3638 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ -[B]Version 2.0.9[/B] +[B]Version 2.1.0[/B] +[+] Загрузка: Добавлена возможность управлять закачками, а так же возобновлять + +[B]Version 2.0.9[/B] [+] Загрузка: Добавлена возможность загружать торренты в фоне [+] Списки Медиа: Добавлен KickAssSo diff --git a/functions.py b/functions.py index f04d0c5..17beba5 100644 --- a/functions.py +++ b/functions.py @@ -504,16 +504,17 @@ def view_style(func): styles['drawContent'] = styles['drawtrackerList'] = styles['drawcontentList'] = 'info' styles['sectionMenu'] = styles['Seasons'] = 'list' styles['uTorrentBrowser'] = styles['torrentPlayer'] = styles['openTorrent'] = 'wide' - styles['showFilesList'] = 'wide' + styles['showFilesList'] = styles['DownloadStatus'] = 'wide' elif view_style in [1, 4]: styles['searchOption'] = 'info' styles['drawContent'] = styles['torrentPlayer'] = styles['openTorrent'] = styles['drawtrackerList'] = 'info' - styles['uTorrentBrowser'] = styles['History'] = 'wide' + styles['uTorrentBrowser'] = styles['History'] = styles['DownloadStatus'] = 'wide' styles['showFilesList'] = styles['sectionMenu'] = 'wide' styles['List'] = styles['drawcontentList'] = 'info3' if view_style == 1: - styles['uTorrentBrowser'] = styles['torrentPlayer'] = styles['openTorrent'] = styles['History'] = styles['DownloadStatus'] = 'wide' + styles['uTorrentBrowser'] = styles['torrentPlayer'] = 'wide' + styles['openTorrent'] = styles['History'] = styles['DownloadStatus'] = 'wide' styles['sectionMenu'] = 'icons' if view_style in [1, 3, 4]: diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 9d25a07..83a520e 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -31,8 +31,10 @@ Ask to change storage before play Delete Russian stuff Return Russian stuff + Open context menu instead of torrent Interface P2P Network + Advanced Save path Call dialog Default diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml index 0204c2e..0acbd43 100644 --- a/resources/language/Russian/strings.xml +++ b/resources/language/Russian/strings.xml @@ -31,8 +31,10 @@ Предлагать изменить место хранения Удалить русские трекеры Вернуть русские трекеры + Открывать контекстное меню вместо торрента Интерфейс P2P Сеть + Дополнительные Директория для сохранения файлов Вызывать диалог Задать по умолчанию diff --git a/resources/settings.xml b/resources/settings.xml index cf4b6ee..bf22909 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -7,17 +7,6 @@ label="30001" default="1" /> - - + + + + +