Skip restricted songs from playback

This commit is contained in:
Manuel Cortez 2018-12-16 00:53:02 -06:00
parent 4b51126239
commit d43f5f5320
2 changed files with 7 additions and 1 deletions

View File

@ -231,6 +231,11 @@ class Controller(object):
call_threaded(utils.download_file, url, filename, self.window) call_threaded(utils.download_file, url, filename, self.window)
def play_audio(self, audio_object): def play_audio(self, audio_object):
# Restricted audios does not include an URL paramether.
# Restriction can be due to licensed content to unauthorized countries.
if "url" in audio_object and audio_object["url"] =="":
self.notify(message=_(u"This file could not be played because it is not allowed in your country"))
return
call_threaded(player.player.play, audio_object) call_threaded(player.player.play, audio_object)
def play_audios(self, audios): def play_audios(self, audios):

View File

@ -91,7 +91,8 @@ class audioPlayer(object):
def play_all(self, list_of_urls, shuffle=False): def play_all(self, list_of_urls, shuffle=False):
self.stop() self.stop()
self.queue = list_of_urls # Skip all country restricted tracks as they are not playable here.
self.queue = [i for i in list_of_urls if i["url"] != ""]
if shuffle: if shuffle:
random.shuffle(self.queue) random.shuffle(self.queue)
self.play(self.queue[0]) self.play(self.queue[0])