myshows external fix

This commit is contained in:
DiMartinoXBMC committed 2015-01-19 17:32:24 +03:00
1 parent b129b2fc44
commit c4ef6d0ba9
5 files changed
+500 -434

No files matched your search

+459 -411
View File
File diff suppressed because it is too large. Load diff
+24 -9
View File
@@ -1349,30 +1349,45 @@ class Core:
myshows_lang = myshows_setting.getLocalizedString
myshows_items = []
myshows_files = []
myshows_sizes = {}
contentList = []
for filedict in torrent.getContentList():
fileTitle = ''
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')
fileTitle = fileTitle + '[%s]%s' % (title[len(title) - 3:], title)
contentList.append((self.unescape(fileTitle), str(filedict.get('ind'))))
contentList = sorted(contentList, key=lambda x: x[0])
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,
re.I | re.DOTALL):
myshows_items.append(title)
myshows_files.append('plugin://plugin.video.torrenter/?action=playTorrent&url=' + identifier)
if len(myshows_items) > 1: myshows_items = cutFileNames(myshows_items)
myshows_items.append(unicode(myshows_lang(30400)))
myshows_files.append('')
try:
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_files.append(identifier)
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_files.append('')
dialog = xbmcgui.Dialog()
if len(myshows_items) == 2:
ret = 0
else:
ret = dialog.select(unicode(myshows_lang(30401)), myshows_items)
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:
contentList = []
for filedict in torrent.getContentList():
+2 -3
View File
@@ -144,7 +144,7 @@ class TorrentPlayer(xbmc.Player):
else:
break
#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
continue
#print '************************************* NO! break'
@@ -259,7 +259,6 @@ class TorrentPlayer(xbmc.Player):
if not xbmcvfs.exists(newFileName):
xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName)
def setup_play(self):
self.next_dling = False
self.iterator=0
@@ -361,7 +360,7 @@ class TorrentPlayer(xbmc.Player):
self.seed(self.contentId)
self.seeding_status=True
#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'),
Localization.localize('Starting download next episode!'), forced=True)
self.torrent.stopSession()
+14 -10
View File
@@ -11,14 +11,18 @@ searcherObject[searcher] = getattr(__import__(searcher), searcher)()
#print str(searcherObject[searcher].get_contentList(category='search', subcategory='Hobbit'))
obj={u'error': None, u'id': 2, u'result': {u'type': u'dir', u'contents': {u'Suzumiya Haruhi no Yuuutsu (DVDrip)': {u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)', u'progresses': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], u'type': u'dir', u'contents': {u'Suzumiya Haruhi no Yuuutsu - 09 [DVDrip 1280x720 x264 FLAC].mkv': {u'index': 160, u'offset': 10245278714L, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Suzumiya Haruhi no Yuuutsu - 09 [DVDrip 1280x720 x264 FLAC].mkv', u'type': u'file', u'size': 850603865}, u'Suzumiya Haruhi no Yuuutsu - 06 [DVDrip 1280x720 x264 FLAC].mkv': {u'index': 157, u'offset': 7404768960L, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Suzumiya Haruhi no Yuuutsu - 06 [DVDrip 1280x720 x264 FLAC].mkv', u'type': u'file', u'size': 1124491250}, u'Suzumiya Haruhi no Yuuutsu - 07 [DVDrip 1280x720 x264 FLAC].mkv': {u'index': 158, u'offset': 8529260210L, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Suzumiya Haruhi no Yuuutsu - 07 [DVDrip 1280x720 x264 FLAC].mkv', u'type': u'file', u'size': 711015248}, u'Suzumiya Haruhi no Yuuutsu - 04 [DVDrip 1280x720 x264 FLAC].mkv': {u'index': 155, u'offset': 5236003762L, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Suzumiya Haruhi no Yuuutsu - 04 [DVDrip 1280x720 x264 FLAC].mkv', u'type': u'file', u'size': 1063548449}, u'Suzumiya Haruhi no Yuuutsu - 05 [DVDrip 1280x720 x264 FLAC].mkv': {u'index': 156, u'offset': 6299552211L, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Suzumiya Haruhi no Yuuutsu - 05 [DVDrip 1280x720 x264 FLAC].mkv', u'type': u'file', u'size': 1105216749}, u'Bonus': {u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus', u'progresses': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], u'type': u'dir', u'contents': {u'Pictures': {u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures', u'progresses': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], u'type': u'dir', u'contents': {u'_sister': {u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures/_sister', u'progresses': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], u'type': u'dir', u'contents': {u'sos0603.jpg': {u'index': 78, u'offset': 10926555, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures/_sister/sos0603.jpg', u'type': u'file', u'size': 86351}, u'sos0601.jpg': {u'index': 76, u'offset': 10710056, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures/_sister/sos0601.jpg', u'type': u'file', u'size': 108113}, u'sos0404.jpg': {u'index': 75, u'offset': 10601734, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures/_sister/sos0404.jpg', u'type': u'file', u'size': 108322}, u'sos1401.jpg': {u'index': 80, u'offset': 11103523, u'priority': 1, u'progress': 0.0, u'path': u'Suzumiya Haruhi no Yuuutsu (DVDrip)/Bonus/Pictures/_sister/sos1401.jpg', u'type': u'file', u'size': 70265}, u'sos0402.jpg': {u'index': 73, u'offset': 10392920, u'priority': 1, u'progress': 0.0, u'path': u'Line truncated
title='No Game No Life\\Subs.[GMC]\\No Game No Life - 06.ass'
path='D:\\torrents\\Torrenter\\No Game No Life\\No Game No Life - 06.mkv'
#path='/sdasda/asdasd/asdasd/No Game No Life - 06.mkv'
#obj=json.loads(x)
obj=obj['result']
res=[1,2,3,4,5]
res.pop(2)
res.insert(2,3)
print str(res)
folder=title.split('\\')[0]
print folder
temp=os.path.basename(title)
print temp
addition=os.path.dirname(title).lstrip(folder+'\\').replace('\\','.').replace(' ','_').strip()
print addition
ext=temp.split('.')[-1]
temp = temp[:len(temp) - len(ext) - 1]+'.'+addition+'.'+ext
print temp
newFileName=os.path.join(os.path.dirname(path),temp.replace('\\',os.sep))
print str((os.path.join(os.path.dirname(os.path.dirname(path)),title.replace('\\',os.sep)),newFileName))
+1 -1
View File
@@ -79,7 +79,7 @@ def md5(string):
def Debug(msg, force=False):
if (debug == 'true' or force):
if (1==1 or debug == 'true' or force):
try:
print "[Torrenter v2] " + msg
except UnicodeEncodeError: