pull/1/head
DiMartinoXBMC 2015-05-14 19:20:49 +03:00
parent 4da09c6751
commit 49a24bec2c
7 changed files with 52 additions and 21 deletions

27
Core.py
View File

@ -272,12 +272,14 @@ class Core:
def test(self, params={}): def test(self, params={}):
#db=DownloadDB() #db=DownloadDB()
#db.add(u'XXX2', 'file', json.dumps({'seeds':1,'leechers':1}), 20) #db.add(u'XXX2', 'file', json.dumps({'seeds':1,'leechers':1}), 20)
#url='magnet:?xt=urn:btih:MZLDDZU5MWZWICIGQN6YDVAXJNNISU5W&dn=Jimmy.Fallon.2015.01.09.Don.Cheadle.HDTV.x264-CROOKS&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:80&tr=udp://open.demonii.com:80&tr=udp://tracker.coppersurfer.tk:80' #url='magnet:?xt=urn:btih:6698E0950DCD257A6B03AF2E8B068B7FF9D4619D&dn=game+of+thrones+season+2+720p+bluray+x264+shaanig&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337'
#filename='D:\\torrents\\Torrenter\\torrents\\Jimmy.Fallon.2015.01.09.Don.Cheadle.HDTV.x264-CROOKS.mp4.torrent' #filename='D:\\torrents\\Torrenter\\torrents\\Jimmy.Fallon.2015.01.09.Don.Cheadle.HDTV.x264-CROOKS.mp4.torrent'
#torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) #torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
#self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(filename)) #self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(filename))
#torrent.downloadProcess() #torrent.downloadProcess()
self.DownloadStatus() #self.DownloadStatus()
url='http://torcache.net/torrent/6698E0950DCD257A6B03AF2E8B068B7FF9D4619D.torrent?title=[kickass.to]game.of.thrones.season.2.720p.bluray.x264.shaanig'
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=openTorrent&external=ThePirateBaySe&url=ThePirateBaySe%3A%3A'+urllib.quote_plus(url)+'&not_download_only=True")')
def DownloadStatus(self, params={}): def DownloadStatus(self, params={}):
db = DownloadDB() db = DownloadDB()
@ -1350,6 +1352,27 @@ class Core:
print 'Unable to save torrent file from "' + url + '" to "' + torrentFile + '" in Torrent::saveTorrent' print 'Unable to save torrent file from "' + url + '" to "' + torrentFile + '" in Torrent::saveTorrent'
return return
def playSTRM(self, params={}):
get = params.get
xbmc.executebuiltin('xbmc.Playlist.Clear')
url = unquote(get("url"),None)
if url:
self.__settings__.setSetting("lastTorrentUrl", url)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
contentList = []
for filedict in torrent.getContentList():
fileTitle = filedict.get('title')
if filedict.get('size'):
fileTitle += ' [%d MB]' % (filedict.get('size') / 1024 / 1024)
contentList.append((filedict.get('size'), self.unescape(fileTitle), str(filedict.get('ind'))))
if len(contentList)>0:
contentList = sorted(contentList, key=lambda x: x[0], reverse=True)
#self.playTorrent({'url':contentList[0][2]})
xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+contentList[0][2]+'")')
def openTorrent(self, params={}): def openTorrent(self, params={}):
get = params.get get = params.get
external = unquote(get("external"),None) external = unquote(get("external"),None)

View File

@ -176,10 +176,10 @@ class Libtorrent:
torrentInfo = self.getMagnetInfo() torrentInfo = self.getMagnetInfo()
try: try:
torrentFile = self.lt.create_torrent(torrentInfo) torrentFile = self.lt.create_torrent(torrentInfo)
baseName = file_encode(os.path.basename(self.storageDirectory + os.sep + torrentInfo.files()[0].path)) baseName = os.path.basename(self.storageDirectory + os.sep + torrentInfo.files()[0].path)
if not xbmcvfs.exists(self.torrentFilesPath): if not xbmcvfs.exists(self.torrentFilesPath):
xbmcvfs.mkdirs(self.torrentFilesPath) xbmcvfs.mkdirs(self.torrentFilesPath)
self.torrentFile = self.torrentFilesPath + baseName + '.torrent' self.torrentFile = self.torrentFilesPath + self.md5(baseName) + '.torrent'
torentFileHandler = xbmcvfs.File(self.torrentFile, "w+b") torentFileHandler = xbmcvfs.File(self.torrentFile, "w+b")
torentFileHandler.write(self.lt.bencode(torrentFile.generate())) torentFileHandler.write(self.lt.bencode(torrentFile.generate()))
torentFileHandler.close() torentFileHandler.close()

View File

@ -166,7 +166,7 @@ class TorrentPlayer(xbmc.Player):
def init(self): def init(self):
self.next_dl = True if self.__settings__.getSetting('next_dl') == 'true' and self.ids_video else False self.next_dl = True if self.__settings__.getSetting('next_dl') == 'true' and self.ids_video else False
print str(self.next_dl) print '[TorrentPlayer]: init - '+str(self.next_dl)
self.next_contentId = False self.next_contentId = False
self.display_name = '' self.display_name = ''
self.downloadedSize = 0 self.downloadedSize = 0
@ -306,7 +306,12 @@ class TorrentPlayer(xbmc.Player):
xbmc.sleep(300) xbmc.sleep(300)
if response: if response:
xbmc.Player().play(path, listitem) #xbmc.Player().play(path, listitem)
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
playlist.add(path, listitem)
xbmc.Player().play(playlist)
xbmc.sleep(3000)#very important, do not edit this, podavan xbmc.sleep(3000)#very important, do not edit this, podavan
return True return True

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.2.3" provider-name="vadim.skorba, DiMartino"> <addon id="plugin.video.torrenter" name="Torrenter" version="2.2.4" provider-name="vadim.skorba, 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

@ -1,4 +1,9 @@
[B]Version 2.2.2[/B] [B]Version 2.2.3[/B]
[+] Проигрыватель: Добавлена возможность запускать через .strm файлы (plugin://plugin.video.torrenter/?action=playSTRM&url=URL_ENCODED_MAGNET_PATH_HTTP)
[B]Version 2.2.2[/B]
[+] Списки Медиа: Обновлен KickAssSo (by GriffeyJuni0r)
[+] Поиск: Исправлен RuTor
[+] Поиск: Исправлен RuTrackerOrg, T411FR [+] Поиск: Исправлен RuTrackerOrg, T411FR
[B]Version 2.2.1[/B] [B]Version 2.2.1[/B]

View File

@ -23,18 +23,14 @@ from BeautifulSoup import BeautifulSoup
class KickAssSo(Content.Content): class KickAssSo(Content.Content):
category_dict = { category_dict = {
'hot': ('Most Recent', '/new/', {'page': '/new/%d/', 'increase': 1, 'second_page': 2, 'hot': ('Most Recent', '/new/?field=seeders&sorder=desc', {'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
{'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}),
'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2, 'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2,
'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
{'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), 'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc', {'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
'tvshows': ('TV Shows', '/tv/', {'page': '/tv/%d/', 'increase': 1, 'second_page': 2, ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, 'movies': ('Movies', '/movies/?field=seeders&sorder=desc', {'page': '/movies/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
{'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
'movies': ('Movies', '/movies/', {'page': '/movies/%d/', 'increase': 1, 'second_page': 2,
'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'},
{'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}),
} }
baseurl = "http://kickass.to" baseurl = "http://kickass.to"

View File

@ -87,15 +87,17 @@ class RuTorOrg(SearcherABC.SearcherABC):
('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))] ('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))]
response = self.makeRequest(url, headers=headers) response = self.makeRequest(url, headers=headers)
#print response
if None != response and 0 < len(response): if None != response and 0 < len(response):
dat = re.compile( dat = re.compile(
'<tr class="[tg].+?<a.+?href="(/download/\d+)">.+?<a href=".+?">.+?<a href=".+?">(.+?)</a></td>.+?<td align="right">(\d*?\..+?&nbsp;.+?)</td>.+?<img .+?alt="S".+?>&nbsp;(\d+)</span>.+?alt="L".+?>&nbsp;(\d+)', '<tr class="[tg].+?<a.+?href="(.+?download/\d+)">.+?<a href=".+?">.+?<a href=".+?">(.+?)</a></td>.+?<td align="right">(\d*?\..+?&nbsp;.+?)</td>.+?<img .+?alt="S".+?>&nbsp;(\d+)</span>.+?alt="L".+?>&nbsp;(\d+)',
re.DOTALL).findall(response) re.DOTALL).findall(response)
if dat and len(dat) > 0: if dat and len(dat) > 0:
for (link, title, size, seeds, leechers) in dat: for (link, title, size, seeds, leechers) in dat:
torrentTitle = title.strip() #"%s [S\L: %s\%s]" % (title, seeds, leechers) torrentTitle = title.strip() #"%s [S\L: %s\%s]" % (title, seeds, leechers)
size = size.replace('&nbsp;', ' ') size = size.replace('&nbsp;', ' ')
link='http://zerkalo-rutor.org'+link if link[0]=='/': link='http://zerkalo-rutor.org'+link
image = sys.modules["__main__"].__root__ + self.searchIcon image = sys.modules["__main__"].__root__ + self.searchIcon
filesList.append(( filesList.append((
int(int(self.sourceWeight) * int(seeds)), int(int(self.sourceWeight) * int(seeds)),