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