music update

pull/1/head
DiMartinoXBMC 2015-05-18 21:14:06 +03:00
parent a25e598a4b
commit f9226315b7
3 changed files with 33 additions and 37 deletions

26
Core.py
View File

@ -1259,14 +1259,12 @@ class Core:
for title in dirList: for title in dirList:
self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title) self.drawItem(title, 'openTorrent', url, isFolder=True, action2=title)
ids_video = '' ids_video_result = get_ids_video(contentListNew)
for title, identifier in contentListNew: ids_video=''
try:
ext = title.split('.')[-1] if len(ids_video_result)>0:
if re.match('avi|mp4|mkV|flv|mov|vob|wmv|ogm|asx|mpg|mpeg|avc|vp3|fli|flc|m4v', ext, re.I): for identifier in ids_video_result:
ids_video = ids_video + str(identifier) + ',' ids_video = ids_video + str(identifier) + ','
except:
pass
for title, identifier in contentListNew: for title, identifier in contentListNew:
contextMenu = [ contextMenu = [
@ -1421,7 +1419,7 @@ class Core:
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:
try: try:
if title.split('.')[-1].lower() in ['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso']: if title.split('.')[-1].lower() in ['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso','mp3']:
myshows_items.append(title) myshows_items.append(title)
myshows_files.append(identifier) myshows_files.append(identifier)
except: except:
@ -1458,14 +1456,12 @@ class Core:
for title in dirList: for title in dirList:
self.drawItem(title, 'openTorrent', url, image=thumbnail, isFolder=True, action2=title) self.drawItem(title, 'openTorrent', url, image=thumbnail, isFolder=True, action2=title)
ids_video = '' ids_video_result = get_ids_video(contentListNew)
for title, identifier in contentListNew: ids_video=''
try:
ext = title.split('.')[-1] if len(ids_video_result)>0:
if ext.lower() in ['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso']: for identifier in ids_video_result:
ids_video = ids_video + str(identifier) + ',' ids_video = ids_video + str(identifier) + ','
except:
pass
for title, identifier in contentListNew: for title, identifier in contentListNew:
contextMenu = [ contextMenu = [

View File

@ -11,7 +11,7 @@ import Downloader
import xbmcgui import xbmcgui
import xbmcvfs import xbmcvfs
import Localization import Localization
from functions import calculate, showMessage, clearStorage, DownloadDB, cutFolder from functions import calculate, showMessage, clearStorage, DownloadDB, get_ids_video
ROOT = sys.modules["__main__"].__root__ ROOT = sys.modules["__main__"].__root__
@ -403,24 +403,7 @@ class TorrentPlayer(xbmc.Player):
def get_ids(self): def get_ids(self):
contentList = [] contentList = []
#path=self.torrent.getContentList()[self.contentId]['title']
#print path
for filedict in self.torrent.getContentList(): for filedict in self.torrent.getContentList():
contentList.append((filedict.get('title'), str(filedict.get('ind')))) contentList.append((filedict.get('title'), str(filedict.get('ind'))))
contentList = sorted(contentList, key=lambda x: x[0]) contentList = sorted(contentList, key=lambda x: x[0])
#print str(contentList) return get_ids_video(contentList)
#dirList, contentListNew = cutFolder(contentList)
ids_video = []
#print str(contentListNew)
for title, identifier in contentList:
try:
ext = title.split('.')[-1]
if ext.lower() in ['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso']:
ids_video.append(str(identifier))
except:
pass
#print 'get_ids:'+str(ids_video)
return ids_video

View File

@ -1577,3 +1577,20 @@ def itemScrap(item, kwarg):
item.setInfo(type='Video', infoLabels=kwarg['info']) item.setInfo(type='Video', infoLabels=kwarg['info'])
return item return item
def get_ids_video(contentList):
ids_video=[]
allowed_video_ext=['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','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:
try:
ext = title.split('.')[-1]
if ext.lower() in extlist:
ids_video.append(str(identifier))
except:
pass
if len(ids_video)>1:
break
#print Debug('[get_ids_video]:'+str(ids_video))
return ids_video