示例#1
0
 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
示例#2
0
文件: player.py 项目: kodinerds/repo
 def playArtist(self,artist):
     self.is_active = True
     common.process_true()
     common.limit_artists(common.limit_result())
     self.similar_artists = []
     self.ignore_list = []
     self.video_list = []
     self.genre_list = lastfm.get_artist_genre(artist)
     self.start_artist = artist
     self.last_artist = self.start_artist
     self.artist = artist
     if common.resume():
         self.set_resume_point()
     self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
     self.clear_playlist()
     self.add_video(artist)
     self.play(self.playlist)
示例#3
0
 def playArtist(self, artist):
     self.is_active = True
     common.process_true()
     common.limit_artists(common.limit_result())
     self.similar_artists = []
     self.ignore_list = []
     self.video_list = []
     self.genre_list = lastfm.get_artist_genre(artist)
     self.start_artist = artist
     self.last_artist = self.start_artist
     self.artist = artist
     if common.resume():
         self.set_resume_point()
     self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
     self.clear_playlist()
     self.add_video(artist)
     self.play(self.playlist)
示例#4
0
文件: player.py 项目: kodinerds/repo
 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