From 8eb47adbd092e0f9e59b33f0890fd7f5e88b4e34 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Thu, 17 Mar 2016 23:08:37 +0300 Subject: [PATCH 1/9] push --- Anteoloader.py | 3 ++- SearcherABC.py | 7 ++++++- addon.xml | 2 +- resources/language/English/strings.xml | 2 +- resources/language/Russian/strings.xml | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Anteoloader.py b/Anteoloader.py index a2c60eb..444b1b5 100644 --- a/Anteoloader.py +++ b/Anteoloader.py @@ -386,6 +386,7 @@ class AnteoPlayer(xbmc.Player): dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"] user_agent = 'uTorrent/2200(24683)' 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, 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 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) i += 1 diff --git a/SearcherABC.py b/SearcherABC.py index 1e4a432..2d0a4c9 100644 --- a/SearcherABC.py +++ b/SearcherABC.py @@ -254,4 +254,9 @@ class SearcherABC: status = str(r1.status) + " " + r1.reason content = r1.read() self.debug('[open2] status:'+str(status)) - return content \ No newline at end of file + 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))) \ No newline at end of file diff --git a/addon.xml b/addon.xml index 6231ca4..0b6bcf2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index da2da48..f76c42b 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -3,7 +3,7 @@ Interface Language Lock Folders View Style Off - Save Files To Folder + Save Files To Folder (not FAT32) Use magnet-links Keep downloaded files Keep seeding of downloaded files diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml index 3bd940f..a4351d8 100644 --- a/resources/language/Russian/strings.xml +++ b/resources/language/Russian/strings.xml @@ -3,7 +3,7 @@ Язык интерфейса Удерживать стиль отображения Отключено - Сохранять файлы в директорию + Сохранять файлы в директорию (не FAT32) Использовать магнет-ссылки Хранить загруженные файлы Оставаться на раздаче скачанных файлов From 63d75c3d2e56c210ee93856ce7b1f77bede1d3fb Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Thu, 17 Mar 2016 23:10:50 +0300 Subject: [PATCH 2/9] push --- Anteoloader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Anteoloader.py b/Anteoloader.py index 444b1b5..bff6d73 100644 --- a/Anteoloader.py +++ b/Anteoloader.py @@ -613,9 +613,9 @@ class AnteoPlayer(xbmc.Player): def _get_status_lines(self, s, f): return [ localize_path(self.display_name), - "%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state]).decode('utf-8')), - "D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s').decode('utf-8'), - s.upload_rate, self.localize('kb/s').decode('utf-8'), + "%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state])), + "D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s'), + s.upload_rate, self.localize('kb/s'), s.num_seeds, s.num_peers) ] From 2468ceb3da2bf513d7dee163bde3ceaf2407aba8 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Thu, 17 Mar 2016 23:13:41 +0300 Subject: [PATCH 3/9] push --- .idea/workspace.xml | 1086 ++++++++++++++++++------------------------- Anteoloader.py | 6 +- 2 files changed, 463 insertions(+), 629 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1bf5c46..b04c831 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,9 @@ - + - - + @@ -34,72 +33,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - @@ -221,127 +165,71 @@ + + - - - - + + + + - - - - - - - - - - - + - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -354,7 +242,7 @@ - + @@ -382,35 +270,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -456,21 +320,45 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + @@ -486,6 +374,16 @@ + + + + + + + + + + @@ -508,26 +406,9 @@ @@ -890,42 +788,6 @@ @@ -1195,9 +1093,8 @@ - - + @@ -1207,10 +1104,11 @@ - + + - + @@ -1225,9 +1123,6 @@ - - - @@ -1250,141 +1145,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1413,13 +1185,6 @@ - - - - - - - @@ -1427,13 +1192,6 @@ - - - - - - - @@ -1462,13 +1220,6 @@ - - - - - - - @@ -1476,22 +1227,6 @@ - - - - - - - - - - - - - - - - @@ -1499,39 +1234,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1551,51 +1253,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1606,21 +1263,6 @@ - - - - - - - - - - - - - - - @@ -1628,68 +1270,38 @@ - + - - - - + - + - - - - + - + - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + - + @@ -1734,87 +1346,187 @@ - + - - - - - - - - - - - - - - - - - - - - - + + - + - - - + + - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - @@ -1936,15 +1648,137 @@ + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Anteoloader.py b/Anteoloader.py index bff6d73..444b1b5 100644 --- a/Anteoloader.py +++ b/Anteoloader.py @@ -613,9 +613,9 @@ class AnteoPlayer(xbmc.Player): def _get_status_lines(self, s, f): return [ localize_path(self.display_name), - "%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state])), - "D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s'), - s.upload_rate, self.localize('kb/s'), + "%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state]).decode('utf-8')), + "D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s').decode('utf-8'), + s.upload_rate, self.localize('kb/s').decode('utf-8'), s.num_seeds, s.num_peers) ] From 478e349c86cb3117c006d9073854ba49f1084898 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Thu, 17 Mar 2016 23:39:23 +0300 Subject: [PATCH 4/9] img fix --- Core.py | 44 ++++---------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/Core.py b/Core.py index e1843ce..541a1d6 100644 --- a/Core.py +++ b/Core.py @@ -1127,6 +1127,7 @@ class Core: listitem.setInfo(type='Video', infoLabels=info) else: listitem.setInfo(type='Video', infoLabels=info) + listitem.setArt({'thumb': image}) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=isFolder) def getParameters(self, parameterString): @@ -1353,44 +1354,7 @@ class Core: % ('torrentPlayer', url)) return if url: - self.__settings__.setSetting("lastTorrentUrl", url) - 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((unescape(fileTitle), str(filedict.get('ind')))) - 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 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) - view_style('torrentPlayer') - xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) + self.openTorrent(params) def userStorage(self, params): save=False @@ -1486,7 +1450,7 @@ class Core: def openTorrent(self, params={}): get = params.get 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"),'') url = urllib.unquote_plus(get("url")) @@ -1513,7 +1477,7 @@ class Core: dirList, contentListNew = cutFolder(contentList, tdir) 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='' From ef053f9b86b91046b6cc90ed1c387eaf20224de5 Mon Sep 17 00:00:00 2001 From: Sergey Shramchenko Date: Thu, 17 Mar 2016 22:55:20 +0200 Subject: [PATCH 5/9] Sorting: name and size --- Core.py | 99 +++++++++++++++++++++++++++++++-------------------- Libtorrent.py | 29 +++------------ functions.py | 17 ++++++--- 3 files changed, 77 insertions(+), 68 deletions(-) diff --git a/Core.py b/Core.py index e1843ce..552c0cd 100644 --- a/Core.py +++ b/Core.py @@ -1101,11 +1101,13 @@ class Core: view_style('searchOption') xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) - def drawItem(self, title, action, link='', image='', isFolder=True, contextMenu=None, replaceMenu=True, action2='', + def drawItem(self, title, action, link='', image='', isFolder=True, contextMenu=None, replaceMenu=True, action2='', fileSize=0L, info={}): listitem = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image) #log('[drawItem]:'+str((title, action, image, isFolder, contextMenu, replaceMenu, action2, info))) if not info: info = {"Title": title, "plot": title} + if not isFolder and fileSize: + info['size'] = fileSize if isinstance(link, dict): link_url = '' for key in link.keys(): @@ -1356,41 +1358,46 @@ class Core: self.__settings__.setSetting("lastTorrentUrl", url) 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((unescape(fileTitle), str(filedict.get('ind')))) - contentList = sorted(contentList, key=lambda x: x[0]) + + self.drawFolder(torrent, tdir, url, 'torrentPlayer') - #print str(contentList) + #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) + #dirList, contentListNew = cutFolder(contentList, tdir) - for title in dirList: - self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title) + #for title in dirList: + # self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title) - ids_video_result = get_ids_video(contentListNew) - ids_video='' + #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) + ',' + #if len(ids_video_result)>0: + # for identifier in ids_video_result: + # ids_video = ids_video + str(identifier) + ',' - for title, identifier 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) - view_style('torrentPlayer') - xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) + #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): save=False @@ -1501,14 +1508,19 @@ class Core: if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) + self.drawFolder(torrent, tdir, url, 'openTorrent', thumbnail, save_folder) + def drawFolder(self, torrent, tdir, url, vstyle, thumbnail='', save_folder=''): + hasSize = False contentList = [] for filedict in torrent.getContentList(): fileTitle = filedict.get('title') - if filedict.get('size'): - fileTitle += ' [%d MB]' % (filedict.get('size') / 1024 / 1024) - contentList.append((unescape(fileTitle), str(filedict.get('ind')))) - contentList = sorted(contentList, key=lambda x: x[0]) + size = filedict.get('size') + if size: + fileTitle += ' [%d MB]' % (size / 1024 / 1024) + hasSize = True + contentList.append((unescape(fileTitle), str(filedict.get('ind')), size)) + #contentList = sorted(contentList, key=lambda x: x[0]) dirList, contentListNew = cutFolder(contentList, tdir) @@ -1522,7 +1534,7 @@ class Core: for identifier in ids_video_result: ids_video = ids_video + str(identifier) + ',' - for title, identifier in contentListNew: + for title, identifier, filesize in contentListNew: contextMenu = [ (self.localize('Download via T-client'), 'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % ( @@ -1533,9 +1545,20 @@ class Core: ] link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder} self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False, - action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False) - view_style('openTorrent') - xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) + action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize) + view_style(vstyle) + p_handle = int(sys.argv[1]) + try: + xbmcplugin.addSortMethod(p_handle, xbmcplugin.SORT_METHOD_LABEL) + if hasSize: + xbmcplugin.addSortMethod(p_handle, xbmcplugin.SORT_METHOD_SIZE) + xbmc.executebuiltin("Container.SetSortMethod(%s)" % str(1)) + #xbmc.executebuiltin("Container.SetSortDirection()") + except: + log(' !!!! >>>> Faild to set sorting method to ' + str(xbmcplugin.SORT_METHOD_SIZE)) + pass + + xbmcplugin.endOfDirectory(p_handle, succeeded=True) def openSection(self, params={}): get = params.get diff --git a/Libtorrent.py b/Libtorrent.py index 220e31d..8a6fabc 100644 --- a/Libtorrent.py +++ b/Libtorrent.py @@ -96,7 +96,9 @@ class Libtorrent: torrentUrl) + '.torrent' try: if not re.match("^http\:.+$", torrentUrl): - content = xbmcvfs.File(torrentUrl, "rb").read() + contentFile = xbmcvfs.File(torrentUrl, "rb") + content = contentFile.read() + contentFile.close() else: request = urllib2.Request(torrentUrl) request.add_header('Referer', torrentUrl) @@ -126,30 +128,7 @@ class Libtorrent: self.torrentFile = torrentFile return self.torrentFile - #baseName = localize_path(os.path.basename(self.getFilePath())) - #if not xbmcvfs.exists(self.torrentFilesPath): - # xbmcvfs.mkdirs(self.torrentFilesPath) - #newFile = self.torrentFilesPath + self.md5( - # torrentUrl) + '.torrent' #self.md5(baseName) + '.' + - #if xbmcvfs.exists(newFile): - # log('saveTorrent: delete file ' + newFile) - # xbmcvfs.delete(newFile) - #if not xbmcvfs.exists(newFile): - # try: - # renamed = xbmcvfs.rename(torrentFile, newFile) - # log('saveTorrent: xbmcvfs.rename %s %s to %s' %(torrentFile, newFile, str(renamed))) - # except Exception, 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: - # e=self.lt.bdecode(xbmcvfs.File(self.torrentFile,'rb').read()) - # self.torrentFileInfo = self.lt.torrent_info(e) - # log('torrentFileInfo (saveTorrent2)=' + str(self.torrentFileInfo)) - - #return self.torrentFile - + def getMagnetInfo(self): magnetSettings = { 'url': self.magnetLink, diff --git a/functions.py b/functions.py index 45e5801..dc26d3c 100644 --- a/functions.py +++ b/functions.py @@ -428,13 +428,16 @@ def cutFolder(contentList, tdir=None): common_folder = common_folder.split('/')[0] common = True - for fileTitle, contentId in contentList: + for item in contentList: + fileTitle = item[0] if common_folder not in fileTitle: common = False break # print common_folder - for fileTitle, contentId in contentList: + for item in contentList: + fileTitle = item[0] + contentId = item[1] dir = None if common: fileTitle = fileTitle[len(common_folder) + 1:] @@ -446,10 +449,12 @@ def cutFolder(contentList, tdir=None): elif '/' in fileTitle: dir = fileTitle.split('/')[0] elif not tdir: - contentListNew.append((fileTitle, contentId)) + contentListNew.append(item) if tdir and dir == tdir: - contentListNew.append((fileTitle[len(dir) + 1:], contentId)) + tupleContent = list(item) + tupleContent[0] = fileTitle[len(dir) + 1:] + contentListNew.append(tuple(tupleContent)) if not tdir and dir and dir not in dirList: dirList.append(dir) @@ -1711,7 +1716,9 @@ def get_ids_video(contentList): 'fli', 'flc', 'm4v', 'iso'] allowed_music_ext = ['mp3', 'flac', 'wma', 'ogg', 'm4a', 'aac', 'm4p', 'rm', 'ra'] for extlist in [allowed_video_ext, allowed_music_ext]: - for title, identifier in contentList: + for item in contentList: + title = item[0] + identifier = item[1] try: ext = title.split('.')[-1] if ext.lower() in extlist: From 27e68911bf12d2566efc83d76317d3076fe6dcfa Mon Sep 17 00:00:00 2001 From: Sergey Shramchenko Date: Thu, 17 Mar 2016 23:04:48 +0200 Subject: [PATCH 6/9] Post merge fix --- Core.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Core.py b/Core.py index 19d1678..df143ad 100644 --- a/Core.py +++ b/Core.py @@ -1467,9 +1467,7 @@ class Core: if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) - self.drawFolder(torrent, tdir, url, 'openTorrent', thumbnail, save_folder) - def drawFolder(self, torrent, tdir, url, vstyle, thumbnail='', save_folder=''): hasSize = False contentList = [] for filedict in torrent.getContentList(): @@ -1505,7 +1503,7 @@ class Core: link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder} self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False, action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize) - view_style(vstyle) + view_style('openTorrent') p_handle = int(sys.argv[1]) try: xbmcplugin.addSortMethod(p_handle, xbmcplugin.SORT_METHOD_LABEL) From a0af92bd9f6ddd7d5587dba91daaac226ae1c13d Mon Sep 17 00:00:00 2001 From: Sergey Shramchenko Date: Fri, 18 Mar 2016 02:00:56 +0200 Subject: [PATCH 7/9] Settings for filesize after filename --- Core.py | 6 ++++-- resources/language/English/strings.xml | 1 + resources/language/Russian/strings.xml | 3 ++- resources/settings.xml | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Core.py b/Core.py index df143ad..9278334 100644 --- a/Core.py +++ b/Core.py @@ -1467,14 +1467,16 @@ class Core: if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) - + + append_filesize = self.__settings__.getSetting("append_filesize") == 'true' hasSize = False contentList = [] for filedict in torrent.getContentList(): fileTitle = filedict.get('title') size = filedict.get('size') if size: - fileTitle += ' [%d MB]' % (size / 1024 / 1024) + if append_filesize: + fileTitle += ' [%d MB]' % (size / 1024 / 1024) hasSize = True contentList.append((unescape(fileTitle), str(filedict.get('ind')), size)) #contentList = sorted(contentList, key=lambda x: x[0]) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index f76c42b..39e3cb3 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -66,6 +66,7 @@ Confluence (by safonov_ivan) Aeon Nox (by joyrider) pyrrent2http (python-libtorrent via http) + Append size to file name Interface P2P Network Advanced diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml index a4351d8..a6be9a9 100644 --- a/resources/language/Russian/strings.xml +++ b/resources/language/Russian/strings.xml @@ -1,4 +1,4 @@ - + Язык интерфейса Удерживать стиль отображения @@ -66,6 +66,7 @@ Confluence (от safonov_ivan) Aeon Nox (от joyrider) pyrrent2http (python-libtorrent по http) + Добавлять размер к имени файла Интерфейс P2P Сеть Дополнительные diff --git a/resources/settings.xml b/resources/settings.xml index 1dc796b..4c65b91 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -6,6 +6,7 @@ + From fc3a83b42155a7e06bba1f09fd4018c03aeb83fc Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Fri, 18 Mar 2016 18:35:38 +0300 Subject: [PATCH 8/9] revert srg70 monster kill --- Libtorrent.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Libtorrent.py b/Libtorrent.py index 8a6fabc..e95c99e 100644 --- a/Libtorrent.py +++ b/Libtorrent.py @@ -125,7 +125,23 @@ class Libtorrent: log('Exception: ' + str(e)) xbmcvfs.delete(torrentFile) return - + if not xbmcvfs.exists(self.torrentFilesPath): + xbmcvfs.mkdirs(self.torrentFilesPath) + newFile = self.torrentFilesPath + self.md5(torrentUrl) + '.torrent' + if newFile != torrentFile: + if xbmcvfs.exists(newFile): + xbmcvfs.delete(newFile) + if not xbmcvfs.exists(newFile): + try: + xbmcvfs.rename(torrentFile, newFile) + except Exception, 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: + e=self.lt.bdecode(xbmcvfs.File(self.torrentFile,'rb').read()) + self.torrentFileInfo = self.lt.torrent_info(e) self.torrentFile = torrentFile return self.torrentFile From 784ae2814b11ff5acd69a37ece3405d12978cf9d Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Fri, 18 Mar 2016 18:38:50 +0300 Subject: [PATCH 9/9] revert srg70 monster kill --- addon.xml | 2 +- changelog.txt | 3 +++ resources/settings.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index 0b6bcf2..3510c38 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/changelog.txt b/changelog.txt index e6b9ee0..09674ff 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ English changelog at http://bit.ly/1MfSVUP +[B]Version 2.5.2[/B] +[+] Упорядочивание по разверу файла. + [B]Version 2.5.1[/B] [+] Исправлена работа с кодировками. diff --git a/resources/settings.xml b/resources/settings.xml index 4c65b91..bddb0dd 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -6,7 +6,6 @@ - @@ -70,5 +69,6 @@ +