Skip to content

Commit

Permalink
Merge pull request #1 from JBassett/feature/maintenance
Browse files Browse the repository at this point in the history
Feature/maintenance
  • Loading branch information
JBassett committed Nov 17, 2019
2 parents 43c17b5 + 51dcf8d commit 8001751
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions custom_components/plex_webhooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

async def handle_webhook(hass, webhook_id, request):
"""Handle webhook callback."""
logging.debug('Got plex webhook.')
_LOGGER.debug('Got plex webhook.')

data = {}

Expand All @@ -43,7 +43,7 @@ async def handle_webhook(hass, webhook_id, request):
if part.name == 'payload':
data = await part.json()
except ValueError:
logging.warn('Issue decoding webhook: ' + part.text())
_LOGGER.warn('Issue decoding webhook: ' + part.text())
return None

event = data['event']
Expand All @@ -56,21 +56,21 @@ async def handle_webhook(hass, webhook_id, request):
grabbed = ['library.new']

if event in playing:
logging.debug('Plex started playing')
_LOGGER.debug('Plex started playing')
data['status'] = 'PLAYING'
data['playerUuid'] = data['Player']['uuid']
elif event in stopped:
logging.debug('Plex stopped playing')
_LOGGER.debug('Plex stopped playing')
data['status'] = 'STOPPED'
data['playerUuid'] = data['Player']['uuid']
elif event in grabbed:
logging.debug('Plex got new media')
_LOGGER.debug('Plex got new media')
data['status'] = 'GRABBED'

hass.bus.async_fire(EVENT_RECEIVED, data)

async def async_setup(hass, config):
logging.debug('Initing Plex Webhooks!')
_LOGGER.debug('Initing Plex Webhooks!')
webhook_id = config[DOMAIN][CONF_WEBHOOK_ID]
hass.components.webhook.async_register(
DOMAIN, "Plex", webhook_id, handle_webhook
Expand Down
6 changes: 4 additions & 2 deletions custom_components/plex_webhooks/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"domain": "plex_webhooks",
"name": "Plex Webhooks",
"documentation": "https://github.com/JBassett/plex_webhooks",
"dependencies": [],
"dependencies": [
"webhooks"
],
"codeowners": [
"@JBassett"
],
"requirements": []
}
}

0 comments on commit 8001751

Please sign in to comment.