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(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