def ParsePlaylist(mediaitem=CMediaItem() , proxy="CACHING"): playlist = CPlayList() type = mediaitem.GetType() URL='' #load the playlist if type == 'rss_flickr_daily': result = playlist.load_rss_flickr_daily(URL, mediaitem, proxy) elif type[0:3] == 'rss': result = playlist.load_rss_20(URL, mediaitem, proxy) elif type == 'html_youtube': result = playlist.load_html_youtube(URL, mediaitem, proxy) elif type == 'xml_shoutcast': result = playlist.load_xml_shoutcast(URL, mediaitem, proxy) elif type == 'xml_applemovie': result = playlist.load_xml_applemovie(URL, mediaitem, proxy) elif type == 'directory': result = playlist.load_dir(URL, mediaitem, proxy) else: #assume playlist file result = playlist.load_plx(URL, mediaitem, proxy) if result == -1: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "This playlist requires a newer Navi-X version") elif result == -2: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "Cannot open file.") if result != 0: #failure return -1 #succesful playlist.save(RootDir + 'source.plx') today=datetime.date.today() #fill the main list xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_NONE) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE) for m in playlist.list: if m.thumb != 'default': thumb = m.thumb else: thumb = getPlEntryThumb(m) label2 = '' if m.date != '': l=m.date.split('-') entry_date = datetime.date(int(l[0]), int(l[1]), int(l[2])) days_past = (today-entry_date).days if days_past <= 10: if days_past <= 0: label2 = ' [NEW today]' elif days_past == 1: label2 = ' [NEW yesterday]' else: label2 = ' [NEW '+ str(days_past) + ' days ago]' folder=False type = m.GetType() if (type == 'playlist') or (type == 'rss') or\ (type == 'rss_flickr_daily') or (type == 'html_youtube') or \ (type == 'xml_applemovie') or (type == 'directory') or \ (type == 'xml_shoutcast') or (type == 'search_shoutcast') or \ (type == 'search_youtube') or (type == 'search'): folder = True desc='' if m.description: #desc=m.description desc=HTMLunescape(m.description) item = xbmcgui.ListItem(m.name+label2, iconImage=thumb, thumbnailImage=thumb) item.setInfo( type=m.type, infoLabels={ "Title": m.name , "Plot": desc } ) #hack to play youtube swf if m.URL.find('youtube.com/v/')>-1: m.URL=m.URL.replace('http://youtube.com','http://www.youtube.com') m.URL=m.URL.replace('youtube.com/v/','youtube.com/watch?v=') m.URL=m.URL.replace('.swf','') m.processor='http://navix.turner3d.net/proc/youtube_movies' URL = sys.argv[0] + "?mode=0&name=" + urllib.quote_plus(m.name) + \ "&type=" + urllib.quote_plus(m.type) + \ "&url=" + urllib.quote_plus(m.URL) + \ "&processor=" + urllib.quote_plus(m.processor) + \ "&date=" + urllib.quote_plus(m.date) xbmcplugin.addDirectoryItem(int(sys.argv[1]), URL, item, folder, playlist.size()) #addSortMethod #xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_PLAYLIST_ORDER) #xbmcplugin.endOfDirectory(int(sys.argv[1])) return 0 #success
def ParsePlaylist(mediaitem=CMediaItem(), proxy="CACHING"): playlist = CPlayList() type = mediaitem.GetType() URL = '' #load the playlist if type == 'rss_flickr_daily': result = playlist.load_rss_flickr_daily(URL, mediaitem, proxy) elif type[0:3] == 'rss': result = playlist.load_rss_20(URL, mediaitem, proxy) elif type == 'html_youtube': result = playlist.load_html_youtube(URL, mediaitem, proxy) elif type == 'xml_shoutcast': result = playlist.load_xml_shoutcast(URL, mediaitem, proxy) elif type == 'xml_applemovie': result = playlist.load_xml_applemovie(URL, mediaitem, proxy) elif type == 'directory': result = playlist.load_dir(URL, mediaitem, proxy) else: #assume playlist file result = playlist.load_plx(URL, mediaitem, proxy) if result == -1: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "This playlist requires a newer Navi-X version") elif result == -2: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "Cannot open file.") if result != 0: #failure return -1 #succesful playlist.save(RootDir + 'source.plx') today = datetime.date.today() #fill the main list xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_NONE) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE) for m in playlist.list: if m.thumb != 'default': thumb = m.thumb else: thumb = getPlEntryThumb(m) label2 = '' if m.date != '': l = m.date.split('-') entry_date = datetime.date(int(l[0]), int(l[1]), int(l[2])) days_past = (today - entry_date).days if days_past <= 10: if days_past <= 0: label2 = ' [NEW today]' elif days_past == 1: label2 = ' [NEW yesterday]' else: label2 = ' [NEW ' + str(days_past) + ' days ago]' folder = False type = m.GetType() if (type == 'playlist') or (type == 'rss') or\ (type == 'rss_flickr_daily') or (type == 'html_youtube') or \ (type == 'xml_applemovie') or (type == 'directory') or \ (type == 'xml_shoutcast') or (type == 'search_shoutcast') or \ (type == 'search_youtube') or (type == 'search'): folder = True desc = '' if m.description: #desc=m.description desc = HTMLunescape(m.description) item = xbmcgui.ListItem(m.name + label2, iconImage=thumb, thumbnailImage=thumb) item.setInfo(type=m.type, infoLabels={"Title": m.name, "Plot": desc}) #hack to play youtube swf if m.URL.find('youtube.com/v/') > -1: m.URL = m.URL.replace('http://youtube.com', 'http://www.youtube.com') m.URL = m.URL.replace('youtube.com/v/', 'youtube.com/watch?v=') m.URL = m.URL.replace('.swf', '') m.processor = 'http://navix.turner3d.net/proc/youtube_movies' URL = sys.argv[0] + "?mode=0&name=" + urllib.quote_plus(m.name) + \ "&type=" + urllib.quote_plus(m.type) + \ "&url=" + urllib.quote_plus(m.URL) + \ "&processor=" + urllib.quote_plus(m.processor) + \ "&date=" + urllib.quote_plus(m.date) xbmcplugin.addDirectoryItem(int(sys.argv[1]), URL, item, folder, playlist.size()) #addSortMethod #xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_PLAYLIST_ORDER) #xbmcplugin.endOfDirectory(int(sys.argv[1])) return 0 #success
def ParsePlaylist(URL='', mediaitem=CMediaItem(), reload=True, view=''): if reload == False: listcontrol = mc.GetWindow(14000).GetList(GetListView()).GetItems() stackitem = mc.GetWindow(14000).GetList(555).GetItem(0) view = stackitem.GetProperty("view") SetListView(view) mc.GetWindow(14000).GetList(GetListView()).SetFocus() mc.GetWindow(14000).GetList(GetListView()).SetItems(listcontrol) #pos = stackitem.GetProperty("focusseditem") #mc.GetWindow(14000).GetList(GetListView()).SetFocusedItem(pos) return if URL != '': mediaitem = CMediaItem() mediaitem.URL = URL mediaitem.type = 'playlist' mc.ShowDialogWait() playlist = CPlayList() type = mediaitem.GetType() ##mc.ShowDialogOk("Debug", "Parse mediaitem of type " + type) listcontrol = mc.GetWindow(14000).GetList(GetListView()).GetItems() del listcontrol[:] #load the playlist if type == 'rss_flickr_daily': result = playlist.load_rss_flickr_daily(URL, mediaitem) elif type[0:3] == 'rss': result = playlist.load_rss_20(URL, mediaitem) elif type[0:4] == 'atom': result = playlist.load_atom_10(URL, mediaitem) elif type == 'opml': result = playlist.load_opml_10(URL, mediaitem) elif type == 'html_youtube': result = playlist.load_html_youtube(URL, mediaitem) elif type == 'xml_shoutcast': result = playlist.load_xml_shoutcast(URL, mediaitem) elif type == 'xml_applemovie': result = playlist.load_xml_applemovie(URL, mediaitem) elif type == 'directory': result = playlist.load_dir(URL, mediaitem) else: #assume playlist file result = playlist.load_plx(URL, mediaitem) ### playlist.save(RootDir + 'source.plx') if result == -1: #error mc.ShowDialogOk("Error", "This playlist requires a newer Navi-X version") elif result == -2: #error mc.ShowDialogOk("Error", "Cannot open file.") if result != 0: #failure return -1 #display the new URL on top of the screen if len(playlist.title) > 0: title = playlist.title # + ' - (' + playlist.URL + ')' else: title = playlist.URL #remove the [COLOR] tags from the title as Boxee doesn't seem to support them #todo: this still strips out >> and following from labels but it's better than nothing reg1 = "(\[.*?\])" title = re.sub(reg1, '', title) stackitem = mc.ListItem() stackitem.SetProperty("URL", mediaitem.URL) stackitem.SetProperty("listtitle", title) stackitem.SetProperty("view", playlist.view) #stackitem.SetProperty("focusseditem", mc.GetWindow(14000).GetList(GetListView()).GetFocusedItem()) #set the background image m = playlist.background if (m == 'default') or (m == 'previous'): #default BG image stackitem.SetProperty("bgimage", imageDir + background_image1) else: stackitem.SetProperty("bgimage", playlist.background) stacklist = mc.ListItems() stacklist.append(stackitem) mc.GetWindow(14000).GetList(555).SetItems(stacklist) today = datetime.date.today() ## CPlayList -> mc.ListItems for i in range(0, playlist.size()): m = playlist.list[i] if int(m.version) <= int(plxVersion): icon, thumb = getPlEntryThumb(m, playlist) # set label2 label2 = '' if m.date != '': l = m.date.split('-') entry_date = datetime.date(int(l[0]), int(l[1]), int(l[2])) days_past = (today - entry_date).days if days_past <= 10: if days_past <= 0: label2 = 'NEW today' elif days_past == 1: label2 = 'NEW yesterday' else: label2 = 'NEW (' + str(days_past) + ' days ago)' if m.description != '': label2 = label2 + ' >' item = mc.ListItem() item.SetLabel(m.name) if m.URL != "": item.SetPath(m.URL + " : " + m.processor) item.SetProperty('label2', label2) item.SetProperty('description', m.description) item.SetProperty('background', m.background) item.SetProperty('processor', m.processor) item.SetProperty('thumb', m.thumb) item.SetProperty('url', m.URL) item.SetProperty('rating', imageDir + "rating" + m.rating + ".png") item.SetProperty('media_type', m.type) if (m.thumb != 'default'): item.SetThumbnail(m.thumb) elif playlist.logo != 'none': item.SetThumbnail(playlist.logo) else: item.SetThumbnail(thumb) item.SetProperty('icon', icon) ##mc.ShowDialogOk("item", "Label = " + item.GetLabel() + "Icon = " + item.GetIcon() + "Thumb = " + item.GetThumbnail() ) listcontrol.append(item) if view != '': playlist.view = view newview = SetListView(playlist.view, passive=True) mc.GetWindow(14000).GetList(newview).SetItems( listcontrol) #set displayed list SetListView(playlist.view, passive=False) mc.GetWindow(14000).GetList(newview).SetFocus() mc.HideDialogWait() return 0
def ParsePlaylist(URL='', mediaitem=CMediaItem(), reload=True, view=''): if reload == False: listcontrol = mc.GetWindow(14000).GetList(GetListView()).GetItems() stackitem = mc.GetWindow(14000).GetList(555).GetItem(0) view = stackitem.GetProperty("view") SetListView(view) mc.GetWindow(14000).GetList(GetListView()).SetFocus() mc.GetWindow(14000).GetList(GetListView()).SetItems(listcontrol) #pos = stackitem.GetProperty("focusseditem") #mc.GetWindow(14000).GetList(GetListView()).SetFocusedItem(pos) return if URL != '': mediaitem=CMediaItem() mediaitem.URL = URL mediaitem.type = 'playlist' mc.ShowDialogWait() playlist = CPlayList() type = mediaitem.GetType() ##mc.ShowDialogOk("Debug", "Parse mediaitem of type " + type) listcontrol = mc.GetWindow(14000).GetList(GetListView()).GetItems() del listcontrol[:] #load the playlist if type == 'rss_flickr_daily': result = playlist.load_rss_flickr_daily(URL, mediaitem) elif type[0:3] == 'rss': result = playlist.load_rss_20(URL, mediaitem) elif type[0:4] == 'atom': result = playlist.load_atom_10(URL, mediaitem) elif type == 'opml': result = playlist.load_opml_10(URL, mediaitem) elif type == 'html_youtube': result = playlist.load_html_youtube(URL, mediaitem) elif type == 'xml_shoutcast': result = playlist.load_xml_shoutcast(URL, mediaitem) elif type == 'xml_applemovie': result = playlist.load_xml_applemovie(URL, mediaitem) elif type == 'directory': result = playlist.load_dir(URL, mediaitem) else: #assume playlist file result = playlist.load_plx(URL, mediaitem) ### playlist.save(RootDir + 'source.plx') if result == -1: #error mc.ShowDialogOk("Error", "This playlist requires a newer Navi-X version") elif result == -2: #error mc.ShowDialogOk("Error", "Cannot open file.") if result != 0: #failure return -1 #display the new URL on top of the screen if len(playlist.title) > 0: title = playlist.title # + ' - (' + playlist.URL + ')' else: title = playlist.URL #remove the [COLOR] tags from the title as Boxee doesn't seem to support them #todo: this still strips out >> and following from labels but it's better than nothing reg1 = "(\[.*?\])" title = re.sub(reg1, '', title) stackitem = mc.ListItem() stackitem.SetProperty("URL", mediaitem.URL) stackitem.SetProperty("listtitle", title) stackitem.SetProperty("view", playlist.view) #stackitem.SetProperty("focusseditem", mc.GetWindow(14000).GetList(GetListView()).GetFocusedItem()) #set the background image m = playlist.background if (m == 'default') or (m == 'previous'): #default BG image stackitem.SetProperty("bgimage",imageDir + background_image1) else: stackitem.SetProperty("bgimage",playlist.background) stacklist = mc.ListItems() stacklist.append(stackitem) mc.GetWindow(14000).GetList(555).SetItems(stacklist) today=datetime.date.today() ## CPlayList -> mc.ListItems for i in range(0, playlist.size()): m = playlist.list[i] if int(m.version) <= int(plxVersion): icon, thumb = getPlEntryThumb(m, playlist) # set label2 label2='' if m.date != '': l=m.date.split('-') entry_date = datetime.date(int(l[0]), int(l[1]), int(l[2])) days_past = (today-entry_date).days if days_past <= 10: if days_past <= 0: label2 = 'NEW today' elif days_past == 1: label2 = 'NEW yesterday' else: label2 = 'NEW ('+ str(days_past) + ' days ago)' if m.description != '': label2 = label2 + ' >' item = mc.ListItem() item.SetLabel(m.name) if m.URL != "": item.SetPath(m.URL + " : " + m.processor ) item.SetProperty('label2', label2) item.SetProperty('description', m.description) item.SetProperty('background', m.background) item.SetProperty('processor', m.processor ) item.SetProperty('thumb', m.thumb) item.SetProperty('url', m.URL ) item.SetProperty('rating', imageDir + "rating" + m.rating + ".png" ) item.SetProperty('media_type', m.type) if (m.thumb != 'default'): item.SetThumbnail(m.thumb) elif playlist.logo != 'none': item.SetThumbnail(playlist.logo) else: item.SetThumbnail(thumb) item.SetProperty('icon', icon) ##mc.ShowDialogOk("item", "Label = " + item.GetLabel() + "Icon = " + item.GetIcon() + "Thumb = " + item.GetThumbnail() ) listcontrol.append(item) if view != '': playlist.view = view newview = SetListView(playlist.view, passive=True) mc.GetWindow(14000).GetList(newview).SetItems(listcontrol) #set displayed list SetListView(playlist.view, passive=False) mc.GetWindow(14000).GetList(newview).SetFocus() mc.HideDialogWait() return 0
def ParsePlaylist(mediaitem=CMediaItem() , proxy="CACHING"): playlist = CPlayList() type=mediaitem.type URL='' #load the playlist if type == 'rss_flickr_daily': result = playlist.load_rss_flickr_daily(URL, mediaitem, proxy) elif type[0:3] == 'rss': result = playlist.load_rss_20(URL, mediaitem, proxy) elif type == 'html_youtube': result = playlist.load_html_youtube(URL, mediaitem, proxy) elif type == 'xml_shoutcast': result = playlist.load_xml_shoutcast(URL, mediaitem, proxy) elif type == 'xml_applemovie': result = playlist.load_xml_applemovie(URL, mediaitem, proxy) elif type == 'directory': result = playlist.load_dir(URL, mediaitem, proxy) else: #assume playlist file result = playlist.load_plx(URL, mediaitem, proxy) if result == -1: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "This playlist requires a newer Navi-X version") elif result == -2: #error dialog = xbmcgui.Dialog() dialog.ok("Error", "The requested file could not be opened.") if result != 0: #failure return -1 #succesful playlist.save(RootDir + 'source.plx') today=datetime.date.today() #fill the main list xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_NONE) #xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL) for m in playlist.list: if m.thumb != 'default': thumb = m.thumb ## loader = CFileLoader2() ## ext = getFileExtension(m.thumb) ## loader.load(m.thumb, cacheDir + "thumb." + ext, timeout=1, proxy="ENABLED", content_type='image') ## if loader.state == 0: ## thumb = loader.localfile ## else: ## thumb = getPlEntryThumb(m.type) else: thumb = getPlEntryThumb(m.type) label2 = '' if m.date != '': l=m.date.split('-') entry_date = datetime.date(int(l[0]), int(l[1]), int(l[2])) days_past = (today-entry_date).days if days_past <= 10: if days_past <= 0: label2 = ' NEW today' elif days_past == 1: label2 = ' NEW yesterday' else: label2 = ' NEW ('+ str(days_past) + ' days ago)' folder=False if (m.type == 'playlist') or (m.type == 'rss') or\ (m.type == 'rss_flickr_daily') or (m.type == 'html_youtube') or \ (m.type == 'xml_applemovie') or (m.type == 'directory') or \ (m.type == 'xml_shoutcast') or (m.type == 'search_shoutcast') or \ (m.type == 'search_youtube') or (m.type == 'search'): folder = True desc='' if m.description: desc=m.description item = xbmcgui.ListItem(urllib.unquote_plus(unicode(urllib.quote_plus(m.name+label2), "utf-8" )), iconImage=thumb, thumbnailImage=thumb) item.setInfo( type=m.type, infoLabels={ "Title": m.name , "Plot": desc } ) URL = sys.argv[0] + "?mode=0&name=" + urllib.quote_plus(m.name) + \ "&type=" + urllib.quote_plus(m.type) + \ "&url=" + urllib.quote_plus(m.URL) + \ "&processor=" + urllib.quote_plus(m.processor) + \ "&date=" + urllib.quote_plus(m.date) xbmcplugin.addDirectoryItem(int(sys.argv[1]), URL, item, folder, playlist.size()) #addSortMethod #xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_PLAYLIST_ORDER) return 0 #success