async def remove_playlist_tracks(self, prov_playlist_id, prov_track_ids):
''' remove track(s) from playlist '''
raise NotImplementedError
-
- async def get_stream_content_type(self, track_id):
- ''' return the content type for the given track when it will be streamed'''
- raise NotImplementedError
async def get_stream_details(self, track_id):
''' get streamdetails for a track '''
async def volume_set(self, volume_level):
''' [PROTECTED] send new volume level command to player '''
- if isinstance(volume_level, str):
- if '+' in volume_level or 'up' in volume_level.lower():
- return await self.volume_up()
- elif '-' in volume_level or 'down' in volume_level.lower():
- return await self.volume_down()
volume_level = try_parse_int(volume_level)
+ if volume_level < 0:
+ volume_level = 0
+ elif volume_level > 100:
+ volume_level = 100
# handle group volume
if self.is_group:
cur_volume = self.volume_level
''' resume previous queue '''
if self.items:
prev_index = self.cur_index
- if self.use_queue_stream:
+ if self.use_queue_stream or not self._player.supports_queue:
await self.play_index(prev_index)
else:
# at this point we don't know if the queue is synced with the player
- # so just to be safe we only send the queue_items from the index
- await self.load(self._items[prev_index:])
+ # so just to be safe we send the queue_items to the player
+ await self._player.cmd_queue_load(self.items)
+ await self.play_index(prev_index)
else:
LOGGER.warning("resume queue requested for %s but queue is empty" % self._player.name)
elif action == 'library_remove':
result = await prov.remove_library(prov_item_id, media_type)
await self.mass.db.remove_from_library(item.item_id, item.media_type, prov_id)
+ elif action == 'add_to_playlist':
+ result = await self.add_playlist_tracks(action_details, [item])
return result
async def add_playlist_tracks(self, playlist_id, tracks:List[Track]):
if db_id not in cur_db_ids:
await self.mass.db.remove_from_library(db_id, MediaType.Radio, prov_id)
LOGGER.info("Finished syncing Radios for provider %s" % prov_id)
-
elif cmd_str == 'playlist index -1':
await player.previous()
elif 'mixer volume' in cmd_str and '+' in cmds[2]:
- volume_level = cmds[2].split('+')[1]
+ volume_level = player.volume_level + int(cmds[2].split('+')[1])
await player.volume_set(volume_level)
elif 'mixer volume' in cmd_str and '-' in cmds[2]:
- volume_level = cmds[2].split('-')[1]
+ volume_level = player.volume_level - int(cmds[2].split('-')[1])
await player.volume_set(volume_level)
elif 'mixer volume' in cmd_str:
await player.volume_set(cmds[2])
if (action == "/library_remove")
item.in_library = []
else
- item.in_library = [provider]
+ item.in_library = [provider]
})
.catch(error => {
console.log("error", error);