myshows external fix

pull/1/head
DiMartinoXBMC 2015-01-19 17:32:24 +03:00
parent b129b2fc44
commit c4ef6d0ba9
5 changed files with 500 additions and 434 deletions

File diff suppressed because it is too large Load Diff

27
Core.py
View File

@ -1349,21 +1349,36 @@ class Core:
myshows_lang = myshows_setting.getLocalizedString myshows_lang = myshows_setting.getLocalizedString
myshows_items = [] myshows_items = []
myshows_files = [] myshows_files = []
myshows_sizes = {}
contentList = [] contentList = []
for filedict in torrent.getContentList(): for filedict in torrent.getContentList():
fileTitle = '' fileTitle = ''
if filedict.get('size'): if filedict.get('size'):
fileTitle = '[%d MB] ' % (filedict.get('size') / 1024 / 1024) myshows_sizes[str(filedict.get('ind'))]='[%d MB] ' % (filedict.get('size') / 1024 / 1024)
title = filedict.get('title') title = filedict.get('title')
fileTitle = fileTitle + '[%s]%s' % (title[len(title) - 3:], title) fileTitle = fileTitle + '[%s]%s' % (title[len(title) - 3:], title)
contentList.append((self.unescape(fileTitle), str(filedict.get('ind')))) contentList.append((self.unescape(fileTitle), str(filedict.get('ind'))))
contentList = sorted(contentList, key=lambda x: x[0]) contentList = sorted(contentList, key=lambda x: x[0])
for title, identifier in contentList: for title, identifier in contentList:
if re.search('.*?\.avi|mp4|mkv|flv|mov|vob|wmv|ogm|asx|mpg|mpeg|avc|vp3|fli|flc|m4v$', title, try:
re.I | re.DOTALL): if title.split('.')[-1].lower() in ['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso']:
myshows_items.append(title) myshows_items.append(title)
myshows_files.append('plugin://plugin.video.torrenter/?action=playTorrent&url=' + identifier) myshows_files.append(identifier)
if len(myshows_items) > 1: myshows_items = cutFileNames(myshows_items) except:
pass
if len(myshows_items) > 1:
if len(myshows_sizes)==0:
myshows_items = cutFileNames(myshows_items)
else:
myshows_cut = cutFileNames(myshows_items)
myshows_items=[]
x=-1
for i in myshows_files:
x=x+1
fileTitle = ''
fileTitle=myshows_sizes[str(i)]
fileTitle+=myshows_cut[x]
myshows_items.append(fileTitle)
myshows_items.append(unicode(myshows_lang(30400))) myshows_items.append(unicode(myshows_lang(30400)))
myshows_files.append('') myshows_files.append('')
dialog = xbmcgui.Dialog() dialog = xbmcgui.Dialog()
@ -1372,7 +1387,7 @@ class Core:
else: else:
ret = dialog.select(unicode(myshows_lang(30401)), myshows_items) ret = dialog.select(unicode(myshows_lang(30401)), myshows_items)
if ret > -1: if ret > -1:
xbmc.executebuiltin('xbmc.RunPlugin("' + myshows_files[ret] + '")') xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url=' + myshows_files[ret] + '")')
else: else:
contentList = [] contentList = []
for filedict in torrent.getContentList(): for filedict in torrent.getContentList():

View File

@ -144,7 +144,7 @@ class TorrentPlayer(xbmc.Player):
else: else:
break break
#print '************************************* GO NEXT?' #print '************************************* GO NEXT?'
if self.next_dl and self.next_dling and (self.next_contentId or self.next_contentId==0) and self.iterator == 100: if self.next_dl and self.next_dling and isinstance(self.next_contentId, int) and self.iterator == 100:
self.contentId = self.next_contentId self.contentId = self.next_contentId
continue continue
#print '************************************* NO! break' #print '************************************* NO! break'
@ -259,7 +259,6 @@ class TorrentPlayer(xbmc.Player):
if not xbmcvfs.exists(newFileName): if not xbmcvfs.exists(newFileName):
xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName) xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName)
def setup_play(self): def setup_play(self):
self.next_dling = False self.next_dling = False
self.iterator=0 self.iterator=0
@ -361,7 +360,7 @@ class TorrentPlayer(xbmc.Player):
self.seed(self.contentId) self.seed(self.contentId)
self.seeding_status=True self.seeding_status=True
#xbmc.sleep(7000) #xbmc.sleep(7000)
if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId, int): if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId, int) and self.next_contentId!=False:
showMessage(Localization.localize('Torrent Downloading'), showMessage(Localization.localize('Torrent Downloading'),
Localization.localize('Starting download next episode!'), forced=True) Localization.localize('Starting download next episode!'), forced=True)
self.torrent.stopSession() self.torrent.stopSession()

24
cal.py

File diff suppressed because one or more lines are too long

View File

@ -79,7 +79,7 @@ def md5(string):
def Debug(msg, force=False): def Debug(msg, force=False):
if (debug == 'true' or force): if (1==1 or debug == 'true' or force):
try: try:
print "[Torrenter v2] " + msg print "[Torrenter v2] " + msg
except UnicodeEncodeError: except UnicodeEncodeError: