From 49a24bec2ce018cbd8c99f10a6d9d5e61b13d105 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Thu, 14 May 2015 19:20:49 +0300 Subject: [PATCH] update --- Core.py | 27 +++++++++++++++++++++++++-- Libtorrent.py | 4 ++-- Player.py | 9 +++++++-- addon.xml | 2 +- changelog.txt | 7 ++++++- resources/contenters/KickAssSo.py | 18 +++++++----------- resources/searchers/RuTorOrg.py | 6 ++++-- 7 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Core.py b/Core.py index 257303a..0eec55b 100644 --- a/Core.py +++ b/Core.py @@ -272,12 +272,14 @@ class Core: def test(self, params={}): #db=DownloadDB() #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' #torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) #self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(filename)) #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)+'¬_download_only=True")') def DownloadStatus(self, params={}): db = DownloadDB() @@ -1350,6 +1352,27 @@ class Core: print 'Unable to save torrent file from "' + url + '" to "' + torrentFile + '" in Torrent::saveTorrent' 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={}): get = params.get external = unquote(get("external"),None) diff --git a/Libtorrent.py b/Libtorrent.py index 38d3407..9fb2fd9 100644 --- a/Libtorrent.py +++ b/Libtorrent.py @@ -176,10 +176,10 @@ class Libtorrent: torrentInfo = self.getMagnetInfo() try: 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): 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.write(self.lt.bencode(torrentFile.generate())) torentFileHandler.close() diff --git a/Player.py b/Player.py index ad94822..0ef4578 100644 --- a/Player.py +++ b/Player.py @@ -166,7 +166,7 @@ class TorrentPlayer(xbmc.Player): def init(self): 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.display_name = '' self.downloadedSize = 0 @@ -306,7 +306,12 @@ class TorrentPlayer(xbmc.Player): xbmc.sleep(300) 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 return True diff --git a/addon.xml b/addon.xml index 69751b5..f8ea4f3 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/changelog.txt b/changelog.txt index c526c5b..ce3b717 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 [B]Version 2.2.1[/B] diff --git a/resources/contenters/KickAssSo.py b/resources/contenters/KickAssSo.py index 7413fb4..6789a9d 100644 --- a/resources/contenters/KickAssSo.py +++ b/resources/contenters/KickAssSo.py @@ -23,18 +23,14 @@ from BeautifulSoup import BeautifulSoup class KickAssSo(Content.Content): category_dict = { - 'hot': ('Most Recent', '/new/', {'page': '/new/%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'}]}), + 'hot': ('Most Recent', '/new/?field=seeders&sorder=desc', {'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2, + ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}), 'anime': ('Anime', '/anime/', {'page': '/anime/%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'}]}), - 'tvshows': ('TV Shows', '/tv/', {'page': '/tv/%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'}]}), - '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'}]}), + ' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}), + 'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc', {'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2, + ' ':[{'name':' ', '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':' ', 'url_after':'?field=seeders&sorder=desc'}]}), } baseurl = "http://kickass.to" diff --git a/resources/searchers/RuTorOrg.py b/resources/searchers/RuTorOrg.py index a382905..f882e3e 100644 --- a/resources/searchers/RuTorOrg.py +++ b/resources/searchers/RuTorOrg.py @@ -87,15 +87,17 @@ class RuTorOrg(SearcherABC.SearcherABC): ('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))] response = self.makeRequest(url, headers=headers) + #print response + if None != response and 0 < len(response): dat = re.compile( - '.+?.+?(.+?).+?(\d*?\..+? .+?).+? (\d+).+?alt="L".+?> (\d+)', + '.+?.+?(.+?).+?(\d*?\..+? .+?).+? (\d+).+?alt="L".+?> (\d+)', re.DOTALL).findall(response) if dat and len(dat) > 0: for (link, title, size, seeds, leechers) in dat: torrentTitle = title.strip() #"%s [S\L: %s\%s]" % (title, seeds, leechers) size = size.replace(' ', ' ') - link='http://zerkalo-rutor.org'+link + if link[0]=='/': link='http://zerkalo-rutor.org'+link image = sys.modules["__main__"].__root__ + self.searchIcon filesList.append(( int(int(self.sourceWeight) * int(seeds)),