def search_songs(query): curr_time=int(round(time.time() * 1000)) token=xbmcgui.Window(10000).getProperty("token") headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/song_ratings/favorites','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-CSRF-Token': token, 'X-Requested-With': 'XMLHttpRequest'} url = 'http://www.jango.com/artists/search?search=%s&search_type=song' % (urllib.quote_plus(query)) net.set_cookies(cookie_jar) link = net.http_GET(url,headers=headers).content.encode("utf-8").replace('\n','') net.save_cookies(cookie_jar) songs=regex_get_all(link,'<li class="song_li artist_song_li">','</li>') for s in songs: artist=regex_from_to(s,'class="block">','</a>') try: songname=regex_from_to(s,'title="Play ','"').replace(' Now!','')#video_id":" vurl=regex_from_to(s,'video_id":"','"') songid=regex_from_to(s,'trid":',',') except: songname=regex_from_to(s,'<div class="song_name" >','</div>').strip() vurl="NA" try: songid=regex_from_to(s,'song_id=','"') except:songid="na" iconimage='https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url='plugin://plugin.video.youtube/play/?video_id=' + vurl title="%s - %s" % (artist,songname) if songid!="na": if vurl=="NA": addDirAudio(clean_file_name(title, use_blanks=False) + " (audio)",songid,13,iconimage,songname,artist,'na','na',vurl) else: addDirAudio(clean_file_name(title, use_blanks=False) + " (video)",url,12,iconimage,songname,artist,'na','na',vurl)
def song_history(url,page): nextpage=int(page)+1 url='http://www.jango.com/users/%s/full_history?page=%s' % (xbmcgui.Window(10000).getProperty("user_id"),page) headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/song_ratings/favorites','X-XHR-Referer': 'http://www.jango.com/song_ratings/favorites','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'text/html, application/xhtml+xml, application/xml', 'X-Requested-With': 'XMLHttpRequest'} net.set_cookies(cookie_jar) link = net.http_GET(url,headers=headers).content.encode("utf-8").replace('\n','').replace("'",'"') net.save_cookies(cookie_jar) songs=regex_get_all(link,'<li class="song_li artist_song_li">','</li>') for s in songs: artist=regex_from_to(s,'class="block">','</a>') try: songname=regex_from_to(s,'title="Play ','"').replace(' Now!','')#video_id":" vurl=regex_from_to(s,'video_id":"','"') songid=regex_from_to(s,'trid":',',') except: songname=regex_from_to(s,'<div class="song_name" >','</div>').strip() vurl="NA" try: songid=regex_from_to(s,'song_id=','"') except:songid="na" iconimage='https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url='plugin://plugin.video.youtube/play/?video_id=' + vurl title="%s - %s" % (artist,songname) if songid!="na": if vurl=="NA": addDirAudio(clean_file_name(title, use_blanks=False) + " (audio)",songid,13,iconimage,songname,artist,'na','na',vurl) else: addDirAudio(clean_file_name(title, use_blanks=False) + " (video)",url,12,iconimage,songname,artist,'na','na',vurl) addDir('>> Next Page','http://www.jango.com/my_song_history',9952,art + 'icon_next_page.jpg',str(nextpage),'')
def favourite_tracks(name, url, page): if 'Banned' in name: tt = 'ban' url = 'http://www.jango.com/song_ratings/bans?page=%s' % page else: tt = 'fav' url = 'http://www.jango.com/song_ratings/favorites?page=%s' % page nextpage = int(page) + 1 refurl = 'http://www.jango.com/profiles/%s?ft=1' % xbmcgui.Window( 10000).getProperty("user_id") headers = { 'Host': 'www.jango.com', 'Referer': refurl, 'X-XHR-Referer': refurl } net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").rstrip() net.save_cookies(cookie_jar) if tt == 'ban': songs = regex_get_all(link, '<li id="ban', '</li>') else: songs = regex_get_all(link, '<li id="fav', '</li>') for s in songs: artist = regex_from_to(s, 'class="block">', '</a>') try: songname = regex_from_to(s, 'title="Play ', '"').replace(' Now!', '') #video_id":" vurl = regex_from_to(s, 'video_id":"', '"') songid = regex_from_to(s, 'song_id=', '"') except: songname = regex_from_to(s, '<div class="song_name" >', '</div>').strip() vurl = "NA" try: songid = regex_from_to(s, 'song_id=', '"') except: songid = "na" iconimage = 'https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url = 'plugin://plugin.video.youtube/play/?video_id=' + vurl title = "%s - %s" % (artist, songname) if songid != "na": if vurl == "NA": addDirAudio( clean_file_name(title, use_blanks=False) + " (audio)", songid, 13, iconimage, songname, artist, songid, tt, vurl) else: addDirAudio( clean_file_name(title, use_blanks=False) + " (video)", url, 12, iconimage, songname, artist, songid, tt, vurl) addDir('Next page - ' + name, 'url', 9950, art + 'topalbums.jpg', str(nextpage), '')
def song_history(url, page): nextpage = int(page) + 1 url = 'http://www.jango.com/users/%s/full_history?page=%s' % ( xbmcgui.Window(10000).getProperty("user_id"), page) headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/song_ratings/favorites', 'X-XHR-Referer': 'http://www.jango.com/song_ratings/favorites', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'text/html, application/xhtml+xml, application/xml', 'X-Requested-With': 'XMLHttpRequest' } net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace( '\n', '').replace("'", '"') net.save_cookies(cookie_jar) songs = regex_get_all(link, '<li class="song_li artist_song_li">', '</li>') for s in songs: artist = regex_from_to(s, 'class="block">', '</a>') try: songname = regex_from_to(s, 'title="Play ', '"').replace(' Now!', '') #video_id":" vurl = regex_from_to(s, 'video_id":"', '"') songid = regex_from_to(s, 'trid":', ',') except: songname = regex_from_to(s, '<div class="song_name" >', '</div>').strip() vurl = "NA" try: songid = regex_from_to(s, 'song_id=', '"') except: songid = "na" iconimage = 'https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url = 'plugin://plugin.video.youtube/play/?video_id=' + vurl title = "%s - %s" % (artist, songname) if songid != "na": if vurl == "NA": addDirAudio( clean_file_name(title, use_blanks=False) + " (audio)", songid, 13, iconimage, songname, artist, 'na', 'na', vurl) else: addDirAudio( clean_file_name(title, use_blanks=False) + " (video)", url, 12, iconimage, songname, artist, 'na', 'na', vurl) addDir('>> Next Page', 'http://www.jango.com/my_song_history', 9952, art + 'icon_next_page.jpg', str(nextpage), '')
def search_songs(query): curr_time = int(round(time.time() * 1000)) token = xbmcgui.Window(10000).getProperty("token") headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/song_ratings/favorites', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-CSRF-Token': token, 'X-Requested-With': 'XMLHttpRequest' } url = 'http://www.jango.com/artists/search?search=%s&search_type=song' % ( urllib.quote_plus(query)) net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace( '\n', '') net.save_cookies(cookie_jar) songs = regex_get_all(link, '<li class="song_li artist_song_li">', '</li>') for s in songs: artist = regex_from_to(s, 'class="block">', '</a>') try: songname = regex_from_to(s, 'title="Play ', '"').replace(' Now!', '') #video_id":" vurl = regex_from_to(s, 'video_id":"', '"') songid = regex_from_to(s, 'trid":', ',') except: songname = regex_from_to(s, '<div class="song_name" >', '</div>').strip() vurl = "NA" try: songid = regex_from_to(s, 'song_id=', '"') except: songid = "na" iconimage = 'https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url = 'plugin://plugin.video.youtube/play/?video_id=' + vurl title = "%s - %s" % (artist, songname) if songid != "na": if vurl == "NA": addDirAudio( clean_file_name(title, use_blanks=False) + " (audio)", songid, 13, iconimage, songname, artist, 'na', 'na', vurl) else: addDirAudio( clean_file_name(title, use_blanks=False) + " (video)", url, 12, iconimage, songname, artist, 'na', 'na', vurl)
def search_artists(query): curr_time = int(round(time.time() * 1000)) token = xbmcgui.Window(10000).getProperty("token") headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/song_ratings/favorites', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-CSRF-Token': token, 'X-Requested-With': 'XMLHttpRequest' } url = 'http://www.jango.com/artists/jsearch?term=%s&cb=play&source=header&_=%s' % ( urllib.quote_plus(query), str(curr_time)) net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace( '\n', '') net.save_cookies(cookie_jar) match = re.compile( '{"label":"(.+?)","value":"(.+?)","id":(.+?),"url":"(.+?)","station_id":(.+?)}' ).findall(link) for label, value, id, url, stid in match: url = 'http://www.jango.com' + url addDir(clean_file_name(value, use_blanks=False), url, 10, iconart, token, stid)
def sub_sections(name, url, token): url = url.replace(' ', '+') curr_time = int(round(time.time() * 1000)) url = "%s&_=%s" % (url, curr_time) headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/browse_music', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept': '*/*', 'X-CSRF-Token': token } net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace( '\n', '').replace("'", '"') net.save_cookies(cookie_jar) all_sub = regex_get_all(link, '<div class="genre_station', '<hr class="list_divider"/>') for a in all_sub: title = regex_from_to(a, 'play"></span></span>', '</a>') stid = regex_from_to(a, 'href="/stations/', '/') url = 'http://www.jango.com/stations/%s/tunein' % stid iconimage = 'http:' + regex_from_to(a, 'data-original="', '"').replace( '_sm', '_lg') addDir(clean_file_name(title, use_blanks=False), url, 10, iconimage, token, stid)
def tv_show_episodes(name, list, iconimage, showname): list = str(list) site = regex_from_to(showname,'ZZ', 'YY') splitshnm = showname.split('YY') showname = splitshnm[1] episodes = re.compile('<a title="(.+?)" href="(.+?)"> <div class="(.+?)data-original="(.+?)"(.+?)nseasnumep"> (.+?) <br(.+?)>(.+?) </div> </div> </a>').findall(list) for epname, url, a, thumb, b, snum, c, epnum in episodes: url = 'http://www.watch-tvseries.' + site + url epnum = epnum.replace('episode ', 'E') snum = snum.replace('season ', 'S') sn = snum.replace('S0','') if epnum.startswith('E0'): en = epnum.replace('E0', '') else: en = epnum.replace('E', '') name = "%s%s - %s" % (snum, epnum, clean_file_name(epname)) if ENABLE_META: infoLabels=get_meta(showname,'episode',year=None,season=sn,episode=en) if infoLabels['title']=='': name = name else: name = "%s%s %s" % (snum, epnum, infoLabels['title']) if infoLabels['cover_url']=='': iconimage=thumb else: iconimage=infoLabels['cover_url'] else: infoLabels =None iconimage=iconart if AUTOPLAY: addDirPlayable(name,url,5,iconimage, showname,infoLabels=infoLabels) else: addDir(name,url,20,iconimage, showname, showname,infoLabels=infoLabels) setView('episodes', 'episodes-view')
def station_history(page): nextpage = int(page) + 1 refurl = 'http://www.jango.com/users/%s/stations?page=%s' % ( xbmcgui.Window(10000).getProperty("user_id"), page) headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/song_ratings/favorites', 'X-XHR-Referer': 'http://www.jango.com/song_ratings/favorites', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'text/html, application/xhtml+xml, application/xml', 'X-Requested-With': 'XMLHttpRequest' } net.set_cookies(cookie_jar) link = net.http_GET(refurl, headers=headers).content.encode("utf-8").replace( '\n', '').replace("'", '"') net.save_cookies(cookie_jar) token = xbmcgui.Window(10000).getProperty("token") all_sub = regex_get_all(link, '<div class="genre_station', '<hr class="list_divider"/>') for a in all_sub: title = regex_from_to(a, 'play"></span></span>', '</a>') stid = regex_from_to(a, 'href="/stations/', '/') url = 'http://www.jango.com/stations/%s/tunein' % stid iconimage = 'http:' + regex_from_to(a, 'data-original="', '"').replace( '_sm', '_lg') addDir(clean_file_name(title, use_blanks=False), url, 10, iconimage, token, stid) addDir('Next page', 'url', 9951, art + 'icon_next_page.jpg', str(nextpage), '')
def music_sections(name, url): headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/browse_music', 'X-XHR-Referer': 'http://www.jango.com/browse_music' } net.set_cookies(cookie_jar) link = net.http_GET(url).content.replace('\n', '') net.save_cookies(cookie_jar) token = xbmcgui.Window(10000).getProperty("token") match = re.compile( '<li id="(.+?)" class="(.+?)"><a data-no-turbolink href="(.+?)" data-genre-category="(.+?)" title="(.+?)">(.+?)</a></li>' ).findall(link) addDir( "Suggestions", 'http://www.jango.com/stations/genre_category?gcid=suggestions&_=1445381979609', 3, iconart, token, '') addDir( "Recent Stations", 'http://www.jango.com/stations/genre_category?gcid=recent&_=1445381979609', 3, iconart, token, '') for d1, cl, url, cat, title, title2 in match: id = url.replace('/browse_music?gcid=', '') url = 'http://www.jango.com/stations/genre_category?gcid=%s' % id addDir(clean_file_name(title, use_blanks=False), url, 3, iconart, token, '')
def create_tv_show_strm_files(name, url, iconimage, ntf): epurl = url.replace('http', 'hhhh') dialog = xbmcgui.Dialog() n = name u = url l = iconimage list_data = iconimage.replace('hhhh', 'http:') splitdata = iconimage.split('QQ') name = splitdata[0] name = name.replace('->-', ' & ') thumb = splitdata[2] tv_show_path = create_directory(TV_PATH, name) link = open_url(url).strip().replace('\n', '').replace('\t', '').replace( '?', '<>').replace('#', '$') if 'SHOW EPISODES' in link: episodes = regex_from_to(link, 'SHOW EPISODES</a', '<div class="advert') all_episodes = re.compile( '<div class="number left">(.+?)</div><div class="name left"> (.+?)</div><div class="edate left">(.+?)</div> <div class="link left"><a class="watch_all" href="(.+?)">Watch NOW' ).findall(episodes) if iconimage == 'missing': iconimage = regex_from_to(link, '<div class="cover"><a href="', '"') else: iconimage = thumb season = regex_get_all(link, '688px;">', '<a data-season') for s in season: season = regex_from_to(s, '688px;">', '<a data-season').rstrip() seasonnum = season.replace("Season ", "") season_path = create_directory(tv_show_path, str(seasonnum)) for epnum, epname, epdate, url in all_episodes: iconimage = regex_from_to(link, '<div class="cover"><a href="', '"') snum = regex_from_to(url, 'season=', '&episode') epnum = epnum.replace('Episode ', '') url = epurl.replace('hhhh', 'http') + url.replace( "<>", "?").replace("$", "#").replace("aNd", "&").replace( 'href="', '') display = "%sx%s - %s" % (snum, epnum, clean_file_name(epname)) if snum == seasonnum: create_strm_file(display, url, "3", season_path, iconimage.replace('hhhh', 'http:'), name) if ntf == "true" and ENABLE_SUBS: if dialog.yesno( "Subscribe?", 'Do you want MovieStorm to automatically add new', '[COLOR gold]' + name + '[/COLOR]' + ' episodes when available?'): add_favourite(n, u, l, SUB, "Added to Library/Subscribed") else: notification(name, "[COLOR lime]Added to Library[/COLOR]", '5000', thumb) if xbmc.getCondVisibility('Library.IsScanningVideo') == False: xbmc.executebuiltin('UpdateLibrary(video)') else: create_strm_file(n, u, "3", MOVIE_PATH, thumb.replace('hhhh', 'http:'), n) if xbmc.getCondVisibility('Library.IsScanningVideo') == False: xbmc.executebuiltin('UpdateLibrary(video)')
def create_strm_file(name, url, mode, dir_path, iconimage, showname): try: strm_string = create_url(name, mode, url=url, iconimage=iconimage, showname=showname) filename = clean_file_name("%s.strm" % name) path = os.path.join(dir_path, filename) if not os.path.exists(path): stream_file = open(path, 'w') stream_file.write(strm_string) stream_file.close() except: xbmc.log("[TVonline] Error while creating strm file for : " + name)
def create_strm_file(name, url, mode, dir_path, iconimage, showname): try: strm_string = create_url(name, mode, url=url, iconimage=iconimage, showname=showname) filename = clean_file_name("%s.strm" % name) path = os.path.join(dir_path, filename) if not os.path.exists(path): stream_file = open(path, 'w') stream_file.write(strm_string) stream_file.close() except: xbmc.log("[TV4ME] Error while creating strm file for : " + name)
def tv_show_episodes(name, list, iconimage, showname,epurl): seasonnum = name.replace('Season ', '') episodes = regex_from_to(list, 'SHOW EPISODES</a', '<div class="advert') all_episodes = re.compile('<div class="number left"><a style="(.+?)" href="(.+?)">(.+?)</a></div><div class="name left"> <a href="(.+?)">(.+?)</a></div><div class="edate left">(.+?)</div>').findall(episodes) for d1,url,epnum,url2,epname,epdate in all_episodes: snum = regex_from_to(url, 'season-', '/') epnum = epnum.replace('Episode ', '') url = epurl.replace('hhhh', 'http') + url.replace("<>", "?").replace("$", "#").replace("aNd", "&").replace('hhhh', 'http').replace('href="', '') name = "%sx%s - %s - %s" % (snum, epnum, clean_file_name(epname),epdate) if snum == seasonnum: addDirPlayable(name,url,3,iconimage, showname) setView('episodes', 'episodes-view')
def search_artists(query): curr_time=int(round(time.time() * 1000)) token=xbmcgui.Window(10000).getProperty("token") headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/song_ratings/favorites','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-CSRF-Token': token, 'X-Requested-With': 'XMLHttpRequest'} url = 'http://www.jango.com/artists/jsearch?term=%s&cb=play&source=header&_=%s' % (urllib.quote_plus(query),str(curr_time)) net.set_cookies(cookie_jar) link = net.http_GET(url,headers=headers).content.encode("utf-8").replace('\n','') net.save_cookies(cookie_jar) match=re.compile('{"label":"(.+?)","value":"(.+?)","id":(.+?),"url":"(.+?)","station_id":(.+?)}').findall(link) for label,value,id,url,stid in match: url='http://www.jango.com' + url addDir(clean_file_name(value, use_blanks=False),url,10,iconart,token,stid)
def music_sections(name, url): headers = {'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/browse_music', 'X-XHR-Referer': 'http://www.jango.com/browse_music'} net.set_cookies(cookie_jar) link = net.http_GET(url).content.replace('\n','') net.save_cookies(cookie_jar) token=xbmcgui.Window(10000).getProperty("token") match=re.compile('<li id="(.+?)" class="(.+?)"><a data-no-turbolink href="(.+?)" data-genre-category="(.+?)" title="(.+?)">(.+?)</a></li>').findall(link) addDir("Suggestions",'http://www.jango.com/stations/genre_category?gcid=suggestions&_=1445381979609',3,iconart,token,'') addDir("Recent Stations",'http://www.jango.com/stations/genre_category?gcid=recent&_=1445381979609',3,iconart,token,'') for d1,cl,url,cat,title,title2 in match: id = url.replace('/browse_music?gcid=','') url='http://www.jango.com/stations/genre_category?gcid=%s' % id addDir(clean_file_name(title, use_blanks=False),url,3,iconart,token,'')
def favourite_tracks(name,url,page): if 'Banned' in name: tt='ban' url='http://www.jango.com/song_ratings/bans?page=%s' % page else: tt='fav' url='http://www.jango.com/song_ratings/favorites?page=%s' % page nextpage=int(page)+1 refurl='http://www.jango.com/profiles/%s?ft=1' % xbmcgui.Window(10000).getProperty("user_id") headers = {'Host': 'www.jango.com', 'Referer': refurl, 'X-XHR-Referer': refurl} net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").rstrip() net.save_cookies(cookie_jar) if tt=='ban': songs=regex_get_all(link,'<li id="ban','</li>') else: songs=regex_get_all(link,'<li id="fav','</li>') for s in songs: artist=regex_from_to(s,'class="block">','</a>') try: songname=regex_from_to(s,'title="Play ','"').replace(' Now!','')#video_id":" vurl=regex_from_to(s,'video_id":"','"') songid=regex_from_to(s,'song_id=','"') except: songname=regex_from_to(s,'<div class="song_name" >','</div>').strip() vurl="NA" try: songid=regex_from_to(s,'song_id=','"') except:songid="na" iconimage='https://i.ytimg.com/vi/%s/mqdefault.jpg' % vurl url='plugin://plugin.video.youtube/play/?video_id=' + vurl title="%s - %s" % (artist,songname) if songid!="na": if vurl=="NA": addDirAudio(clean_file_name(title, use_blanks=False) + " (audio)",songid,13,iconimage,songname,artist,songid,tt,vurl) else: addDirAudio(clean_file_name(title, use_blanks=False) + " (video)",url,12,iconimage,songname,artist,songid,tt,vurl) addDir('Next page - '+name,'url',9950,art + 'topalbums.jpg',str(nextpage),'')
def sub_sections(name, url, token): url=url.replace(' ','+') curr_time=int(round(time.time() * 1000)) url="%s&_=%s" % (url,curr_time) headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/browse_music','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept': '*/*', 'X-CSRF-Token': token} net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace('\n','').replace("'",'"') net.save_cookies(cookie_jar) all_sub=regex_get_all(link,'<div class="genre_station','<hr class="list_divider"/>') for a in all_sub: title=regex_from_to(a,'play"></span></span>','</a>') stid=regex_from_to(a,'href="/stations/','/') url='http://www.jango.com/stations/%s/tunein' % stid iconimage='http:' + regex_from_to(a,'data-original="','"').replace('_sm','_lg') addDir(clean_file_name(title, use_blanks=False),url,10,iconimage,token,stid)
def station_history(page): nextpage=int(page)+1 refurl='http://www.jango.com/users/%s/stations?page=%s' % (xbmcgui.Window(10000).getProperty("user_id"),page) headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/song_ratings/favorites','X-XHR-Referer': 'http://www.jango.com/song_ratings/favorites','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'text/html, application/xhtml+xml, application/xml', 'X-Requested-With': 'XMLHttpRequest'} net.set_cookies(cookie_jar) link = net.http_GET(refurl,headers=headers).content.encode("utf-8").replace('\n','').replace("'",'"') net.save_cookies(cookie_jar) token=xbmcgui.Window(10000).getProperty("token") all_sub=regex_get_all(link,'<div class="genre_station','<hr class="list_divider"/>') for a in all_sub: title=regex_from_to(a,'play"></span></span>','</a>') stid=regex_from_to(a,'href="/stations/','/') url='http://www.jango.com/stations/%s/tunein' % stid iconimage='http:' + regex_from_to(a,'data-original="','"').replace('_sm','_lg') addDir(clean_file_name(title, use_blanks=False),url,10,iconimage,token,stid) addDir('Next page','url',9951,art + 'icon_next_page.jpg',str(nextpage),'')
def tv_show_episodes(name, list, iconimage, showname, epurl): seasonnum = name.replace('Season ', '') episodes = regex_from_to(list, 'SHOW EPISODES</a', '<div class="advert') all_episodes = re.compile( '<div class="number left"><a style="(.+?)" href="(.+?)">(.+?)</a></div><div class="name left"> <a href="(.+?)">(.+?)</a></div><div class="edate left">(.+?)</div>' ).findall(episodes) for d1, url, epnum, url2, epname, epdate in all_episodes: snum = regex_from_to(url, 'season-', '/') epnum = epnum.replace('Episode ', '') url = epurl.replace('hhhh', 'http') + url.replace("<>", "?").replace( "$", "#").replace("aNd", "&").replace('hhhh', 'http').replace( 'href="', '') name = "%sx%s - %s - %s" % (snum, epnum, clean_file_name(epname), epdate) if snum == seasonnum: addDirPlayable(name, url, 3, iconimage, showname) setView('episodes', 'episodes-view')
def create_tv_show_strm_files(name, url, iconimage, ntf): epurl = url.replace('http', 'hhhh') dialog = xbmcgui.Dialog() n = name u = url l = iconimage list_data = iconimage.replace('hhhh', 'http:') splitdata = iconimage.split('QQ') name = splitdata[0] name = name.replace('->-', ' & ') thumb = splitdata[2] tv_show_path = create_directory(TV_PATH, name) link = open_url(url).strip().replace('\n', '').replace('\t', '').replace('?', '<>').replace('#', '$') if 'SHOW EPISODES' in link: episodes = regex_from_to(link, 'SHOW EPISODES</a', '<div class="advert') all_episodes = re.compile('<div class="number left">(.+?)</div><div class="name left"> (.+?)</div><div class="edate left">(.+?)</div> <div class="link left"><a class="watch_all" href="(.+?)">Watch NOW').findall(episodes) if iconimage == 'missing': iconimage = regex_from_to(link, '<div class="cover"><a href="', '"') else: iconimage = thumb season = regex_get_all(link, '688px;">', '<a data-season') for s in season: season = regex_from_to(s, '688px;">', '<a data-season').rstrip() seasonnum = season.replace("Season ", "") season_path = create_directory(tv_show_path, str(seasonnum)) for epnum, epname, epdate, url in all_episodes: iconimage = regex_from_to(link, '<div class="cover"><a href="', '"') snum = regex_from_to(url, 'season=', '&episode') epnum = epnum.replace('Episode ', '') url = epurl.replace('hhhh', 'http') + url.replace("<>", "?").replace("$", "#").replace("aNd", "&").replace('href="', '') display = "%sx%s - %s" % (snum, epnum, clean_file_name(epname)) if snum == seasonnum: create_strm_file(display, url, "3", season_path, iconimage.replace('hhhh', 'http:'), name) if ntf == "true" and ENABLE_SUBS: if dialog.yesno("Subscribe?", 'Do you want MovieStorm to automatically add new', '[COLOR gold]' + name + '[/COLOR]' + ' episodes when available?'): add_favourite(n, u, l, SUB, "Added to Library/Subscribed") else: notification(name, "[COLOR lime]Added to Library[/COLOR]", '5000', thumb) if xbmc.getCondVisibility('Library.IsScanningVideo') == False: xbmc.executebuiltin('UpdateLibrary(video)') else: create_strm_file(n, u, "3", MOVIE_PATH, thumb.replace('hhhh', 'http:'), n) if xbmc.getCondVisibility('Library.IsScanningVideo') == False: xbmc.executebuiltin('UpdateLibrary(video)')
def get_meta(name, types=None, year=None, season=None, episode=None, imdb=None, episode_title=None): if 'movie' in types: meta = metainfo.get_meta('movie', clean_file_name(name, use_blanks=False), year) infoLabels = { 'rating': meta['rating'], 'genre': meta['genre'], 'mpaa': "rated %s" % meta['mpaa'], 'plot': meta['plot'], 'title': meta['title'], 'cover_url': meta['cover_url'], 'fanart': meta['backdrop_url'], 'Aired': meta['premiered'], 'year': meta['year'] } return infoLabels
def play_song(url, name, token, iconimage, stid, clear, skip): userid = xbmcgui.Window(10000).getProperty("user_id") if len(userid) > 4: uid = '&uid=%s' % userid else: uid = '' curr_time = int(round(time.time() * 1000)) origurl = url origtoken = token pl = get_XBMCPlaylist(clear) playlist = [] contenttime = xbmcgui.Window(10000).getProperty("contenttime") sid = xbmcgui.Window(10000).getProperty("sid") headers = { 'Host': 'www.jango.com', 'Referer': 'http://www.jango.com/song_ratings/favorites', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest' } if clear: f = open(ACTIVEPL, 'w') f.close url = 'http://www.jango.com/stations/%s/play?_=%s' % (stid, curr_time) elif skip: url = 'http://www.jango.com/streams/info?sid=%s%s&stid=%s&ver=11&skipped=1&cb=%s&_=%s' % ( sid, uid, stid, curr_time, contenttime) else: url = 'http://www.jango.com/streams/info?sid=%s%s&stid=%s&ver=11&next=1&cb=%s&_=%s' % ( sid, uid, stid, curr_time, contenttime) net.set_cookies(cookie_jar) link = net.http_GET(url, headers=headers).content.encode("utf-8").replace( '\n', '') net.save_cookies(cookie_jar) url = 'http:' + regex_from_to(link, '"url":"', '"') artist = regex_from_to(link, 'artist":"', '"') artistid = regex_from_to(link, 'artist_id":', ',"') artistlink = "" songname = regex_from_to(link, 'song":"', '"') songid = regex_from_to(link, '"song_id":', ',"') genre = regex_from_to(link, '"genre":"', '"') similarartists = regex_from_to(link, 'similar_stations":', ']') try: videoid = regex_from_to(link, 'video_id":"', '"') except: videoid = "na" albumart = 'http:' + regex_from_to(link, 'album_art":"', ',"').replace( '_sm', '_xl') stationname = regex_from_to(link, 'station":"', '"') title = "%s | %s" % (artist, songname) PL_TEXT = "%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s" % ( title, url, albumart, songname, artist, stationname, songid, videoid, genre, artistlink) add_to_list(PL_TEXT, ACTIVEPL, False) addDir("[COLOR lime]" + stationname + " (edit station...)[/COLOR]", 'url', 99000, iconimage, 'na', 'na') addDirAudio("Previous Song", origurl, 16, iconimage, origtoken, stid, 'na', 'na', 'na') addDirAudio("Skip Song", origurl, 11, iconimage, origtoken, stid, 'na', 'na', 'na') addDir("View Playlist", origurl, 17, iconimage, origtoken, stid) addDirAudio("[COLOR cyan] Similar Stations[/COLOR]", 'url', 10000, iconimage, 'na', 'na', 'na', 'na', 'na') match = re.compile('"station_id":(.+?),"station_name":"(.+?)"').findall( similarartists) for s_stationid, s_stationname in match: s_url = 'http://www.jango.com/stations/%s/tunein' % s_stationid addDir(" " + clean_file_name(s_stationname, use_blanks=False), s_url, 10, iconimage, token, s_stationid) liz = xbmcgui.ListItem(songname, iconImage=iconimage, thumbnailImage=iconimage) liz.setInfo('music', { 'Title': songname, 'Artist': artist, 'Album': stationname }) liz.setProperty('mimetype', 'audio/mpeg') liz.setProperty("IsPlayable", "true") liz.setThumbnailImage(iconimage) if clear or ((xbmcgui.Window(10000).getProperty("station_id") == "" or xbmcgui.Window(10000).getProperty("station_id") == stid) and not clear): playlist.append((url, liz)) for blob, liz in playlist: try: if blob: pl.add(blob, liz) except: pass if clear: xbmc.Player().play(pl) xbmcgui.Window(10000).clearProperty("station_id") xbmcgui.Window(10000).setProperty("station_id", stid) playThread = play_timer(origurl, name, origtoken, iconimage, url, stid) playThread.start() if skip: xbmc.executebuiltin('XBMC.Playlist.PlayOffset(1)')
def play_song(url, name, token, iconimage,stid, clear, skip): userid=xbmcgui.Window(10000).getProperty("user_id") if len(userid)>4: uid='&uid=%s' % userid else: uid='' curr_time=int(round(time.time() * 1000)) origurl=url origtoken=token pl = get_XBMCPlaylist(clear) playlist=[] contenttime=xbmcgui.Window(10000).getProperty("contenttime") sid=xbmcgui.Window(10000).getProperty("sid") headers = {'Host': 'www.jango.com','Referer': 'http://www.jango.com/song_ratings/favorites','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest'} if clear: f = open(ACTIVEPL, 'w') f.close url='http://www.jango.com/stations/%s/play?_=%s' % (stid,curr_time) elif skip: url='http://www.jango.com/streams/info?sid=%s%s&stid=%s&ver=11&skipped=1&cb=%s&_=%s' % (sid,uid,stid,curr_time,contenttime) else: url='http://www.jango.com/streams/info?sid=%s%s&stid=%s&ver=11&next=1&cb=%s&_=%s' % (sid,uid,stid,curr_time,contenttime) net.set_cookies(cookie_jar) link = net.http_GET(url,headers=headers).content.encode("utf-8").replace('\n','') net.save_cookies(cookie_jar) url=regex_from_to(link,'"url":"','"') artist=regex_from_to(link,'artist":"','"') artistid=regex_from_to(link,'artist_id":',',"') artistlink=regex_from_to(link,'"artist_link":"','"') songname=regex_from_to(link,'song":"','"') songid=regex_from_to(link,'"song_id":',',"') genre=regex_from_to(link,'"genre":"','"') similarartists=regex_from_to(link,'similar_stations":',']') try: videoid=regex_from_to(link,'video_id":"','"') except: videoid="na" albumart='http:'+ regex_from_to(link,'album_art":"',',"').replace('_sm','_xl') stationname=regex_from_to(link,'station":"','"') title = "%s | %s" % (artist,songname) PL_TEXT="%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s<>%s" % (title,url,albumart,songname,artist,stationname,songid,videoid,genre,artistlink) add_to_list(PL_TEXT,ACTIVEPL,False) addDir("[COLOR lime]"+stationname+" (edit station...)[/COLOR]",'url',99000,iconimage,'na','na') addDirAudio("Previous Song",origurl,16,iconimage,origtoken,stid,'na','na','na') addDirAudio("Skip Song",origurl,11,iconimage,origtoken,stid,'na','na','na') addDir("View Playlist",origurl,17,iconimage,origtoken,stid) addDirAudio("[COLOR cyan] Similar Stations[/COLOR]",'url',10000,iconimage,'na','na','na','na','na') match=re.compile('"station_id":(.+?),"station_name":"(.+?)"').findall(similarartists) for s_stationid,s_stationname in match: s_url='http://www.jango.com/stations/%s/tunein' % s_stationid addDir(" "+clean_file_name(s_stationname, use_blanks=False),s_url,10,iconimage,token,s_stationid) liz=xbmcgui.ListItem(songname, iconImage=iconimage, thumbnailImage=iconimage) liz.setInfo('music', {'Title':songname, 'Artist':artist, 'Album':stationname }) liz.setProperty('mimetype', 'audio/mpeg') liz.setProperty("IsPlayable","true") liz.setThumbnailImage(iconimage) if clear or ((xbmcgui.Window(10000).getProperty("station_id")=="" or xbmcgui.Window(10000).getProperty("station_id")==stid) and not clear): playlist.append((url, liz)) for blob ,liz in playlist: try: if blob: pl.add(blob,liz) except: pass if clear: xbmc.Player().play(pl) xbmcgui.Window(10000).clearProperty("station_id") xbmcgui.Window(10000).setProperty("station_id", stid) playThread = play_timer(origurl,name,origtoken,iconimage,url,stid) playThread.start() if skip: xbmc.executebuiltin('XBMC.Playlist.PlayOffset(1)')
def view_trailer(name, url, iconimage): menu_texts = [] menu_data = [] menu_res = [] menu_list_item = [] title1 = name[:-6].rstrip() pDialog = xbmcgui.DialogProgress() pDialog.create('Searching for trailer') dialog = xbmcgui.Dialog() try: url = "http://www.hd-trailers.net/movie/" + title1.lower().replace( ' ', '-').replace(':', '-') response = open_url(url) match = re.compile( 'href="http://(.+?)" rel=(.+?)title="(.+?)">(.+?)</a></td>' ).findall(response) if len(match) == 0: url = "http://www.hd-trailers.net/movie/" + title1.lower().replace( ' ', '-').replace(':', '-').replace('and', '-') response = open_gurl(url) match = re.compile( 'href="http://(.+?)" rel=(.+?)title="(.+?)">(.+?)</a></td>' ).findall(response) if len(match) == 0: dialog.ok("Trailer Search", 'No trailers found for:', name) return for url, info, title, res in match: if url.find('apple') > 0: url = '%s|User-Agent=QuickTime' % ("http://" + url) elif url.find('youtube') > 0: video_id = url.replace('www.youtube.com/watch?v=', '') url = ('plugin://plugin.video.youtube/' '?action=play_video&videoid=%s' % video_id) else: url = "http://" + url if TRAILER_RESTRICT: if url.find('yahoo') < 0 and res == TRAILER_QUALITY: menu_texts.append( "[%s] %s" % (res, clean_file_name(title, use_blanks=False))) menu_list_item.append( clean_file_name(title, use_blanks=False)) menu_data.append(url) menu_res.append(res) else: if url.find('yahoo') < 0: menu_texts.append( "[%s] %s" % (res, clean_file_name(title, use_blanks=False))) menu_list_item.append( clean_file_name(title, use_blanks=False)) menu_data.append(url) menu_res.append(res) if TRAILER_ONECLICK: menu_id = 0 else: menu_id = dialog.select('Select Trailer', menu_texts) if (menu_id < 0): return (None, None) dialog.close() else: url = menu_data[menu_id] name = menu_texts[menu_id] list_item = menu_list_item[menu_id] pDialog.close() listitem = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage, path=url) xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO) handle = str(sys.argv[1]) if handle != "-1": listitem.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem) else: xbmcPlayer.play(url, listitem) except: dialog.ok("Trailer Search", 'No trailers found for:', name)
def get_meta(name,types=None,year=None,season=None,episode=None,imdb=None,episode_title=None): if 'movie' in types: meta = metainfo.get_meta('movie',clean_file_name(name, use_blanks=False),year) infoLabels = {'rating': meta['rating'],'genre': meta['genre'],'mpaa':"rated %s"%meta['mpaa'],'plot': meta['plot'],'title': meta['title'],'cover_url': meta['cover_url'],'fanart': meta['backdrop_url'],'Aired': meta['premiered'],'year': meta['year']} return infoLabels
def view_trailer(name, url, iconimage): menu_texts = [] menu_data = [] menu_res = [] menu_list_item = [] title1 = name[:-6].rstrip() pDialog = xbmcgui.DialogProgress() pDialog.create('Searching for trailer') dialog = xbmcgui.Dialog() try: url = "http://www.hd-trailers.net/movie/" + title1.lower().replace(' ','-').replace(':','-') response = open_url(url) match=re.compile('href="http://(.+?)" rel=(.+?)title="(.+?)">(.+?)</a></td>').findall(response) if len(match)==0: url = "http://www.hd-trailers.net/movie/" + title1.lower().replace(' ','-').replace(':','-').replace('and','-') response = open_gurl(url) match=re.compile('href="http://(.+?)" rel=(.+?)title="(.+?)">(.+?)</a></td>').findall(response) if len(match)==0: dialog.ok("Trailer Search", 'No trailers found for:', name) return for url, info, title, res in match: if url.find('apple')>0: url = '%s|User-Agent=QuickTime' % ("http://" + url) elif url.find('youtube')>0: video_id = url.replace('www.youtube.com/watch?v=','') url = ( 'plugin://plugin.video.youtube/' '?action=play_video&videoid=%s' % video_id ) else: url = "http://" + url if TRAILER_RESTRICT: if url.find('yahoo')<0 and res==TRAILER_QUALITY: menu_texts.append("[%s] %s" % (res, clean_file_name(title, use_blanks=False))) menu_list_item.append(clean_file_name(title, use_blanks=False)) menu_data.append(url) menu_res.append(res) else: if url.find('yahoo')<0: menu_texts.append("[%s] %s" % (res, clean_file_name(title, use_blanks=False))) menu_list_item.append(clean_file_name(title, use_blanks=False)) menu_data.append(url) menu_res.append(res) if TRAILER_ONECLICK: menu_id =0 else: menu_id = dialog.select('Select Trailer', menu_texts) if(menu_id < 0): return (None, None) dialog.close() else: url = menu_data[menu_id] name = menu_texts[menu_id] list_item = menu_list_item[menu_id] pDialog.close() listitem = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage, path=url) xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO) handle = str(sys.argv[1]) if handle != "-1": listitem.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem) else: xbmcPlayer.play(url, listitem) except: dialog.ok("Trailer Search", 'No trailers found for:', name)