Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
cleanup & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar authored Feb 24, 2021
1 parent abcfa6b commit d8ccfea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/plex_assistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.components.plex.services import get_plex_server
from homeassistant.components.zeroconf import async_get_instance

import os
Expand Down Expand Up @@ -112,7 +111,7 @@ def handle_input(call):
pa.update_libraries()

device = fuzzy(command["device"] or default_device, pa.device_names)
device = run_start_script(hass, pa, command, start_script, device)
device = run_start_script(hass, pa, command, start_script, device, default_device)

_LOGGER.debug("PA Devices: %s", pa.devices)
if device[1] < 60:
Expand All @@ -123,7 +122,7 @@ def handle_input(call):
device = pa.devices[device[0]]

if command["control"]:
remote_control(hass, zeroconf, command["control"], device)
remote_control(hass, zeroconf, command["control"], device, jump_amount)
return

try:
Expand All @@ -140,7 +139,7 @@ def handle_input(call):

if getattr(media, "TYPE", None) == "episode":
episodes = media.show().episodes()
episodes = episodes[episodes.index(media):]
episodes = episodes[episodes.index(media):episodes.index(media) + 20]
media = pa.server.createPlayQueue(episodes, shuffle=shuffle)
elif getattr(media, "TYPE", None) in ["artist", "album"]:
tracks = media.tracks()
Expand All @@ -150,6 +149,8 @@ def handle_input(call):
tracks = tracks[tracks.index(media):]
media = pa.server.createPlayQueue(tracks, shuffle=shuffle)
elif not getattr(media, "TYPE", None) == "playqueue":
if isinstance(media, list):
media = media[:20]
media = pa.server.createPlayQueue(media, shuffle=shuffle)

payload = '%s{"playqueue_id": %s, "type": "%s"}' % (
Expand Down

0 comments on commit d8ccfea

Please sign in to comment.