fixes
parent
3de1a28a97
commit
90ea77513c
1012
.idea/workspace.xml
1012
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
|
@ -39,8 +39,12 @@ from contextlib import contextmanager, closing, nested
|
|||
|
||||
from functions import foldername, showMessage, clearStorage, WatchedHistoryDB, get_ids_video, log, debug, ensure_str
|
||||
|
||||
from torrent2http import State, Engine, MediaType
|
||||
#from pyrrent2http import State, Engine, MediaType
|
||||
if sys.modules["__main__"].__settings__.getSetting("torrent_player") == '2':
|
||||
from torrent2http import State, Engine, MediaType
|
||||
author = 'Anteo'
|
||||
elif sys.modules["__main__"].__settings__.getSetting("torrent_player") == '3':
|
||||
from pyrrent2http import State, Engine, MediaType
|
||||
author = 'Inpos'
|
||||
|
||||
ROOT = sys.modules["__main__"].__root__
|
||||
RESOURCES_PATH = os.path.join(ROOT, 'resources')
|
||||
|
@ -210,8 +214,8 @@ class AnteoLoader:
|
|||
localFile.write(content)
|
||||
localFile.close()
|
||||
except Exception, e:
|
||||
print 'Unable to save torrent file from "' + torrentUrl + '" to "' + torrentFile + '" in Torrent::saveTorrent' + '. Exception: ' + str(
|
||||
e)
|
||||
log('Unable to rename torrent file from %s to %s in AnteoLoader::saveTorrent. Exception: %s' %
|
||||
(torrentUrl, torrentFile, str(e)))
|
||||
return
|
||||
else:
|
||||
torrentFile = torrentUrl
|
||||
|
@ -239,7 +243,7 @@ class AnteoLoader:
|
|||
self.torrentFile = torrent.torrentFile
|
||||
except:
|
||||
self.torrentFile = magnet
|
||||
log('[AnteoLoader][magnetToTorrent]: self.torrentFile '+str(self.torrentFile))
|
||||
log('['+author+'Loader][magnetToTorrent]: self.torrentFile '+str(self.torrentFile))
|
||||
|
||||
class AnteoPlayer(xbmc.Player):
|
||||
__plugin__ = sys.modules["__main__"].__plugin__
|
||||
|
@ -278,15 +282,15 @@ class AnteoPlayer(xbmc.Player):
|
|||
self.setup_nextep()
|
||||
while True:
|
||||
if self.buffer():
|
||||
log('[AnteoPlayer]: ************************************* GOING LOOP')
|
||||
log('['+author+'Player]: ************************************* GOING LOOP')
|
||||
if self.setup_play():
|
||||
self.setup_subs()
|
||||
self.loop()
|
||||
WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
|
||||
else:
|
||||
log('[AnteoPlayer]: ************************************* break')
|
||||
log('['+author+'Player]: ************************************* break')
|
||||
break
|
||||
log('[AnteoPlayer]: ************************************* GO NEXT?')
|
||||
log('['+author+'Player]: ************************************* GO NEXT?')
|
||||
if self.next_dl and self.next_contentId != False and isinstance(self.next_contentId, int) and self.iterator == 100:
|
||||
if not self.next_play:
|
||||
xbmc.sleep(3000)
|
||||
|
@ -296,7 +300,7 @@ class AnteoPlayer(xbmc.Player):
|
|||
break
|
||||
self.contentId = self.next_contentId
|
||||
continue
|
||||
log('[AnteoPlayer]: ************************************* NO! break')
|
||||
log('['+author+'Player]: ************************************* NO! break')
|
||||
break
|
||||
|
||||
xbmc.Player().stop()
|
||||
|
@ -455,7 +459,7 @@ class AnteoPlayer(xbmc.Player):
|
|||
else:
|
||||
self.next_dl = False
|
||||
self.next_play = self.__settings__.getSetting('next_play') == 'true'
|
||||
log('[AnteoPlayer]: next_dl - %s, next_play - %s, ids_video - %s' % (str(self.next_dl), str(self.next_play), str(self.ids_video)))
|
||||
log('['+author+'Player]: next_dl - %s, next_play - %s, ids_video - %s' % (str(self.next_dl), str(self.next_play), str(self.ids_video)))
|
||||
|
||||
def setup_play(self):
|
||||
file_status = self.engine.file_status(self.contentId)
|
||||
|
@ -474,7 +478,7 @@ class AnteoPlayer(xbmc.Player):
|
|||
self.next_contentId = int(self.ids_video[next_contentId_index])
|
||||
else:
|
||||
self.next_contentId = False
|
||||
log('[AnteoPlayer][setup_play]: next_contentId: '+str(self.next_contentId))
|
||||
log('['+author+'Player][setup_play]: next_contentId: '+str(self.next_contentId))
|
||||
try:
|
||||
seasonId = self.get("seasonId")
|
||||
self.episodeId = self.get("episodeId") if not self.episodeId else int(self.episodeId) + 1
|
||||
|
@ -494,7 +498,7 @@ class AnteoPlayer(xbmc.Player):
|
|||
'season': int(seasonId),
|
||||
'tvshowtitle': title})
|
||||
except:
|
||||
log('[AnteoPlayer]: Operation INFO failed!')
|
||||
log('['+author+'Player]: Operation INFO failed!')
|
||||
|
||||
thumbnail = self.get("thumbnail")
|
||||
if thumbnail:
|
||||
|
@ -510,12 +514,12 @@ class AnteoPlayer(xbmc.Player):
|
|||
xbmc.sleep(200)
|
||||
i += 1
|
||||
|
||||
log('[AnteoPlayer]: self.isPlaying() = %s, i = %d, xbmc.abortRequested - %s' % (str(self.isPlaying()), i, str(xbmc.abortRequested)))
|
||||
log('['+author+'Player]: self.isPlaying() = %s, i = %d, xbmc.abortRequested - %s' % (str(self.isPlaying()), i, str(xbmc.abortRequested)))
|
||||
if not self.isPlaying() or xbmc.abortRequested:
|
||||
return False
|
||||
|
||||
if self.seek > 0:
|
||||
log('[AnteoPlayer]: seekTime - '+str(self.seek))
|
||||
log('['+author+'Player]: seekTime - '+str(self.seek))
|
||||
self.seekTime(self.seek)
|
||||
return True
|
||||
|
||||
|
@ -622,7 +626,7 @@ class AnteoPlayer(xbmc.Player):
|
|||
if not status:
|
||||
status = self.engine.status()
|
||||
self.engine.check_torrent_error(status)
|
||||
log('[AnteoPlayer]: %.2f%% complete (down: %.1f kb/s up: %.1f kb/s peers: %d) %s' % \
|
||||
log('['+author+'Player]: %.2f%% complete (down: %.1f kb/s up: %.1f kb/s peers: %d) %s' % \
|
||||
(status.progress * 100, status.download_rate,
|
||||
status.upload_rate, status.num_peers, status.state_str))
|
||||
|
||||
|
|
8
Core.py
8
Core.py
|
@ -35,7 +35,7 @@ class Core:
|
|||
userStorageDirectory = file_encode(__settings__.getSetting("storage"))
|
||||
torrentFilesDirectory = 'torrents'
|
||||
debug = __settings__.getSetting('debug') == 'true'
|
||||
torrent_player=__settings__.getSetting("torrent_player")
|
||||
torrent_player = __settings__.getSetting("torrent_player")
|
||||
history_bool = __settings__.getSetting('history') == 'true'
|
||||
open_option = int(__settings__.getSetting('open_option'))
|
||||
language = {0: 'en', 1: 'ru', 2: 'uk', 3: 'he'}.get(int(__settings__.getSetting("language")))
|
||||
|
@ -54,7 +54,7 @@ class Core:
|
|||
def sectionMenu(self):
|
||||
if self.__settings__.getSetting('plugin_name') != self.__plugin__:
|
||||
#Every update run
|
||||
first_run_242()
|
||||
first_run_250()
|
||||
self.__settings__.setSetting('plugin_name', self.__plugin__)
|
||||
#check_network_advancedsettings()
|
||||
check_download_dir()
|
||||
|
@ -100,7 +100,7 @@ class Core:
|
|||
image=self.ROOT + '/icons/torrentPlayer.png')
|
||||
self.drawItem('< %s >' % self.localize('Search Control Window'), 'controlCenter',
|
||||
image=self.ROOT + '/icons/settings.png', isFolder=False)
|
||||
self.drawItem('< %s >' % self.localize('Magnet-link Player'), 'magentPlayer',#if self.torrent_player!='1':
|
||||
self.drawItem('< %s >' % self.localize('Magnet-link Player'), 'magentPlayer',
|
||||
image=self.ROOT + '/icons/magnet.png')
|
||||
if self.debug:
|
||||
self.drawItem('full_download', 'full_download', image=self.ROOT + '/icons/magnet.png')
|
||||
|
@ -1413,7 +1413,7 @@ class Core:
|
|||
self.Player = TorrentPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
|
||||
else:
|
||||
log(self.__plugin__ + " Unexpected access to method playTorrent() without torrent content")
|
||||
elif self.torrent_player == '2':
|
||||
elif self.torrent_player == '2' or self.torrent_player == '3':
|
||||
from Anteoloader import AnteoPlayer
|
||||
if 0 != len(torrentUrl):
|
||||
self.Player = AnteoPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
|
||||
|
|
|
@ -49,7 +49,7 @@ class Torrent():
|
|||
self.player = 'libtorrent'
|
||||
elif player == '1':
|
||||
self.player = 'acestream'
|
||||
elif player == '2':
|
||||
elif player == '2' or player == '3':
|
||||
self.player = 'anteo'
|
||||
|
||||
def play_url_ind(self, ind, label, icon):
|
||||
|
|
|
@ -138,8 +138,8 @@ class Libtorrent:
|
|||
try:
|
||||
xbmcvfs.rename(torrentFile, newFile)
|
||||
except Exception, e:
|
||||
print 'Unable to rename torrent file from "' + torrentFile + '" to "' + newFile + '" in Torrent::renameTorrent' + '. Exception: ' + str(
|
||||
e)
|
||||
log('Unable to rename torrent file from %s to %s in Torrent::renameTorrent. Exception: %s' %
|
||||
(torrentFile, newFile, str(e)))
|
||||
return
|
||||
self.torrentFile = newFile
|
||||
if not self.torrentFileInfo:
|
||||
|
@ -436,7 +436,7 @@ class Libtorrent:
|
|||
else:
|
||||
resume_file=self.resume_data_path()
|
||||
if xbmcvfs.exists(resume_file):
|
||||
log('loading resume data from file'+resume_file)
|
||||
log('loading resume data from file '+resume_file)
|
||||
try:
|
||||
resumDataFile=xbmcvfs.File(resume_file,'rb')
|
||||
self.save_resume_data=resumDataFile.read()
|
||||
|
@ -444,7 +444,7 @@ class Libtorrent:
|
|||
torrent_info['resume_data']=self.save_resume_data
|
||||
|
||||
except:
|
||||
log(' Failed to load resume data from file'+ resume_file)
|
||||
log('Failed to load resume data from file '+ resume_file)
|
||||
self.torrentHandle = self.session.add_torrent(torrent_info)
|
||||
self.torrentHandle.set_sequential_download(True)
|
||||
self.torrentHandle.set_max_connections(60)
|
||||
|
@ -454,7 +454,6 @@ class Libtorrent:
|
|||
def stopSession(self):
|
||||
for i in range(self.torrentFileInfo.num_pieces()):
|
||||
self.torrentHandle.piece_priority(i, 0)
|
||||
self.resume_data()
|
||||
|
||||
def continueSession(self, contentId=0, Offset=0, seeding=False, isMP4=False):
|
||||
self.piece_length = self.torrentFileInfo.piece_length()
|
||||
|
@ -462,10 +461,8 @@ class Libtorrent:
|
|||
if not Offset:
|
||||
Offset = selectedFileInfo['size'] / (1024 * 1024)
|
||||
self.partOffset = (Offset * 1024 * 1024 / self.piece_length) + 1
|
||||
# print 'partOffset ' + str(self.partOffset)+str(' ')
|
||||
self.startPart = selectedFileInfo['offset'] / self.piece_length
|
||||
self.endPart = int((selectedFileInfo['offset'] + selectedFileInfo['size']) / self.piece_length)
|
||||
# print 'part ' + str(self.startPart)+ str(' ')+ str(self.endPart)
|
||||
multiplier = self.partOffset / 5
|
||||
log('continueSession: multiplier ' + str(multiplier))
|
||||
for i in range(self.startPart, self.startPart + self.partOffset):
|
||||
|
@ -473,13 +470,12 @@ class Libtorrent:
|
|||
self.torrentHandle.piece_priority(i, 7)
|
||||
if isMP4 and i % multiplier == 0:
|
||||
self.torrentHandle.piece_priority(self.endPart - i / multiplier, 7)
|
||||
# print str(i)
|
||||
if multiplier >= i:
|
||||
self.torrentHandle.piece_priority(self.endPart - i, 7)
|
||||
# print str(i)
|
||||
|
||||
def checkThread(self):
|
||||
if self.threadComplete == True:
|
||||
self.resume_data()
|
||||
log('checkThread KIIIIIIIIIIILLLLLLLLLLLLLLL')
|
||||
try:
|
||||
self.session.remove_torrent(self.torrentHandle)
|
||||
|
@ -491,6 +487,7 @@ class Libtorrent:
|
|||
self.session.stop_dht()
|
||||
|
||||
def resume_data(self):
|
||||
wasPaused=self.session.is_paused()
|
||||
self.session.pause()
|
||||
self.save_resume_data=None
|
||||
|
||||
|
@ -504,7 +501,7 @@ class Libtorrent:
|
|||
return
|
||||
|
||||
log('[save_resume_data]: waiting for alert...')
|
||||
self.torrentHandle.save_resume_data()
|
||||
self.torrentHandle.save_resume_data(self.lt.save_resume_flags_t.flush_disk_cache)
|
||||
received=False
|
||||
while not received:
|
||||
self.session.wait_for_alert(1000)
|
||||
|
@ -528,19 +525,20 @@ class Libtorrent:
|
|||
log('[save_resume_data]: done.')
|
||||
|
||||
finally:
|
||||
self.session.resume()
|
||||
if not wasPaused:
|
||||
self.session.resume()
|
||||
|
||||
def debug(self):
|
||||
#try:
|
||||
if 1==1:
|
||||
# print str(self.getFilePath(0))
|
||||
# log(str(self.getFilePath(0)))
|
||||
s = self.torrentHandle.status()
|
||||
#get_cache_status=self.session.get_cache_status()
|
||||
#log('get_cache_status - %s/%s' % (str(get_cache_status.blocks_written), str(get_cache_status.blocks_read)))
|
||||
# get_settings=self.torrentHandle.status
|
||||
# print s.num_pieces
|
||||
# log(s.num_pieces)
|
||||
#priorities = self.torrentHandle.piece_priorities()
|
||||
#print str(priorities)
|
||||
#log(str(priorities))
|
||||
|
||||
state_str = ['queued', 'checking', 'downloading metadata',
|
||||
'downloading', 'finished', 'seeding', 'allocating', 'checking fastresume']
|
||||
|
@ -562,11 +560,11 @@ class Libtorrent:
|
|||
#i = 0
|
||||
# for t in s.pieces:
|
||||
# if t: i=i+1
|
||||
#print str(self.session.pop_alert())
|
||||
# print str(s.pieces[self.startPart:self.endPart])
|
||||
# print 'True pieces: %d' % i
|
||||
# print s.current_tracker
|
||||
# print str(s.pieces)
|
||||
#log(str(self.session.pop_alert())
|
||||
# log(str(s.pieces[self.startPart:self.endPart]))
|
||||
# log('True pieces: %d' % i)
|
||||
# log(s.current_tracker)
|
||||
# log(str(s.pieces))
|
||||
#except:
|
||||
else:
|
||||
log('debug error')
|
||||
|
|
|
@ -539,7 +539,7 @@ def localize(text):
|
|||
'Please, restart Kodi now!':'Теперь перезагрузите Коди, пожалуйста!',
|
||||
'./ (Root folder)':'./ (Корневой каталог)',
|
||||
'Opening torrent file':'Открытие torrent-файла',
|
||||
'New player to Torrenter v2 - Torrent2HTTP! It should be faster, stable and better with Android, also seeking works in it.':'В Torrenter новый плеер - Torrent2HTTP! Он стабильнее, быстрее и отлично ладит с Android, в нем работает перемотка.',
|
||||
'New player to Torrenter v2 - pyrrent2http! Advantages of Torrent2HTTP but with python-libtorrent library instead of libtorrent-go!':'В Torrenter новый плеер - pyrrent2http! Преимущества Torrent2HTTP, но на библиотеке python-libtorrent вместо libtorrent-go!',
|
||||
'Would you like to try it?':'Хотите его попробовать?',
|
||||
'Torrent2HTTP enabled! Can be changed in Settings.':'Torrent2HTTP включен! Можно изменить в Настройках.',
|
||||
'Seeking':'Перемотка',
|
||||
|
|
|
@ -259,7 +259,7 @@ class TorrentPlayer(xbmc.Player):
|
|||
downloadedSize = self.torrent.torrentHandle.file_progress()[self.contentId]
|
||||
status = self.torrent.torrentHandle.status()
|
||||
iterator = int(status.progress * 100)
|
||||
if status.state == 0 or (status.progress == 0 and status.num_pieces > 0):
|
||||
if status.state in [0, 1] or (status.progress == 0 and status.num_pieces > 0):
|
||||
iterator = int(status.num_pieces * 100 / num_pieces)
|
||||
if iterator > 99: iterator = 99
|
||||
progressBar.update(iterator, self.localize('Checking preloaded files...'), ' ', ' ')
|
||||
|
@ -286,10 +286,8 @@ class TorrentPlayer(xbmc.Player):
|
|||
self.torrent.checkThread()
|
||||
return
|
||||
xbmc.sleep(1000)
|
||||
#self.torrent.torrentHandle.flush_cache()
|
||||
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||
self.torrent.resume_data()
|
||||
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||
progressBar.update(0)
|
||||
progressBar.close()
|
||||
return True
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.torrenter" name="Torrenter" version="2.4.6" provider-name="DiMartino">
|
||||
<addon id="plugin.video.torrenter" name="Torrenter" version="2.5.0" provider-name="DiMartino">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.libtorrent"/>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
English changelog at http://bit.ly/1MfSVUP
|
||||
|
||||
[B]Version 2.5.0[/B]
|
||||
[+] НОВЫЙ проигрыватель pyrrent2http от inpos! Аналог torrent2http написаный на python, а не на GO.
|
||||
[+] Проигрыватель: Ускорена повторная работа с торрентом - resume data (спасибо srg70 и RussakHH)
|
||||
|
||||
[B]Version 2.4.6[/B]
|
||||
[+] Проигрыватель: Уменьшена просадка после загрузки буфера (спасибо srg70 и RussakHH)
|
||||
[+] История Просмотров: Добавлено имя раздачи, тонкая настройка добавления по проценту просмотра
|
||||
|
|
16
functions.py
16
functions.py
|
@ -1749,15 +1749,15 @@ def first_run_231():
|
|||
xbmc.executebuiltin('Dialog.Close(all,true)')
|
||||
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher'))
|
||||
|
||||
def first_run_242():
|
||||
if __settings__.getSetting('torrent_player')=='2':
|
||||
__settings__.setSetting('first_run_242','True')
|
||||
def first_run_250():
|
||||
if __settings__.getSetting('torrent_player')=='3':
|
||||
__settings__.setSetting('first_run_250','True')
|
||||
|
||||
if not __settings__.getSetting('first_run_242')=='True':
|
||||
__settings__.setSetting('first_run_242','True')
|
||||
yes=xbmcgui.Dialog().yesno('< %s >' % (Localization.localize('Torrenter Update ') + '2.4.2'),
|
||||
Localization.localize('New player to Torrenter v2 - Torrent2HTTP! It should be faster, '
|
||||
'stable and better with Android, also seeking works in it.'),
|
||||
if not __settings__.getSetting('first_run_250')=='True':
|
||||
__settings__.setSetting('first_run_250','True')
|
||||
yes=xbmcgui.Dialog().yesno('< %s >' % (Localization.localize('Torrenter Update ') + '2.5.0'),
|
||||
Localization.localize('New player to Torrenter v2 - pyrrent2http! Advantages of Torrent2HTTP '
|
||||
'but with python-libtorrent library instead of libtorrent-go!'),
|
||||
Localization.localize('Would you like to try it?'),)
|
||||
if yes:
|
||||
__settings__.openSettings()
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<string id="30065">Do not add to Watched History if played more (%)</string>
|
||||
<string id="30066">Confluence (by safonov_ivan)</string>
|
||||
<string id="30067">Aeon Nox (by joyrider)</string>
|
||||
<string id="30068">pyrrent2http (python-libtorrent via http)</string>
|
||||
<string id="30101">Interface</string>
|
||||
<string id="30102">P2P Network</string>
|
||||
<string id="30103">Advanced</string>
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<string id="30065">Не добавлять в История Просмотров если больше (%)</string>
|
||||
<string id="30066">Confluence (от safonov_ivan)</string>
|
||||
<string id="30067">Aeon Nox (от joyrider)</string>
|
||||
<string id="30068">pyrrent2http (python-libtorrent по http)</string>
|
||||
<string id="30101">Интерфейс</string>
|
||||
<string id="30102">P2P Сеть</string>
|
||||
<string id="30103">Дополнительные</string>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<setting id="debug" type="bool" label="30015" default="false"/>
|
||||
</category>
|
||||
<category label="30102">
|
||||
<setting id="torrent_player" type="enum" label="30023" default="2" lvalues="30021|30022|30046" />
|
||||
<setting id="torrent_player" type="enum" label="30023" default="2" lvalues="30021|30022|30046|30068" />
|
||||
<setting id="storage" type="folder" label="30004" default=""/>
|
||||
<setting id="keep_files" type="enum" label="30008" default="1" lvalues="30043|30044|30045"/>
|
||||
<setting id="next_dl" type="bool" label="30013" default="true" visible="!eq(-3,1)"/>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<setting id="torrent_qbittorrent_password" type="text" label="50316" visible="eq(-21,4)" default="admin" option="hidden"/>
|
||||
</category>
|
||||
<category label="30105">
|
||||
<setting id="torrent_player" type="enum" label="30023" default="2" lvalues="30021|30022|30046" />
|
||||
<setting id="torrent_player" type="enum" label="30023" default="2" lvalues="30021|30022|30046|30068" />
|
||||
<setting id="ask_dir" type="bool" label="30031" default="false"/>
|
||||
<setting id="connections_limit" type="number" label="30051" default="200" visible=" eq(-2,2)"/>
|
||||
<setting id="use_random_port" type="bool" label="30052" default="false" visible=" eq(-3,2)"/>
|
||||
|
|
Loading…
Reference in New Issue