context instead of open

pull/1/head
DiMartinoXBMC 2015-01-13 21:19:14 +03:00
parent f07f5e33a5
commit 48e8f07236
8 changed files with 708 additions and 329 deletions

File diff suppressed because it is too large Load Diff

24
Core.py
View File

@ -45,6 +45,7 @@ class Core:
debug = __settings__.getSetting('debug') == 'true' debug = __settings__.getSetting('debug') == 'true'
torrent_player=__settings__.getSetting("torrent_player") torrent_player=__settings__.getSetting("torrent_player")
history_bool = __settings__.getSetting('history') == 'true' history_bool = __settings__.getSetting('history') == 'true'
context_open = __settings__.getSetting('context_open') == 'true'
language = {0: 'en', 1: 'ru'}.get(int(__settings__.getSetting("language"))) language = {0: 'en', 1: 'ru'}.get(int(__settings__.getSetting("language")))
htmlCodes = ( htmlCodes = (
('&', '&'), ('&', '&'),
@ -374,14 +375,14 @@ class Core:
if status=='pause': if status=='pause':
contextMenu=[(self.localize('Unpause'), ListString+'unpause)'), contextMenu=[(self.localize('Unpause'), ListString+'unpause)'),
(self.localize('Delete and Stop'), ListString+'delete)'),] (self.localize('Delete'), ListString+'delete)'),]
elif status=='stopped': elif status=='stopped':
contextMenu=[(self.localize('Start'), ListString+'start)'), contextMenu=[(self.localize('Start'), ListString+'start)'),
(self.localize('Delete'), ListString+'delete)'),] (self.localize('Delete'), ListString+'delete)'),]
else: else:
contextMenu=[(self.localize('Pause'), ListString+'pause)'), contextMenu=[(self.localize('Pause'), ListString+'pause)'),
(self.localize('Stop'), ListString+'stop)'), (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': if progress==100 or progress>30 and type=='file':
link={'action2':'play', 'type':type, 'path':path.encode('utf-8')} link={'action2':'play', 'type':type, 'path':path.encode('utf-8')}
@ -1123,6 +1124,8 @@ class Core:
replaceMenu=True) replaceMenu=True)
view_style('uTorrentBrowser') view_style('uTorrentBrowser')
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
xbmc.sleep(30000)
xbmc.executebuiltin('Container.Refresh')
def clearStorage(self, params={}): def clearStorage(self, params={}):
clearStorage(self.userStorageDirectory) clearStorage(self.userStorageDirectory)
@ -1508,7 +1511,14 @@ class Core:
return return
else: else:
for (order, seeds, leechers, size, title, link, image) in filesList: 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 = [ 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'), (self.localize('Download via T-client'),
'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % ( 'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (
sys.argv[0], 'downloadFilesList', urllib.quote_plus(link))), sys.argv[0], 'downloadFilesList', urllib.quote_plus(link))),
@ -1517,13 +1527,17 @@ class Core:
sys.argv[0], 'downloadLibtorrent', urllib.quote_plus(link))) sys.argv[0], 'downloadLibtorrent', urllib.quote_plus(link)))
] ]
title = self.titleMake(seeds, leechers, size, title) 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') view_style('showFilesList')
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def context(self, params={}): def context(self, params={}):
xbmc.executebuiltin("Action(ContextMenu)") xbmc.executebuiltin("Action(ContextMenu)")
sys.exit()
def downloadFilesList(self, params={}): def downloadFilesList(self, params={}):
dirname = None dirname = None
@ -1601,7 +1615,7 @@ class Core:
get = params.get get = params.get
storage=get('storage') storage=get('storage')
if not storage: self.userStorage(params) if not storage: self.userStorage(params)
else: self.userStorageDirectory=urllib.unquote_plus(storage).decode('utf-8') else: self.userStorageDirectory=urllib.unquote_plus(storage)
try: try:
url = urllib.unquote_plus(get("url")) url = urllib.unquote_plus(get("url"))
except: except:

View File

@ -212,6 +212,7 @@ dictionary = {
'Unpause':'Возобновить', 'Unpause':'Возобновить',
'Pause':'Пауза', 'Pause':'Пауза',
'Delete':'Удалить', 'Delete':'Удалить',
'Open (no return)':'Открыть (без возврата)',
} }
} }

View File

@ -1,4 +1,7 @@
[B]Version 2.0.9[/B] [B]Version 2.1.0[/B]
[+] Загрузка: Добавлена возможность управлять закачками, а так же возобновлять
[B]Version 2.0.9[/B]
[+] Загрузка: Добавлена возможность загружать торренты в фоне [+] Загрузка: Добавлена возможность загружать торренты в фоне
[+] Списки Медиа: Добавлен KickAssSo [+] Списки Медиа: Добавлен KickAssSo

View File

@ -504,16 +504,17 @@ def view_style(func):
styles['drawContent'] = styles['drawtrackerList'] = styles['drawcontentList'] = 'info' styles['drawContent'] = styles['drawtrackerList'] = styles['drawcontentList'] = 'info'
styles['sectionMenu'] = styles['Seasons'] = 'list' styles['sectionMenu'] = styles['Seasons'] = 'list'
styles['uTorrentBrowser'] = styles['torrentPlayer'] = styles['openTorrent'] = 'wide' styles['uTorrentBrowser'] = styles['torrentPlayer'] = styles['openTorrent'] = 'wide'
styles['showFilesList'] = 'wide' styles['showFilesList'] = styles['DownloadStatus'] = 'wide'
elif view_style in [1, 4]: elif view_style in [1, 4]:
styles['searchOption'] = 'info' styles['searchOption'] = 'info'
styles['drawContent'] = styles['torrentPlayer'] = styles['openTorrent'] = styles['drawtrackerList'] = '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['showFilesList'] = styles['sectionMenu'] = 'wide'
styles['List'] = styles['drawcontentList'] = 'info3' styles['List'] = styles['drawcontentList'] = 'info3'
if view_style == 1: 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' styles['sectionMenu'] = 'icons'
if view_style in [1, 3, 4]: if view_style in [1, 3, 4]:

View File

@ -31,8 +31,10 @@
<string id="30031">Ask to change storage before play</string> <string id="30031">Ask to change storage before play</string>
<string id="30032">Delete Russian stuff</string> <string id="30032">Delete Russian stuff</string>
<string id="30033">Return Russian stuff</string> <string id="30033">Return Russian stuff</string>
<string id="30034">Open context menu instead of torrent</string>
<string id="30101">Interface</string> <string id="30101">Interface</string>
<string id="30102">P2P Network</string> <string id="30102">P2P Network</string>
<string id="30103">Advanced</string>
<string id="50301">Save path</string> <string id="50301">Save path</string>
<string id="50302">Call dialog</string> <string id="50302">Call dialog</string>
<string id="50303">Default</string> <string id="50303">Default</string>

View File

@ -31,8 +31,10 @@
<string id="30031">Предлагать изменить место хранения</string> <string id="30031">Предлагать изменить место хранения</string>
<string id="30032">Удалить русские трекеры</string> <string id="30032">Удалить русские трекеры</string>
<string id="30033">Вернуть русские трекеры</string> <string id="30033">Вернуть русские трекеры</string>
<string id="30034">Открывать контекстное меню вместо торрента</string>
<string id="30101">Интерфейс</string> <string id="30101">Интерфейс</string>
<string id="30102">P2P Сеть</string> <string id="30102">P2P Сеть</string>
<string id="30103">Дополнительные</string>
<string id="50301">Директория для сохранения файлов</string> <string id="50301">Директория для сохранения файлов</string>
<string id="50302">Вызывать диалог</string> <string id="50302">Вызывать диалог</string>
<string id="50303">Задать по умолчанию</string> <string id="50303">Задать по умолчанию</string>

View File

@ -7,17 +7,6 @@
label="30001" label="30001"
default="1" default="1"
/> />
<setting
id="delete_russian"
type="bool"
label="30032"
default=""
/>
<setting
type="action"
label="30033"
action="RunPlugin(plugin://plugin.video.torrenter/?action=returnRussian)"
visible="eq(-1,false)"/>
<setting <setting
id="metadata" id="metadata"
type="bool" type="bool"
@ -37,6 +26,25 @@
label="30002" label="30002"
default="1" default="1"
/> />
<setting
id="context_open"
type="bool"
label="30034"
default="false"
/>
</category>
<category label="30103">
<setting
id="delete_russian"
type="bool"
label="30032"
default=""
/>
<setting
type="action"
label="30033"
action="RunPlugin(plugin://plugin.video.torrenter/?action=returnRussian)"
visible="eq(-1,false)"/>
<setting <setting
id="timeout" id="timeout"
type="enum" type="enum"