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)
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)
def play_audios(self, audios):

View File

@ -91,7 +91,8 @@ class audioPlayer(object):
def play_all(self, list_of_urls, shuffle=False):
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:
random.shuffle(self.queue)
self.play(self.queue[0])