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 filter_videos(videos): for f in filter_list: videos = [x for x in videos if not re.findall((f), common.utf_enc(x['title']), re.IGNORECASE)] videos = [x for x in videos if not re.findall(common.utf_enc(x['artist'][0]), common.utf_enc(x['title']), re.IGNORECASE)] ignore_list = common.ignore_list() for i in ignore_list: videos = [x for x in videos if not (i['id'] == x['id'] and i['site'] == x['site'])] return videos
def filter_videos(videos): for f in filter_list: videos = [x for x in videos if not re.findall((f), common.utf_enc(x['title']), re.IGNORECASE)] videos = [x for x in videos if not re.findall(common.utf_enc(x['artist'][0]), common.utf_enc(x['title']), re.IGNORECASE)] ignore_list = common.ignore_list() for i in ignore_list: videos = [x for x in videos if not (str(i['id']) == str(x['id']) and i['site'] == x['site'])] return videos
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
def set_artist(self): artist = self.artists[random.randint(0,(len(self.artists)-1))] self.artist = common.utf_enc(artist['artist'])