window dl status
This commit is contained in:
		
							parent
							
								
									7e98f5a8d0
								
							
						
					
					
						commit
						792823b25b
					
				
							
								
								
									
										7
									
								
								Core.py
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Core.py
									
									
									
									
									
								
							@ -1235,7 +1235,7 @@ class Core:
 | 
				
			|||||||
                    filename = os.path.join(folder, filename)
 | 
					                    filename = os.path.join(folder, filename)
 | 
				
			||||||
                    xbmc.executebuiltin('xbmc.PlayMedia("' + filename.encode('utf-8') + '")')
 | 
					                    xbmc.executebuiltin('xbmc.PlayMedia("' + filename.encode('utf-8') + '")')
 | 
				
			||||||
                elif tdir and action == 'copy':
 | 
					                elif tdir and action == 'copy':
 | 
				
			||||||
                    path=os.path.join(folder, tdir)
 | 
					                    path=os.path.join(localize_path(folder), localize_path(tdir))
 | 
				
			||||||
                    dirs, files=xbmcvfs.listdir(path)
 | 
					                    dirs, files=xbmcvfs.listdir(path)
 | 
				
			||||||
                    if len(dirs) > 0:
 | 
					                    if len(dirs) > 0:
 | 
				
			||||||
                        dirs.insert(0, self.localize('./ (Root folder)'))
 | 
					                        dirs.insert(0, self.localize('./ (Root folder)'))
 | 
				
			||||||
@ -1250,9 +1250,10 @@ class Core:
 | 
				
			|||||||
                            path=os.path.join(path, dirs[ret])
 | 
					                            path=os.path.join(path, dirs[ret])
 | 
				
			||||||
                            dirs, files=xbmcvfs.listdir(path)
 | 
					                            dirs, files=xbmcvfs.listdir(path)
 | 
				
			||||||
                    for file in files:
 | 
					                    for file in files:
 | 
				
			||||||
                        if not xbmcvfs.exists(os.path.join(path,file)):
 | 
					                        file = localize_path(file)
 | 
				
			||||||
 | 
					                        if not xbmcvfs.exists(os.path.join(path, file)):
 | 
				
			||||||
                            xbmcvfs.delete(os.path.join(path,file))
 | 
					                            xbmcvfs.delete(os.path.join(path,file))
 | 
				
			||||||
                        xbmcvfs.copy(os.path.join(path,file),os.path.join(folder,file))
 | 
					                        xbmcvfs.copy(os.path.join(path, file),os.path.join(folder,file))
 | 
				
			||||||
                        i=i+1
 | 
					                        i=i+1
 | 
				
			||||||
                    showMessage(self.localize('Torrent-client Browser'), self.localize('Copied %d files!') % i, forced=True)
 | 
					                    showMessage(self.localize('Torrent-client Browser'), self.localize('Copied %d files!') % i, forced=True)
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
 | 
				
			|||||||
@ -809,6 +809,7 @@ def localize(text):
 | 
				
			|||||||
            'Play (from start)':'Lejátszás (az elejétől)',
 | 
					            'Play (from start)':'Lejátszás (az elejétől)',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        'ru': {
 | 
					        'ru': {
 | 
				
			||||||
 | 
					            'Cancel': 'Отмена',
 | 
				
			||||||
            'Clear History': 'Очистить Историю',
 | 
					            'Clear History': 'Очистить Историю',
 | 
				
			||||||
            'Play (with seek)': 'Играть (перемотка)',
 | 
					            'Play (with seek)': 'Играть (перемотка)',
 | 
				
			||||||
            'Mass Control':'Массовое Управление',
 | 
					            'Mass Control':'Массовое Управление',
 | 
				
			||||||
 | 
				
			|||||||
@ -285,12 +285,12 @@ class SkorbaLoader:
 | 
				
			|||||||
        if len(ContentList) == 1 or contentId not in [None, -1]:
 | 
					        if len(ContentList) == 1 or contentId not in [None, -1]:
 | 
				
			||||||
            if not contentId: contentId = 0
 | 
					            if not contentId: contentId = 0
 | 
				
			||||||
            title = os.path.basename(ContentList[contentId]['title'])
 | 
					            title = os.path.basename(ContentList[contentId]['title'])
 | 
				
			||||||
            path = localize_path(os.path.join(self.storageDirectory, ContentList[contentId]['title']))
 | 
					            path = os.path.join(self.storageDirectory, ContentList[contentId]['title'])
 | 
				
			||||||
            type = 'file'
 | 
					            type = 'file'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            contentId = -1
 | 
					            contentId = -1
 | 
				
			||||||
            title = ContentList[0]['title'].split('\\')[0]
 | 
					            title = ContentList[0]['title'].split('\\')[0]
 | 
				
			||||||
            path = localize_path(os.path.join(self.storageDirectory, title))
 | 
					            path = os.path.join(self.storageDirectory, title)
 | 
				
			||||||
            type = 'folder'
 | 
					            type = 'folder'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        add = db.add(title, path, type, {'progress': 0}, 'downloading', self.torrentFile, contentId,
 | 
					        add = db.add(title, path, type, {'progress': 0}, 'downloading', self.torrentFile, contentId,
 | 
				
			||||||
@ -304,21 +304,14 @@ class SkorbaLoader:
 | 
				
			|||||||
            else:
 | 
					            else:
 | 
				
			||||||
                for i in range(self.torrentFileInfo.num_pieces()):
 | 
					                for i in range(self.torrentFileInfo.num_pieces()):
 | 
				
			||||||
                    self.torrentHandle.piece_priority(i, 6)
 | 
					                    self.torrentHandle.piece_priority(i, 6)
 | 
				
			||||||
 | 
					            del db
 | 
				
			||||||
            thread.start_new_thread(self.downloadLoop, (title,))
 | 
					            thread.start_new_thread(self.downloadLoop, (title,))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def downloadLoop(self, title):
 | 
					    def downloadLoop(self, title):
 | 
				
			||||||
        log(title)
 | 
					 | 
				
			||||||
        db = DownloadDB()
 | 
					        db = DownloadDB()
 | 
				
			||||||
        status = 'downloading'
 | 
					        status = 'downloading'
 | 
				
			||||||
        while db.get(title) and status != 'stopped':
 | 
					        while db.get(title) and status != 'stopped':
 | 
				
			||||||
            xbmc.sleep(3000)
 | 
					 | 
				
			||||||
            log('status 1 '+status)
 | 
					 | 
				
			||||||
            status = db.get_status(title)
 | 
					            status = db.get_status(title)
 | 
				
			||||||
            log('status 2 ' + status)
 | 
					 | 
				
			||||||
            if status == 'stopped':
 | 
					 | 
				
			||||||
                xbmc.sleep(10000)
 | 
					 | 
				
			||||||
                status = db.get_status(title)
 | 
					 | 
				
			||||||
            log('status 3 ' + status)
 | 
					 | 
				
			||||||
            if not self.paused:
 | 
					            if not self.paused:
 | 
				
			||||||
                if status == 'pause':
 | 
					                if status == 'pause':
 | 
				
			||||||
                    self.paused = True
 | 
					                    self.paused = True
 | 
				
			||||||
@ -336,8 +329,8 @@ class SkorbaLoader:
 | 
				
			|||||||
            iterator = int(s.progress * 100)
 | 
					            iterator = int(s.progress * 100)
 | 
				
			||||||
            info['progress'] = iterator
 | 
					            info['progress'] = iterator
 | 
				
			||||||
            db.update(title, info)
 | 
					            db.update(title, info)
 | 
				
			||||||
            log(title+str(info))
 | 
					            #self.debug()
 | 
				
			||||||
            self.debug()
 | 
					            xbmc.sleep(3000)
 | 
				
			||||||
        log('out of downloadLoop')
 | 
					        log('out of downloadLoop')
 | 
				
			||||||
        self.session.remove_torrent(self.torrentHandle)
 | 
					        self.session.remove_torrent(self.torrentHandle)
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
 | 
				
			|||||||
@ -80,7 +80,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
 | 
				
			|||||||
        #self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
 | 
					        #self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Top menu
 | 
					        # Top menu
 | 
				
			||||||
        self.button_downloadstatus = pyxbmct.Button("OFF", textColor='0xFF0000FF',
 | 
					        self.button_downloadstatus = pyxbmct.Button("",
 | 
				
			||||||
                                                    focusTexture=self.icon % 'fdownloadstatus',
 | 
					                                                    focusTexture=self.icon % 'fdownloadstatus',
 | 
				
			||||||
                                                    noFocusTexture=self.icon % 'nfdownloadstatus')
 | 
					                                                    noFocusTexture=self.icon % 'nfdownloadstatus')
 | 
				
			||||||
        self.placeControl(self.button_downloadstatus, 0, 1, 1, 1)
 | 
					        self.placeControl(self.button_downloadstatus, 0, 1, 1, 1)
 | 
				
			||||||
@ -560,23 +560,15 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
 | 
				
			|||||||
            else:
 | 
					            else:
 | 
				
			||||||
                torrent, ind = start[6], start[7]
 | 
					                torrent, ind = start[6], start[7]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                from Core import Core
 | 
					 | 
				
			||||||
                params = {'url': torrent.encode('utf-8'),
 | 
					 | 
				
			||||||
                                             'ind': str(ind), 'storage': storage.encode('utf-8')}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                del db
 | 
					                del db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                import SkorbaLoader
 | 
					                import SkorbaLoader
 | 
				
			||||||
                __settings__.setSetting("lastTorrent", torrent.encode('utf-8'))
 | 
					                __settings__.setSetting("lastTorrent", torrent.encode('utf-8'))
 | 
				
			||||||
                torrent = SkorbaLoader.SkorbaLoader(storage.encode('utf-8'), torrent.encode('utf-8'))
 | 
					                torrent = SkorbaLoader.SkorbaLoader(storage.encode('utf-8'), torrent)
 | 
				
			||||||
                encryption = __settings__.getSetting('encryption') == 'true'
 | 
					                encryption = __settings__.getSetting('encryption') == 'true'
 | 
				
			||||||
                torrent.downloadProcess(str(ind), encryption)
 | 
					                torrent.downloadProcess(ind, encryption)
 | 
				
			||||||
                #start_exec = self.form_link('downloadLibtorrent',
 | 
					 | 
				
			||||||
                #                            {'url': torrent.encode('utf-8'),
 | 
					 | 
				
			||||||
                #                             'ind': str(ind), 'storage': storage.encode('utf-8')})
 | 
					 | 
				
			||||||
                #log(start_exec)
 | 
					 | 
				
			||||||
                #xbmc.executebuiltin('XBMC.RunPlugin(%s)' % start_exec)
 | 
					 | 
				
			||||||
                showMessage(self.localize('Download Status'), self.localize('Started!'))
 | 
					                showMessage(self.localize('Download Status'), self.localize('Started!'))
 | 
				
			||||||
 | 
					                xbmc.sleep(1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        elif action == 'masscontrol':
 | 
					        elif action == 'masscontrol':
 | 
				
			||||||
            dialog_items = [self.localize('Start All'), self.localize('Stop All'),
 | 
					            dialog_items = [self.localize('Start All'), self.localize('Stop All'),
 | 
				
			||||||
@ -584,14 +576,17 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
 | 
				
			|||||||
            ret = xbmcgui.Dialog().select(self.localize('Mass Control'), dialog_items)
 | 
					            ret = xbmcgui.Dialog().select(self.localize('Mass Control'), dialog_items)
 | 
				
			||||||
            if ret == 0:
 | 
					            if ret == 0:
 | 
				
			||||||
                items = db.get_all()
 | 
					                items = db.get_all()
 | 
				
			||||||
 | 
					                del db
 | 
				
			||||||
                if items:
 | 
					                if items:
 | 
				
			||||||
 | 
					                    import SkorbaLoader
 | 
				
			||||||
                    for addtime, title, path, type, info, status, torrent, ind, lastupdate, storage in items:
 | 
					                    for addtime, title, path, type, info, status, torrent, ind, lastupdate, storage in items:
 | 
				
			||||||
                        start_exec = self.form_link('downloadLibtorrent',
 | 
					                        __settings__.setSetting("lastTorrent", torrent.encode('utf-8'))
 | 
				
			||||||
                                                    {'url':torrent.encode('utf-8'),
 | 
					                        torrent = SkorbaLoader.SkorbaLoader(storage.encode('utf-8'), torrent)
 | 
				
			||||||
                                                    'ind':str(ind), 'storage':storage.encode('utf-8')})
 | 
					                        encryption = __settings__.getSetting('encryption') == 'true'
 | 
				
			||||||
                        log(start_exec)
 | 
					                        torrent.downloadProcess(ind, encryption)
 | 
				
			||||||
                        xbmc.executebuiltin('XBMC.RunScript(%s)' % start_exec)
 | 
					 | 
				
			||||||
                        xbmc.sleep(1000)
 | 
					                        xbmc.sleep(1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    xbmc.sleep(2000)
 | 
				
			||||||
                    showMessage(self.localize('Download Status'), self.localize('Started All!'))
 | 
					                    showMessage(self.localize('Download Status'), self.localize('Started All!'))
 | 
				
			||||||
            elif ret == 1:
 | 
					            elif ret == 1:
 | 
				
			||||||
                items = db.get_all()
 | 
					                items = db.get_all()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user