def add_video(self,artist=False): common.log('[mvmixPlayer] add video') video_url = None loops = 0 while not video_url and not xbmc.abortRequested and self.is_active: self.set_artist() common.log('[mvmixPlayer] loops: %s' % str(loops)) common.log('[mvmixPlayer] artist: %s' % str(self.artist)) videos = __videos__.get_videos(self.artist) videos = self.remove_added_videos(videos) common.log('[mvmixPlayer] videos found: %s' % str(len(videos))) if videos: video = videos[random.randint(0,(len(videos)-1))] self.video_list.append(video) video_url = common.import_site(video['site']).get_video_url(video['id']) if video_url: artist = common.utf_enc(video['artist'][0]) title = common.utf_enc(video['title']) name = '%s - %s' % (artist,title) listitem = xbmcgui.ListItem(name, thumbnailImage=video['image']) self.playlist.add(video_url, listitem=listitem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) else: self.remove_artist_from_list() self.sleep(500) loops += 1 if loops == 20: self.video_list = [] elif loops > 30: self.is_active = False break
def add_video(self,artist=False): common.log('[mvmixPlayer] add video') video_url = None loops = 0 while not video_url and not xbmc.abortRequested and self.is_active: self.set_artist() common.log('[mvmixPlayer] loops: %s' % str(loops)) common.log('[mvmixPlayer] artist: %s' % str(self.artist)) videos = __videos__.get_videos(self.artist) videos = self.remove_added_videos(videos) common.log('[mvmixPlayer] videos found: %s' % str(len(videos))) if videos: video = videos[random.randint(0,(len(videos)-1))] self.video_list.append(video) video_url = common.import_site(video['site']).get_video_url(video['id']) if video_url: artist = common.utf_enc(video['artist'][0]) title = common.utf_enc(video['title']) name = '%s - %s' % (artist,title) listitem = xbmcgui.ListItem(name, thumbnailImage=video['image']) self.playlist.add(video_url, listitem=listitem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) else: self.remove_artist_from_list() self.sleep(200) loops += 1 if loops == 20: self.video_list = [] elif loops > 30: self.is_active = False break
def videos_thread(site,artist,result): start_time = time.time() video_list = [] video_list = cache.get_value(site,artist) #video_list = None if video_list == None: video_list = common.import_site(site).get_videos(artist) if not video_list == False: cache.save_value(site,artist,video_list) result.append(video_list) complete_time = time.time() - start_time common.log('[mvmixPlayer] site: %s - time: %s' % (site,str(complete_time))) return result
def add_video(self, artist=False): common.log('[mvmixPlayer] add video') video_url = None loops = 0 if not artist: self.similar_artists = lastfm.get_similar_artists(self.artist) while not video_url and not xbmc.abortRequested and self.is_active: loops += 1 self.set_artist(artist) self.artist = common.utf_enc(self.artist) common.log('[mvmixPlayer] loop: %s' % str(loops)) common.log('[mvmixPlayer] artist: %s' % str(self.artist)) videos = __videos__.get_videos(self.artist) videos = self.remove_added_videos(videos) common.log('[mvmixPlayer] videos found: %s' % str(len(videos))) if videos: common.limit_artists(common.limit_result()) video = videos[random.randint(0, (len(videos) - 1))] self.video_list.append(video) video_url = common.import_site(video['site']).get_video_url( video['id']) if video_url: artist = common.utf_enc(video['artist'][0]) title = common.utf_enc(video['title']) name = '%s - %s' % (artist, title) listitem = xbmcgui.ListItem(name, thumbnailImage=video['image']) self.playlist.add(video_url, listitem=listitem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) else: self.add_to_ignore_list() if artist and not video_url and not self.similar_artists: self.similar_artists = lastfm.get_similar_artists(artist) if common.resume(): resume_point = { 'start_artist': self.start_artist, 'artist': self.artist, 'genre_list': self.genre_list, 'video_list': self.video_list, 'ignore_list': self.ignore_list } resume.save_resume_point(resume_point) self.sleep(200) if loops == 10: self.is_active = False break
def add_video(self,artist=False): common.log('[mvmixPlayer] add video') video_url = None loops = 0 if not artist: self.similar_artists = lastfm.get_similar_artists(self.artist) while not video_url and not xbmc.abortRequested and self.is_active: loops += 1 self.set_artist(artist) self.artist = common.utf_enc(self.artist) common.log('[mvmixPlayer] loop: %s' % str(loops)) common.log('[mvmixPlayer] artist: %s' % str(self.artist)) videos = __videos__.get_videos(self.artist) videos = self.remove_added_videos(videos) common.log('[mvmixPlayer] videos found: %s' % str(len(videos))) if videos: common.limit_artists(common.limit_result()) video = videos[random.randint(0,(len(videos)-1))] self.video_list.append(video) video_url = common.import_site(video['site']).get_video_url(video['id']) if video_url: artist = common.utf_enc(video['artist'][0]) title = common.utf_enc(video['title']) name = '%s - %s' % (artist,title) listitem = xbmcgui.ListItem(name, thumbnailImage=video['image']) self.playlist.add(video_url, listitem=listitem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem) else: self.add_to_ignore_list() if artist and not video_url and not self.similar_artists: self.similar_artists = lastfm.get_similar_artists(artist) if common.resume(): resume_point = {'start_artist': self.start_artist, 'artist': self.artist, 'genre_list': self.genre_list, 'video_list': self.video_list, 'ignore_list': self.ignore_list} resume.save_resume_point(resume_point) self.sleep(200) if loops == 10: self.is_active = False break