Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for the push notification. #65

Closed
wants to merge 0 commits into from
Closed

Added support for the push notification. #65

wants to merge 0 commits into from

Conversation

kaiserbh
Copy link
Contributor

I manage to add the push notification support, but had to change the config file basically it's JSON now instead of text file
reason - easier to work with.
But beside that just logging changed custom logger or more like a separate class for logger that we can tweak as much as we like.
I tested it myself but would love to get others to test it before merging the pull request.
the support for the notification is not limited to pushover, added slack and apprise which supports a lot of platform.

I did however tested it with discord notifications.
discord notifs

Also at the moment it's up to the user on whether they want to enable the push notifs or not basically there is a section in the config.json called "notify_failed_matches" and if they set this to true it will send notification after each run if it's false then won't send it although now that the config file is json we can just add scheduled notifs etc.

There is an option to push notification while it's running but I haven't set it up properly for it but it's just a matter of adding
notify.send(message="Whatever message here or log.info perhaps")

@jacobmix
Copy link

jacobmix commented Aug 31, 2021

Wanted to try out your fork. But what file does "Step 3 - Configuration" want you to edit?
Made a config.json with all the information, but i can't seem to get Discord notifications to work.

@kaiserbh
Copy link
Contributor Author

Wanted to try out your fork. But what file does "Step 3 - Configuration" want you to edit?
Made a config.json with all the information, but i can't seem to get Discord notifications to work.

Hmm, you don't have to make the configuration file manually it usually just generate default one when you run it for the first time then ask you to edit it before running it again.
So basically for the Discord notification specifically just follow this Discord apprise to create the web hook etc, but for discord just use apprise as the service.

something like this

 "notifications": {
  "Apprise": {
    "service": "apprise",
    "url": "https://discordapp.com/api/webhooks/4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js",
    "title": "PlexNotif(or leave empty)"
  },
  "verbose": false
},

and this is what apprise supports supports

Also the file that you should edit is config.json, make sure you are using the correct fork tho so basically just pull the one in my repo to try it out in a new folder don't mix it with the Rick one cause that one doesn't read .json instead it's reading .ini

@jacobmix
Copy link

Wanted to try out your fork. But what file does "Step 3 - Configuration" want you to edit?
Made a config.json with all the information, but i can't seem to get Discord notifications to work.

Hmm, you don't have to make the configuration file manually it usually just generate default one when you run it for the first time then ask you to edit it before running it again.
So basically for the Discord notification specifically just follow this Discord apprise to create the web hook etc, but for discord just use apprise as the service.

something like this

 "notifications": {
  "Apprise": {
    "service": "apprise",
    "url": "https://discordapp.com/api/webhooks/4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js",
    "title": "PlexNotif(or leave empty)"
  },
  "verbose": false
},

and this is what apprise supports supports

Also the file that you should edit is config.json, make sure you are using the correct fork tho so basically just pull the one in my repo to try it out in a new folder don't mix it with the Rick one cause that one doesn't read .json instead it's reading .ini

Strange. When i start a clean master download with py -3 PlexAniSync.py it just asks me for a settings.ini,
and when i add my settings.ini file it just runs like normal. Doesn't seem to create any config.json

@jacobmix
Copy link

Nevermind. I found out what was wrong. I clicked the download link in "Step 2 - Download project files" instead of downloading manually, and the link isn't for your fork.

@kaiserbh
Copy link
Contributor Author

kaiserbh commented Aug 31, 2021

Nevermind. I found out what was wrong. I clicked the download link in "Step 2 - Download project files" instead of downloading manually, and the link isn't for your fork.

Ohh cool yea my bad, I made the link as a place holder for the future one if it get merged etc. But yea I was about to let you know to download it directly from the fork :), let me know how it goes anyway or if there should be an improvement because it's not really complete as it will just send it on each run and I think that will get annoying so maybe in the future if I got some free time I will implement the schedule etc.

@jacobmix
Copy link

Now i keep getting errors tho. Pretty sure i set everything up currectly tho.

C:\CtoolsAndPrograms\PlexAniSync-master>py -3 PlexAniSync.py
Traceback (most recent call last):
  File "PlexAniSync.py", line 9, in <module>
    import anilist
  File "C:\CtoolsAndPrograms\PlexAniSync-master\anilist.py", line 12, in <module
>
    from plexmodule import PlexWatchedSeries
  File "C:\CtoolsAndPrograms\PlexAniSync-master\plexmodule.py", line 15, in <mod
ule>
    import PlexAniSync
  File "C:\CtoolsAndPrograms\PlexAniSync-master\PlexAniSync.py", line 14, in <mo
dule>
    from misc.log import logger
  File "C:\CtoolsAndPrograms\PlexAniSync-master\misc\log.py", line 60, in <modul
e>
    if Config(configfile=config,
  File "C:\CtoolsAndPrograms\PlexAniSync-master\misc\config.py", line 89, in cfg

    tmp = self.load_config()
  File "C:\CtoolsAndPrograms\PlexAniSync-master\misc\config.py", line 127, in lo
ad_config
    return AttrConfig(json.load(fp))
  File "C:\Users\JacobMIX\AppData\Local\Programs\Python\Python38\lib\json\__init
__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\JacobMIX\AppData\Local\Programs\Python\Python38\lib\json\__init
__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\JacobMIX\AppData\Local\Programs\Python\Python38\lib\json\decode
r.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\JacobMIX\AppData\Local\Programs\Python\Python38\lib\json\decode
r.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 14 column 23 (char 1422)

@jacobmix
Copy link

Fixed it. Just needed to change a "True" to "true"

@kaiserbh
Copy link
Contributor Author

Fixed it. Just needed to change a "True" to "true"

ahh glad to hear it, Yea json is a bit tricky but that error is usually just something missing in the json or miss type stuff in json I do recommend JSON Validator.

@kaiserbh kaiserbh closed this Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants