adv fix
parent
2b35dd41f4
commit
8d1472bc8e
|
@ -228,12 +228,12 @@ class BTClientPlayer(xbmc.Player):
|
|||
progressBar = xbmcgui.DialogProgress()
|
||||
progressBar.create(self.localize('Please Wait') + str(' [%s]' % str(self.lt.version)),
|
||||
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
|
||||
ready_list=[]
|
||||
status = self.c.get_normalized_status()
|
||||
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['download_rate'] * status['progress'] * 100 > status['desired_rate'])]
|
||||
for cond in conditions:
|
||||
|
@ -244,17 +244,17 @@ class BTClientPlayer(xbmc.Player):
|
|||
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,
|
||||
'[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))
|
||||
|
||||
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, ' ')
|
||||
|
||||
elif status['state'] in ['downloading', 'finished', 'seeding']:
|
||||
dialogText = self.localize('Preloaded: ') + '%s MB / %s MB' % \
|
||||
(str(status['downloaded'] / 1024 / 1024), str(status['total_size'] / 1024 / 1024))
|
||||
peersText = '[%s: %s; %s: %s]' % (self.localize('Seeds'), str(status['seeds_connected']), self.localize('Peers'),
|
||||
str(status['peers_connected']),)
|
||||
dialogText = self.localize('Preloaded: ') + '%s MB %s %s MB (%s MB)' % \
|
||||
(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] %s: %s' % (self.localize('Seeds'), str(status['seeds_connected']), self.localize('Peers'),
|
||||
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,
|
||||
)
|
||||
else:
|
||||
|
|
5
Core.py
5
Core.py
|
@ -71,10 +71,11 @@ class Core:
|
|||
|
||||
def sectionMenu(self):
|
||||
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':
|
||||
#first_run_231()
|
||||
check_network_advancedsettings()
|
||||
self.__settings__.setSetting('plugin_name',self.__plugin__)
|
||||
pass
|
||||
|
||||
ListString = 'XBMC.RunPlugin(%s)' % (sys.argv[0] + '?action=%s&action2=%s&%s=%s')
|
||||
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')
|
||||
updated=False
|
||||
#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 = {}, {}
|
||||
|
||||
|
||||
if not os.path.exists(path):
|
||||
updated=True
|
||||
file_cont='''<advancedsettings>
|
||||
|
@ -1770,7 +1771,7 @@ def check_network_advancedsettings():
|
|||
with open(path) as f:
|
||||
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):
|
||||
updated=True
|
||||
|
@ -1788,11 +1789,15 @@ def check_network_advancedsettings():
|
|||
search=re.search('<'+key+'>(.+?)</'+key+'>', file_cont, re.DOTALL)
|
||||
if not search:
|
||||
add[key]=settings[key]
|
||||
elif int(search.group(1))<int(settings[key]):
|
||||
print str(int(search.group(1)))
|
||||
update[key]=settings[key]
|
||||
print str(add)
|
||||
print str(update)
|
||||
else:
|
||||
present_value=search.group(1)
|
||||
if key == 'buffermode' and int(present_value)==3:
|
||||
update[key]=settings[key]
|
||||
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:
|
||||
updated=True
|
||||
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('Do it!'))
|
||||
if ok:
|
||||
print 'OUTPUT: '
|
||||
print str(file_cont)
|
||||
log('[check_network_advancedsettings]: new file_cont '+str(file_cont))
|
||||
|
||||
f=open(path, mode='w')
|
||||
f.write(file_cont)
|
||||
|
@ -1817,5 +1821,4 @@ def check_network_advancedsettings():
|
|||
Localization.localize('Please, restart Kodi now!'))
|
||||
print 'Restart Kodi'
|
||||
else:
|
||||
print 'UPDATE advancedsettings.xml disabled by user!'
|
||||
sys.exit(1)
|
||||
print 'UPDATE advancedsettings.xml disabled by user!'
|
Loading…
Reference in New Issue