trans fix
parent
49de8f6eb9
commit
344030d01f
14
Core.py
14
Core.py
|
@ -904,10 +904,10 @@ class Core:
|
||||||
contextMenu = [
|
contextMenu = [
|
||||||
(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('%s::%s' % (provider, info.get('link'))))),
|
sys.argv[0], 'downloadFilesList', urllib.quote_plus(link['url']))),
|
||||||
(self.localize('Download via Libtorrent'),
|
(self.localize('Download via Libtorrent'),
|
||||||
'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (
|
'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (
|
||||||
sys.argv[0], 'downloadLibtorrent', urllib.quote_plus('%s::%s' % (provider, info.get('link')))))
|
sys.argv[0], 'downloadLibtorrent', urllib.quote_plus(link['url'])))
|
||||||
]
|
]
|
||||||
|
|
||||||
if isinstance(info, dict) and info.get('infolink'):
|
if isinstance(info, dict) and info.get('infolink'):
|
||||||
|
@ -1623,11 +1623,16 @@ class Core:
|
||||||
dirname = keyboard.getText()
|
dirname = keyboard.getText()
|
||||||
if not keyboard.isConfirmed():
|
if not keyboard.isConfirmed():
|
||||||
return
|
return
|
||||||
if not dirname and len(clean)>0:
|
if dirname in ['',None,0] and len(clean)>0:
|
||||||
dirname = clean[0]
|
dirname = clean[0]
|
||||||
else:
|
else:
|
||||||
dirname = self.__settings__.getSetting("torrent_dir")
|
dirname = self.__settings__.getSetting("torrent_dir")
|
||||||
|
|
||||||
|
if dirname=='':
|
||||||
|
log('[downloadFilesList] dirname: \'\'')
|
||||||
|
else:
|
||||||
|
log('[downloadFilesList] dirname:'+str(dirname))
|
||||||
|
|
||||||
get = params.get
|
get = params.get
|
||||||
url = unquote(get("url"), self.__settings__.getSetting("lastTorrent").decode('utf-8'))
|
url = unquote(get("url"), self.__settings__.getSetting("lastTorrent").decode('utf-8'))
|
||||||
ind = get("ind")
|
ind = get("ind")
|
||||||
|
@ -1635,6 +1640,7 @@ class Core:
|
||||||
self.__settings__.setSetting("lastTorrentUrl", url)
|
self.__settings__.setSetting("lastTorrentUrl", url)
|
||||||
classMatch = re.search('(\w+)::(.+)', url)
|
classMatch = re.search('(\w+)::(.+)', url)
|
||||||
if classMatch:
|
if classMatch:
|
||||||
|
debug('[downloadFilesList] classMatch:'+str(classMatch.group(1))+' '+str(classMatch.group(2)))
|
||||||
if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
|
if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
|
||||||
url=classMatch.group(2)
|
url=classMatch.group(2)
|
||||||
else:
|
else:
|
||||||
|
@ -1645,7 +1651,7 @@ class Core:
|
||||||
torrentFilesDirectory=self.torrentFilesDirectory)
|
torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
|
|
||||||
if re.match("^magnet\:.+$", url):
|
if re.match("^magnet\:.+$", url):
|
||||||
if not dirname:
|
if dirname in [None,0]:
|
||||||
torrent.magnetToTorrent(url)
|
torrent.magnetToTorrent(url)
|
||||||
url = torrent.torrentFile
|
url = torrent.torrentFile
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -146,17 +146,19 @@ class Libtorrent:
|
||||||
'duplicate_is_error': True
|
'duplicate_is_error': True
|
||||||
}
|
}
|
||||||
progressBar = xbmcgui.DialogProgress()
|
progressBar = xbmcgui.DialogProgress()
|
||||||
progressBar.create(Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting.'))
|
progressBar.create(Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting'))
|
||||||
self.torrentHandle = self.lt.add_magnet_uri(self.session, self.magnetLink, magnetSettings)
|
self.torrentHandle = self.lt.add_magnet_uri(self.session, self.magnetLink, magnetSettings)
|
||||||
iterator = 0
|
iterator = 0
|
||||||
while not self.torrentHandle.has_metadata() and iterator != 100:
|
while iterator < 100:
|
||||||
progressBar.update(iterator)
|
xbmc.sleep(500)
|
||||||
|
progressBar.update(iterator, Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting')+'.' * (iterator % 4), ' ')
|
||||||
iterator += 1
|
iterator += 1
|
||||||
if progressBar.iscanceled():
|
if progressBar.iscanceled():
|
||||||
progressBar.update(0)
|
progressBar.update(0)
|
||||||
progressBar.close()
|
progressBar.close()
|
||||||
return
|
return
|
||||||
xbmc.sleep(500)
|
if self.torrentHandle.has_metadata():
|
||||||
|
iterator = 100
|
||||||
progressBar.update(0)
|
progressBar.update(0)
|
||||||
progressBar.close()
|
progressBar.close()
|
||||||
if self.torrentHandle.has_metadata():
|
if self.torrentHandle.has_metadata():
|
||||||
|
|
|
@ -41,7 +41,7 @@ def localize(text):
|
||||||
'Peers': 'Пиры',
|
'Peers': 'Пиры',
|
||||||
'Materials are loading now.': 'Идёт загрузка материалов.',
|
'Materials are loading now.': 'Идёт загрузка материалов.',
|
||||||
'Search Phrase': 'Фраза для поиска',
|
'Search Phrase': 'Фраза для поиска',
|
||||||
'Magnet-link is converting.': 'Идёт преобразование magnet-ссылки.',
|
'Magnet-link is converting': 'Идёт преобразование magnet-ссылки',
|
||||||
'Error': 'Ошибка',
|
'Error': 'Ошибка',
|
||||||
'Your library out of date and can\'t save magnet-links.': 'Ваша библиотека устарела и не может сохранять магнет-ссылки.',
|
'Your library out of date and can\'t save magnet-links.': 'Ваша библиотека устарела и не может сохранять магнет-ссылки.',
|
||||||
'Bookmarks': 'Закладки',
|
'Bookmarks': 'Закладки',
|
||||||
|
|
|
@ -226,3 +226,13 @@ class SearcherABC:
|
||||||
|
|
||||||
def debug(self, msg):
|
def debug(self, msg):
|
||||||
debug(msg)
|
debug(msg)
|
||||||
|
|
||||||
|
def open2(self, url=''):
|
||||||
|
import httplib
|
||||||
|
conn = httplib.HTTPConnection(self.baseurl)
|
||||||
|
conn.request("GET", str(url))
|
||||||
|
r1 = conn.getresponse()
|
||||||
|
status = str(r1.status) + " " + r1.reason
|
||||||
|
content = r1.read()
|
||||||
|
self.debug('[open2] status:'+str(status))
|
||||||
|
return content
|
|
@ -123,6 +123,7 @@ def debug(msg):
|
||||||
def showMessage(heading, message, times=10000, forced=False):
|
def showMessage(heading, message, times=10000, forced=False):
|
||||||
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % (
|
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % (
|
||||||
heading.replace('"', "'"), message.replace('"', "'"), times, icon))
|
heading.replace('"', "'"), message.replace('"', "'"), times, icon))
|
||||||
|
debug(str((heading.replace('"', "'"), message.replace('"', "'"), times, icon)))
|
||||||
|
|
||||||
|
|
||||||
def magnet_alert():
|
def magnet_alert():
|
||||||
|
|
Loading…
Reference in New Issue