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