Merge branch 'master-root'

# Conflicts:
#	Core.py
pull/5/head
Sergey Shramchenko 2016-03-17 23:01:03 +02:00
commit fe40d79f2c
7 changed files with 475 additions and 676 deletions

File diff suppressed because it is too large Load Diff

View File

@ -386,6 +386,7 @@ class AnteoPlayer(xbmc.Player):
dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"] dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)' user_agent = 'uTorrent/2200(24683)'
self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024 self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024
showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait'))
self.engine = Engine(uri=file_url(self.torrentUrl), download_path=self.userStorageDirectory, self.engine = Engine(uri=file_url(self.torrentUrl), download_path=self.userStorageDirectory,
connections_limit=connections_limit, download_kbps=download_limit, upload_kbps=upload_limit, connections_limit=connections_limit, download_kbps=download_limit, upload_kbps=upload_limit,
@ -520,7 +521,7 @@ class AnteoPlayer(xbmc.Player):
xbmc.sleep(2000) # very important, do not edit this, podavan xbmc.sleep(2000) # very important, do not edit this, podavan
i = 0 i = 0
while not xbmc.abortRequested and not self.isPlaying() and i < 50: while not xbmc.abortRequested and not self.isPlaying() and i < 150:
xbmc.sleep(200) xbmc.sleep(200)
i += 1 i += 1

49
Core.py
View File

@ -1129,6 +1129,7 @@ class Core:
listitem.setInfo(type='Video', infoLabels=info) listitem.setInfo(type='Video', infoLabels=info)
else: else:
listitem.setInfo(type='Video', infoLabels=info) listitem.setInfo(type='Video', infoLabels=info)
listitem.setArt({'thumb': image})
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=isFolder) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=isFolder)
def getParameters(self, parameterString): def getParameters(self, parameterString):
@ -1355,49 +1356,7 @@ class Core:
% ('torrentPlayer', url)) % ('torrentPlayer', url))
return return
if url: if url:
self.__settings__.setSetting("lastTorrentUrl", url) self.openTorrent(params)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
self.drawFolder(torrent, tdir, url, 'torrentPlayer')
#contentList = []
#for filedict in torrent.getContentList():
# fileTitle = filedict.get('title')
# size = filedict.get('size')
# if size:
# fileTitle += ' [%d MB]' % (size / 1024 / 1024)
# contentList.append((unescape(fileTitle), str(filedict.get('ind')), size))
#contentList = sorted(contentList, key=lambda x: x[0])
##print str(contentList)
#dirList, contentListNew = cutFolder(contentList, tdir)
#for title in dirList:
# self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title)
#ids_video_result = get_ids_video(contentListNew)
#ids_video=''
#if len(ids_video_result)>0:
# for identifier in ids_video_result:
# ids_video = ids_video + str(identifier) + ','
#for title, identifier, filesize in contentListNew:
# contextMenu = [
# (self.localize('Download via T-client'),
# 'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
# sys.argv[0], 'downloadFilesList', str(identifier))),
# (self.localize('Download via Libtorrent'),
# 'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
# sys.argv[0], 'downloadLibtorrent', str(identifier))),
# ]
# self.drawItem(title, 'playTorrent', identifier, isFolder=False, action2=ids_video.rstrip(','),
# contextMenu=contextMenu, replaceMenu=False, fileSize=filesize)
#view_style('torrentPlayer')
#xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def userStorage(self, params): def userStorage(self, params):
save=False save=False
@ -1493,7 +1452,7 @@ class Core:
def openTorrent(self, params={}): def openTorrent(self, params={}):
get = params.get get = params.get
tdir = unquote(get("url2"),None) tdir = unquote(get("url2"),None)
thumbnail = unquote(get("thumbnail"),'') thumbnail = unquote(get("thumbnail"), False) and True or 'DefaultVideo.png'
save_folder = unquote(get("save_folder"),'') save_folder = unquote(get("save_folder"),'')
url = urllib.unquote_plus(get("url")) url = urllib.unquote_plus(get("url"))
@ -1525,7 +1484,7 @@ class Core:
dirList, contentListNew = cutFolder(contentList, tdir) dirList, contentListNew = cutFolder(contentList, tdir)
for title in dirList: for title in dirList:
self.drawItem(title, 'openTorrent', url, image=thumbnail, isFolder=True, action2=title) self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title)
ids_video_result = get_ids_video(contentListNew) ids_video_result = get_ids_video(contentListNew)
ids_video='' ids_video=''

View File

@ -255,3 +255,8 @@ class SearcherABC:
content = r1.read() content = r1.read()
self.debug('[open2] status:'+str(status)) self.debug('[open2] status:'+str(status))
return content return content
def showMessage(self, heading, message, times=10000):
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % (
heading.replace('"', "'"), message.replace('"', "'"), times, self.searchIcon))
self.log(str((heading.replace('"', "'"), message.replace('"', "'"), times, self.searchIcon)))

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.torrenter" name="Torrenter" version="2.5.1" provider-name="DiMartino"> <addon id="plugin.video.torrenter" name="Torrenter" version="2.5.1b" provider-name="DiMartino">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent"/> <import addon="script.module.libtorrent"/>

View File

@ -3,7 +3,7 @@
<string id="30001">Interface Language</string> <string id="30001">Interface Language</string>
<string id="30002">Lock Folders View Style</string> <string id="30002">Lock Folders View Style</string>
<string id="30003">Off</string> <string id="30003">Off</string>
<string id="30004">Save Files To Folder</string> <string id="30004">Save Files To Folder (not FAT32)</string>
<string id="30007">Use magnet-links</string> <string id="30007">Use magnet-links</string>
<string id="30008">Keep downloaded files</string> <string id="30008">Keep downloaded files</string>
<string id="30009">Keep seeding of downloaded files</string> <string id="30009">Keep seeding of downloaded files</string>

View File

@ -3,7 +3,7 @@
<string id="30001">Язык интерфейса</string> <string id="30001">Язык интерфейса</string>
<string id="30002">Удерживать стиль отображения</string> <string id="30002">Удерживать стиль отображения</string>
<string id="30003">Отключено</string> <string id="30003">Отключено</string>
<string id="30004">Сохранять файлы в директорию</string> <string id="30004">Сохранять файлы в директорию (не FAT32)</string>
<string id="30007">Использовать магнет-ссылки</string> <string id="30007">Использовать магнет-ссылки</string>
<string id="30008">Хранить загруженные файлы</string> <string id="30008">Хранить загруженные файлы</string>
<string id="30009">Оставаться на раздаче скачанных файлов</string> <string id="30009">Оставаться на раздаче скачанных файлов</string>