Skip to content

Commit

Permalink
fixing code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
shitwolfymakes committed Apr 14, 2022
1 parent a19a28f commit ab0d879
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arm/ripper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,25 +765,27 @@ def apprise_notify(apprise_cfg, title, body):
)
except Exception: # noqa: E722
logging.error("Failed sending growl apprise notification. Continuing processing...")

# Kodi
# kodi://{hostname}:{port} || kodi: // {userid}: {password} @ {hostname}:{port}
if cfg['KODI_HOST'] != "":
try:
# Create an Apprise instance
apobj = apprise.Apprise()
# check if we have login details, if so use them
kodi_insecure_url_prefix = 'kodi://'
if cfg['KODI_USER'] != "":
apobj.add('kodi://' + str(cfg['KODI_USER']) + ":" + str(cfg['KODI_PASS']) + "@" + str(
apobj.add(kodi_insecure_url_prefix + str(cfg['KODI_USER']) + ":" + str(cfg['KODI_PASS']) + "@" + str(
cfg['KODI_HOST']) + ":" + str(cfg['KODI_PORT']))
else:
if cfg['KODI_PORT'] != "":
# we need to check if they are using secure or this will fail
if cfg['KODI_PORT'] == "443":
apobj.add('kodis://' + str(cfg['KODI_HOST']) + ":" + str(cfg['KODI_PORT']))
else:
apobj.add('kodi://' + str(cfg['KODI_HOST']) + ":" + str(cfg['KODI_PORT']))
apobj.add(kodi_insecure_url_prefix + str(cfg['KODI_HOST']) + ":" + str(cfg['KODI_PORT']))
else:
apobj.add('kodi://' + str(cfg['KODI_HOST']))
apobj.add(kodi_insecure_url_prefix + str(cfg['KODI_HOST']))
# Then notify these services any time you desire. The below would
# notify all of the services loaded into our Apprise object.
apobj.notify(
Expand Down

0 comments on commit ab0d879

Please sign in to comment.