Add https support to audio service
The audio service could not handle https URLs. VLC can support them, so https was added to its supported_uris. Additionally, the play( ) function in the audio service could not actually correctly search the backends for a supported uri, so the code there has been fixedpull/1169/head
parent
0f00b8e7ce
commit
ad0b637856
|
@ -346,33 +346,37 @@ def play(tracks, prefered_service):
|
||||||
the tracks.
|
the tracks.
|
||||||
"""
|
"""
|
||||||
global current
|
global current
|
||||||
|
global service
|
||||||
LOG.info('play')
|
LOG.info('play')
|
||||||
_stop()
|
_stop()
|
||||||
uri_type = tracks[0].split(':')[0]
|
uri_type = tracks[0].split(':')[0]
|
||||||
LOG.info('uri_type: ' + uri_type)
|
LOG.info('uri_type: ' + uri_type)
|
||||||
# check if user requested a particular service
|
# check if user requested a particular service
|
||||||
if prefered_service and uri_type in prefered_service.supported_uris():
|
if prefered_service and uri_type in prefered_service.supported_uris():
|
||||||
service = prefered_service
|
selected_service = prefered_service
|
||||||
# check if default supports the uri
|
# check if default supports the uri
|
||||||
elif default and uri_type in default.supported_uris():
|
elif default and uri_type in default.supported_uris():
|
||||||
LOG.info("Using default backend")
|
LOG.info("Using default backend")
|
||||||
LOG.info(default.name)
|
LOG.info(default.name)
|
||||||
service = default
|
selected_service = default
|
||||||
else: # Check if any other service can play the media
|
else: # Check if any other service can play the media
|
||||||
|
LOG.info("Searching the services")
|
||||||
for s in service:
|
for s in service:
|
||||||
LOG.info(str(s))
|
LOG.info(str(s))
|
||||||
if uri_type in s.supported_uris():
|
if uri_type in s.supported_uris():
|
||||||
service = s
|
LOG.info("Service "+str(s)+" supports URI "+uri_type)
|
||||||
|
selected_service = s
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
LOG.info('No service found for uri_type: ' + uri_type)
|
||||||
return
|
return
|
||||||
LOG.info('Clear list')
|
LOG.info('Clear list')
|
||||||
service.clear_list()
|
selected_service.clear_list()
|
||||||
LOG.info('Add tracks' + str(tracks))
|
LOG.info('Add tracks' + str(tracks))
|
||||||
service.add_list(tracks)
|
selected_service.add_list(tracks)
|
||||||
LOG.info('Playing')
|
LOG.info('Playing')
|
||||||
service.play()
|
selected_service.play()
|
||||||
current = service
|
current = selected_service
|
||||||
|
|
||||||
|
|
||||||
def _play(message):
|
def _play(message):
|
||||||
|
|
|
@ -31,7 +31,7 @@ class VlcService(AudioBackend):
|
||||||
self.normal_volume = None
|
self.normal_volume = None
|
||||||
|
|
||||||
def supported_uris(self):
|
def supported_uris(self):
|
||||||
return ['file', 'http']
|
return ['file', 'http', 'https']
|
||||||
|
|
||||||
def clear_list(self):
|
def clear_list(self):
|
||||||
empty = self.instance.media_list_new()
|
empty = self.instance.media_list_new()
|
||||||
|
|
Loading…
Reference in New Issue