trans fix
This commit is contained in:
		
							parent
							
								
									49de8f6eb9
								
							
						
					
					
						commit
						344030d01f
					
				
							
								
								
									
										14
									
								
								Core.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Core.py
									
									
									
									
									
								
							@ -904,10 +904,10 @@ class Core:
 | 
			
		||||
            contextMenu = [
 | 
			
		||||
                    (self.localize('Download via T-client'),
 | 
			
		||||
                     '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'),
 | 
			
		||||
                     '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'):
 | 
			
		||||
@ -1623,11 +1623,16 @@ class Core:
 | 
			
		||||
                dirname = keyboard.getText()
 | 
			
		||||
                if not keyboard.isConfirmed():
 | 
			
		||||
                    return
 | 
			
		||||
                if not dirname and len(clean)>0:
 | 
			
		||||
                if dirname in ['',None,0] and len(clean)>0:
 | 
			
		||||
                    dirname = clean[0]
 | 
			
		||||
        else:
 | 
			
		||||
            dirname = self.__settings__.getSetting("torrent_dir")
 | 
			
		||||
 | 
			
		||||
        if dirname=='':
 | 
			
		||||
            log('[downloadFilesList] dirname: \'\'')
 | 
			
		||||
        else:
 | 
			
		||||
            log('[downloadFilesList] dirname:'+str(dirname))
 | 
			
		||||
 | 
			
		||||
        get = params.get
 | 
			
		||||
        url = unquote(get("url"), self.__settings__.getSetting("lastTorrent").decode('utf-8'))
 | 
			
		||||
        ind = get("ind")
 | 
			
		||||
@ -1635,6 +1640,7 @@ class Core:
 | 
			
		||||
            self.__settings__.setSetting("lastTorrentUrl", url)
 | 
			
		||||
            classMatch = re.search('(\w+)::(.+)', url)
 | 
			
		||||
            if classMatch:
 | 
			
		||||
                debug('[downloadFilesList] classMatch:'+str(classMatch.group(1))+' '+str(classMatch.group(2)))
 | 
			
		||||
                if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
 | 
			
		||||
                    url=classMatch.group(2)
 | 
			
		||||
                else:
 | 
			
		||||
@ -1645,7 +1651,7 @@ class Core:
 | 
			
		||||
                                     torrentFilesDirectory=self.torrentFilesDirectory)
 | 
			
		||||
 | 
			
		||||
        if re.match("^magnet\:.+$", url):
 | 
			
		||||
            if not dirname:
 | 
			
		||||
            if dirname in [None,0]:
 | 
			
		||||
                torrent.magnetToTorrent(url)
 | 
			
		||||
                url = torrent.torrentFile
 | 
			
		||||
            else:
 | 
			
		||||
 | 
			
		||||
@ -146,17 +146,19 @@ class Libtorrent:
 | 
			
		||||
            'duplicate_is_error': True
 | 
			
		||||
        }
 | 
			
		||||
        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)
 | 
			
		||||
        iterator = 0
 | 
			
		||||
        while not self.torrentHandle.has_metadata() and iterator != 100:
 | 
			
		||||
            progressBar.update(iterator)
 | 
			
		||||
        while iterator < 100:
 | 
			
		||||
            xbmc.sleep(500)
 | 
			
		||||
            progressBar.update(iterator, Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting')+'.' * (iterator % 4), ' ')
 | 
			
		||||
            iterator += 1
 | 
			
		||||
            if progressBar.iscanceled():
 | 
			
		||||
                progressBar.update(0)
 | 
			
		||||
                progressBar.close()
 | 
			
		||||
                return
 | 
			
		||||
            xbmc.sleep(500)
 | 
			
		||||
            if self.torrentHandle.has_metadata():
 | 
			
		||||
                iterator = 100
 | 
			
		||||
        progressBar.update(0)
 | 
			
		||||
        progressBar.close()
 | 
			
		||||
        if self.torrentHandle.has_metadata():
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ def localize(text):
 | 
			
		||||
            'Peers': 'Пиры',
 | 
			
		||||
            'Materials are loading now.': 'Идёт загрузка материалов.',
 | 
			
		||||
            'Search Phrase': 'Фраза для поиска',
 | 
			
		||||
            'Magnet-link is converting.': 'Идёт преобразование magnet-ссылки.',
 | 
			
		||||
            'Magnet-link is converting': 'Идёт преобразование magnet-ссылки',
 | 
			
		||||
            'Error': 'Ошибка',
 | 
			
		||||
            'Your library out of date and can\'t save magnet-links.': 'Ваша библиотека устарела и не может сохранять магнет-ссылки.',
 | 
			
		||||
            'Bookmarks': 'Закладки',
 | 
			
		||||
 | 
			
		||||
@ -226,3 +226,13 @@ class SearcherABC:
 | 
			
		||||
 | 
			
		||||
    def debug(self, 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):
 | 
			
		||||
    xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % (
 | 
			
		||||
        heading.replace('"', "'"), message.replace('"', "'"), times, icon))
 | 
			
		||||
    debug(str((heading.replace('"', "'"), message.replace('"', "'"), times, icon)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def magnet_alert():
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user