adv fix
This commit is contained in:
		
							parent
							
								
									2b35dd41f4
								
							
						
					
					
						commit
						8d1472bc8e
					
				@ -228,12 +228,12 @@ class BTClientPlayer(xbmc.Player):
 | 
				
			|||||||
        progressBar = xbmcgui.DialogProgress()
 | 
					        progressBar = xbmcgui.DialogProgress()
 | 
				
			||||||
        progressBar.create(self.localize('Please Wait') + str(' [%s]' % str(self.lt.version)),
 | 
					        progressBar.create(self.localize('Please Wait') + str(' [%s]' % str(self.lt.version)),
 | 
				
			||||||
                           self.localize('Seeds searching.'))
 | 
					                           self.localize('Seeds searching.'))
 | 
				
			||||||
        while iterator < 100 or not self.c.is_file_ready:# not self.c.is_file_ready
 | 
					        while iterator < 100:# not self.c.is_file_ready
 | 
				
			||||||
            iterator = 0
 | 
					            iterator = 0
 | 
				
			||||||
            ready_list=[]
 | 
					            ready_list=[]
 | 
				
			||||||
            status = self.c.get_normalized_status()
 | 
					            status = self.c.get_normalized_status()
 | 
				
			||||||
            conditions=[status['state'] in ['downloading', 'finished', 'seeding'], status['desired_rate'] > 0 or status['progress'] > 0.02,
 | 
					            conditions=[status['state'] in ['downloading', 'finished', 'seeding'], status['desired_rate'] > 0 or status['progress'] > 0.02,
 | 
				
			||||||
                        status['progress'] > 0,
 | 
					                        status['progress'] > 0.01, self.c.is_file_ready or status['progress'] > 0.02,
 | 
				
			||||||
                        status['desired_rate'] > 0 or status['progress'] > 0.02 and (status['download_rate'] > status['desired_rate'] or
 | 
					                        status['desired_rate'] > 0 or status['progress'] > 0.02 and (status['download_rate'] > status['desired_rate'] or
 | 
				
			||||||
                        status['download_rate'] * status['progress'] * 100 > status['desired_rate'])]
 | 
					                        status['download_rate'] * status['progress'] * 100 > status['desired_rate'])]
 | 
				
			||||||
            for cond in conditions:
 | 
					            for cond in conditions:
 | 
				
			||||||
@ -244,17 +244,17 @@ class BTClientPlayer(xbmc.Player):
 | 
				
			|||||||
                    ready_list.append(False)
 | 
					                    ready_list.append(False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            speedsText = '%s: %s Mbit/s %s %s: %s Mbit/s' % (self.localize('Bitrate'), str(int(status['desired_rate'] * 8 / (1024 * 1024))) if status['desired_rate'] else 0,
 | 
					            speedsText = '%s: %s Mbit/s %s %s: %s Mbit/s' % (self.localize('Bitrate'), str(int(status['desired_rate'] * 8 / (1024 * 1024))) if status['desired_rate'] else 0,
 | 
				
			||||||
                                                   '[COLOR=green]>[/COLOR]' if ready_list[3] else '[COLOR=red]<[/COLOR]',
 | 
					                                                   '[COLOR=green]>[/COLOR]' if ready_list[4] else '[COLOR=red]<[/COLOR]',
 | 
				
			||||||
                                              self.localize('Download speed'),str(status['download_rate'] * 8 / 1000000))
 | 
					                                              self.localize('Download speed'),str(status['download_rate'] * 8 / 1000000))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if status['state'] in ['queued','checking','checking fastresume'] or (status['progress'] == 0 and status['num_pieces'] > 0):
 | 
					            if status['state'] in ['queued','checking','checking fastresume'] or (status['progress'] == 0 and status['num_pieces'] > 0):
 | 
				
			||||||
                progressBar.update(iterator, self.localize('Checking preloaded files...'), speedsText, ' ')
 | 
					                progressBar.update(iterator, self.localize('Checking preloaded files...'), speedsText, ' ')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            elif status['state'] in ['downloading', 'finished', 'seeding']:
 | 
					            elif status['state'] in ['downloading', 'finished', 'seeding']:
 | 
				
			||||||
                dialogText = self.localize('Preloaded: ') + '%s MB / %s MB' % \
 | 
					                dialogText = self.localize('Preloaded: ') + '%s MB %s %s MB (%s MB)' % \
 | 
				
			||||||
                        (str(status['downloaded'] / 1024 / 1024), str(status['total_size'] / 1024 / 1024))
 | 
					                        (str(status['downloaded'] / 1024 / 1024), '[COLOR=green]>[/COLOR]' if ready_list[3] else '[COLOR=red]<[/COLOR]', str(status['total_size'] / 1024 / 1024 /100), str(status['total_size'] / 1024 / 1024))
 | 
				
			||||||
                peersText = '[%s: %s; %s: %s]' % (self.localize('Seeds'), str(status['seeds_connected']), self.localize('Peers'),
 | 
					                peersText = '[%s: %s; %s: %s] %s: %s' % (self.localize('Seeds'), str(status['seeds_connected']), self.localize('Peers'),
 | 
				
			||||||
                    str(status['peers_connected']),)
 | 
					                    str(status['peers_connected']), self.localize('File ready: '), '[COLOR=green]YES[/COLOR]' if ready_list[2] else '[COLOR=red]NO[/COLOR]')
 | 
				
			||||||
                progressBar.update(iterator, peersText, speedsText, dialogText,
 | 
					                progressBar.update(iterator, peersText, speedsText, dialogText,
 | 
				
			||||||
                                   )
 | 
					                                   )
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								Core.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Core.py
									
									
									
									
									
								
							@ -71,10 +71,11 @@ class Core:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def sectionMenu(self):
 | 
					    def sectionMenu(self):
 | 
				
			||||||
        if self.__settings__.getSetting('plugin_name')!=self.__plugin__:
 | 
					        if self.__settings__.getSetting('plugin_name')!=self.__plugin__:
 | 
				
			||||||
 | 
					            self.__settings__.setSetting('plugin_name',self.__plugin__)
 | 
				
			||||||
 | 
					            check_network_advancedsettings()
 | 
				
			||||||
            if self.__plugin__ == 'Torrenter v.2.3.7':
 | 
					            if self.__plugin__ == 'Torrenter v.2.3.7':
 | 
				
			||||||
                #first_run_231()
 | 
					                #first_run_231()
 | 
				
			||||||
                check_network_advancedsettings()
 | 
					                pass
 | 
				
			||||||
            self.__settings__.setSetting('plugin_name',self.__plugin__)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ListString = 'XBMC.RunPlugin(%s)' % (sys.argv[0] + '?action=%s&action2=%s&%s=%s')
 | 
					        ListString = 'XBMC.RunPlugin(%s)' % (sys.argv[0] + '?action=%s&action2=%s&%s=%s')
 | 
				
			||||||
        contextMenu = [(self.localize('Search Control Window'),
 | 
					        contextMenu = [(self.localize('Search Control Window'),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										25
									
								
								functions.py
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								functions.py
									
									
									
									
									
								
							@ -1753,9 +1753,10 @@ def check_network_advancedsettings():
 | 
				
			|||||||
    path=xbmc.translatePath('special://profile/advancedsettings.xml')
 | 
					    path=xbmc.translatePath('special://profile/advancedsettings.xml')
 | 
				
			||||||
    updated=False
 | 
					    updated=False
 | 
				
			||||||
    #path='''C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\userdata\\advancedsettings.xml'''
 | 
					    #path='''C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\userdata\\advancedsettings.xml'''
 | 
				
			||||||
    settings={'buffermode':2, 'curlclienttimeout':30, 'cachemembuffersize':252420, 'readbufferfactor':5}
 | 
					    settings={'buffermode':2, 'curlclienttimeout':30, 'cachemembuffersize':252420, 'readbufferfactor':5.0}
 | 
				
			||||||
    add, update = {}, {}
 | 
					    add, update = {}, {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not os.path.exists(path):
 | 
					    if not os.path.exists(path):
 | 
				
			||||||
        updated=True
 | 
					        updated=True
 | 
				
			||||||
        file_cont='''<advancedsettings>
 | 
					        file_cont='''<advancedsettings>
 | 
				
			||||||
@ -1770,7 +1771,7 @@ def check_network_advancedsettings():
 | 
				
			|||||||
        with open(path) as f:
 | 
					        with open(path) as f:
 | 
				
			||||||
            file_cont=f.read()
 | 
					            file_cont=f.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        print str(file_cont)
 | 
					        log('[check_network_advancedsettings]: old file_cont '+str(file_cont))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not updated and not re.search('<network>.+?</network>', file_cont, re.DOTALL):
 | 
					    if not updated and not re.search('<network>.+?</network>', file_cont, re.DOTALL):
 | 
				
			||||||
        updated=True
 | 
					        updated=True
 | 
				
			||||||
@ -1788,11 +1789,15 @@ def check_network_advancedsettings():
 | 
				
			|||||||
            search=re.search('<'+key+'>(.+?)</'+key+'>', file_cont, re.DOTALL)
 | 
					            search=re.search('<'+key+'>(.+?)</'+key+'>', file_cont, re.DOTALL)
 | 
				
			||||||
            if not search:
 | 
					            if not search:
 | 
				
			||||||
                add[key]=settings[key]
 | 
					                add[key]=settings[key]
 | 
				
			||||||
            elif int(search.group(1))<int(settings[key]):
 | 
					            else:
 | 
				
			||||||
                print str(int(search.group(1)))
 | 
					                present_value=search.group(1)
 | 
				
			||||||
                update[key]=settings[key]
 | 
					                if key == 'buffermode' and int(present_value)==3:
 | 
				
			||||||
        print str(add)
 | 
					                    update[key]=settings[key]
 | 
				
			||||||
        print str(update)
 | 
					                elif key in ['curlclienttimeout', 'cachemembuffersize'] and int(present_value)<int(settings[key]):
 | 
				
			||||||
 | 
					                    update[key]=settings[key]
 | 
				
			||||||
 | 
					                elif key == 'readbufferfactor' and float(present_value)<settings[key]:
 | 
				
			||||||
 | 
					                    update[key]=settings[key]
 | 
				
			||||||
 | 
					        log('[check_network_advancedsettings]: add '+str(add)+' update '+str(update))
 | 
				
			||||||
        if len(add)>0 or len(update)>0:
 | 
					        if len(add)>0 or len(update)>0:
 | 
				
			||||||
            updated=True
 | 
					            updated=True
 | 
				
			||||||
            for key in add.keys():
 | 
					            for key in add.keys():
 | 
				
			||||||
@ -1807,8 +1812,7 @@ def check_network_advancedsettings():
 | 
				
			|||||||
                        Localization.localize('We would like to set some advanced settings for you!'),
 | 
					                        Localization.localize('We would like to set some advanced settings for you!'),
 | 
				
			||||||
                        Localization.localize('Do it!'))
 | 
					                        Localization.localize('Do it!'))
 | 
				
			||||||
        if ok:
 | 
					        if ok:
 | 
				
			||||||
            print 'OUTPUT: '
 | 
					            log('[check_network_advancedsettings]: new file_cont '+str(file_cont))
 | 
				
			||||||
            print str(file_cont)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            f=open(path, mode='w')
 | 
					            f=open(path, mode='w')
 | 
				
			||||||
            f.write(file_cont)
 | 
					            f.write(file_cont)
 | 
				
			||||||
@ -1817,5 +1821,4 @@ def check_network_advancedsettings():
 | 
				
			|||||||
                      Localization.localize('Please, restart Kodi now!'))
 | 
					                      Localization.localize('Please, restart Kodi now!'))
 | 
				
			||||||
            print 'Restart Kodi'
 | 
					            print 'Restart Kodi'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            print 'UPDATE advancedsettings.xml disabled by user!'
 | 
					            print 'UPDATE advancedsettings.xml disabled by user!'
 | 
				
			||||||
        sys.exit(1)
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user