herjar / radarr_sonarr_watchmon Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Hi Herjar and thanks a lot for this great tool! I've been using it from a bit of time with crontab and almost forgot about it, as I was testing it again I was told that the authentication was maybe out of date. I authenticated once again and got it working easily but I didn't know that it was supposed to happen.
Do you know how long the authentication is supposed to last ?
Is there an "official way" to get warned if the authentication is out of date ? (I can tinker a crontab way to get warned but if there is an official one, it might work better)
Keep up the good work!
Hey, do you think its possible to add an "watched"-tag instead of un-monitoring watched movies?
Would be great, because i am still holding most watched movies.
And of they where good enough, i am also willing for an upgrade.
Or otherwise, if i am running out of space, i could display all watched movies and could delete the worst by hand.
Report exit codes 1, 2, 3 based on error.
or at least
Report exit code higher than 0 for any error.
Otherwise there's no way to know there was an error.
Thanks!
Hello,
I would like to use modify your script to suit my needs, but there is no license specified and I'm not sure about permitted uses, attribution etc.
If possible, please add license for your code, following link can help you with that:
Thanks
Hi there, just a thought, if it's possible, you might consider adding some kind of error message if the Sonarr (or other) API key isn't working. I noticed the script hadn't been working lately and was trying to figure out why - updated, re-authenticated with Trakt - before thinking to check my Sonarr API key. (I built a new PC recently, re-installing Sonarr along the way, but I hadn't thought to update the API key in my saved-from-before config.yml.)
The way it expressed itself was for the script to end with "Sonarr: Episodes found and changed monitored to False:" and then none were listed. Perhaps it might be possible to report back that the API key failed?
At any rate, thanks for sharing this script! Let me know if you have any PayPal, Venmo, etc. to accept donations!
I just came across this project (great work!). I was wondering why you are using Trakt and not Plex API directly to get watched content: https://python-plexapi.readthedocs.io/en/latest/introduction.html
movies = plex.library.section('Movies')
for video in movies.search(unwatched=False):
print(video.title)
Did the Trakt API change? Nothing's changed on my end, but it suddenly stopped working:
~/radarr_sonarr_watchmon$ venv/bin/python radarr_sonarr_watchmon.py
Radarr:
Trakt: movies watches in last 30 days:
Traceback (most recent call last):
File "radarr_sonarr_watchmon.py", line 330, in <module>
app.radarr(recent_days, radarr_address, radarr_apikey)
File "radarr_sonarr_watchmon.py", line 95, in radarr
movies_watched_recently_imdbids = self.trakt_get_movies(recent_days)
File "radarr_sonarr_watchmon.py", line 86, in trakt_get_movies
for movie in Trakt['sync/history'].movies(start_at=recent_date, pagination=True):
TypeError: 'NoneType' object is not iterable
First, thank you very much, I have been looking for this functionality to Sonarr for quite some time. I replied to you in your reddit thread, but I'll leave this here as well.
You mentioned there that you could add file deletion for the script. Are you still considering it?
Deleting watched, unmonitored files from both sonarr and radarr would be a great addition, I currently use emby and a script for it for this purpose only. The script I now use has an option "delete after x days of watching", I think that's the optimal way to do this.
It would of course be even better if I didn't need extra software like emby or plex to achieve this.
But even as is, the script is a nice upgrade to my config, thanks again!
Radarr can return status code 200 however this has 2 problems:
The movie is still not marked unmonitored.
The error condition raises an error because r.json()
is a list
of all movies.
Traceback (most recent call last):
File "radarr_sonarr_watchmon.py", line 423, in <module>
app.radarr(recent_days, radarr_address, radarr_apikey)
File "radarr_sonarr_watchmon.py", line 130, in radarr
print(" Error: "+str(r.json()["message"]))
TypeError: list indices must be integers or slices, not str
Radarr Version: 3.2.2.5080
Is anyone still using this?
It's stopped working for me, and I'm not sure it's a problem on my end or with an API. I have re-authed to make sure it's not just that.
(env) media@media:~/radarr_sonarr_watchmon$ python3 radarr_sonarr_watchmon.py
Movies:
Trakt: Movies watched in last 5 days:
Radarr:
* Movies will be unmonitored in Radarr
Movies found and changed in Radarr:
Traceback (most recent call last):
File "/home/media/radarr_sonarr_watchmon/env/lib/python3.9/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/media/radarr_sonarr_watchmon/radarr_sonarr_watchmon.py", line 534, in <module>
app.radarr()
File "/home/media/radarr_sonarr_watchmon/radarr_sonarr_watchmon.py", line 202, in radarr
movies = response.json()
File "/home/media/radarr_sonarr_watchmon/env/lib/python3.9/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
(env) media@media:~/radarr_sonarr_watchmon$ pip3 install -r requirements.txt.orig
Requirement already satisfied: trakt.py~=3.0.0 in ./env/lib/python3.9/site-packages (from -r requirements.txt.orig (line 1)) (3.0.0)
Requirement already satisfied: requests in ./env/lib/python3.9/site-packages (from -r requirements.txt.orig (line 2)) (2.31.0)
Requirement already satisfied: pyyaml in ./env/lib/python3.9/site-packages (from -r requirements.txt.orig (line 3)) (6.0.1)
Requirement already satisfied: six in ./env/lib/python3.9/site-packages (from -r requirements.txt.orig (line 4)) (1.16.0)
Requirement already satisfied: arrow<1.0.0,>=0.10.0 in ./env/lib/python3.9/site-packages (from trakt.py~=3.0.0->-r requirements.txt.orig (line 1)) (0.17.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./env/lib/python3.9/site-packages (from requests->-r requirements.txt.orig (line 2)) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in ./env/lib/python3.9/site-packages (from requests->-r requirements.txt.orig (line 2)) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./env/lib/python3.9/site-packages (from requests->-r requirements.txt.orig (line 2)) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in ./env/lib/python3.9/site-packages (from requests->-r requirements.txt.orig (line 2)) (2023.11.17)
Requirement already satisfied: python-dateutil>=2.7.0 in ./env/lib/python3.9/site-packages (from arrow<1.0.0,>=0.10.0->trakt.py~=3.0.0->-r requirements.txt.orig ()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.