Skip to content

Commit

Permalink
Fixes Pushbullet check
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbc committed May 31, 2023
1 parent db185c7 commit 97d833c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plexorcist.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def __init__(self):
self._set_config()
self._set_logging()

self.pushbullet = Pushbullet(self.config["pushbullet_key"])
# Check if the Pushbullet key has been set before making requests
match = re.match(r"^[A-Za-z0-9_.]+", self.config["pushbullet_key"])

if match:
self.pushbullet = Pushbullet(self.config["pushbullet_key"])

def _set_files(self):
"""Set all needed file paths and read config file"""
Expand Down Expand Up @@ -337,10 +341,8 @@ def send_notification(self, deleted_titles, reclaimed_gb):
else:
logging.info(self.config["i18n"]["ifttt_error"])

# Check if the Pushbullet key has been set before making requests
match = re.match(r"^[A-Za-z0-9_.]+", self.config["pushbullet_key"])

if match:
# Send notification via Pushbullet
if self.pushbullet:
self.pushbullet.push_note("Plexorcist", payload)


Expand Down

0 comments on commit 97d833c

Please sign in to comment.