Skip restricted songs from playback
This commit is contained in:
parent
4b51126239
commit
d43f5f5320
@ -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):
|
||||||
|
@ -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])
|
||||||
|
Loading…
Reference in New Issue
Block a user