Add issue reporting
This commit is contained in:
parent
0ab4f860b7
commit
b22f802e3b
2 changed files with 6 additions and 3 deletions
4
app.py
4
app.py
|
@ -68,11 +68,10 @@ def overseerr_api():
|
||||||
media_type = media['media_type']
|
media_type = media['media_type']
|
||||||
|
|
||||||
show_data = None
|
show_data = None
|
||||||
|
show_id = int(media["tmdbId"])
|
||||||
if media_type == "tv":
|
if media_type == "tv":
|
||||||
show_id = int(media["tmdbId"])
|
|
||||||
show_data = overseerr.get_tv_show(show_id)
|
show_data = overseerr.get_tv_show(show_id)
|
||||||
elif media_type == "movie":
|
elif media_type == "movie":
|
||||||
show_id = int(media["tmdbId"])
|
|
||||||
show_data = overseerr.get_movie(show_id)
|
show_data = overseerr.get_movie(show_id)
|
||||||
|
|
||||||
if show_data:
|
if show_data:
|
||||||
|
@ -84,6 +83,7 @@ def overseerr_api():
|
||||||
print(f"Request declined, \"{data['subject']}\" is available for streaming on the following providers:")
|
print(f"Request declined, \"{data['subject']}\" is available for streaming on the following providers:")
|
||||||
for provider in providers.values():
|
for provider in providers.values():
|
||||||
print(f"\t{provider}")
|
print(f"\t{provider}")
|
||||||
|
overseerr.create_issue(f"Request for \"{data['subject']}\" declined", show_id)
|
||||||
else:
|
else:
|
||||||
print(f"Request for \"{data['subject']}\" approved.")
|
print(f"Request for \"{data['subject']}\" approved.")
|
||||||
overseerr.update_request_status(int(media_request["request_id"]), "approve")
|
overseerr.update_request_status(int(media_request["request_id"]), "approve")
|
||||||
|
|
|
@ -36,4 +36,7 @@ class Overseerr(object):
|
||||||
return self._get(f"/movie/{id}").json()
|
return self._get(f"/movie/{id}").json()
|
||||||
|
|
||||||
def update_request_status(self, req_id: int, status: Union["approve", "decline"]):
|
def update_request_status(self, req_id: int, status: Union["approve", "decline"]):
|
||||||
return self._post(f"/request/{req_id}/{status}").json()
|
return self._post(f"/request/{req_id}/{status}").json()
|
||||||
|
|
||||||
|
def create_issue(self, message, media_id):
|
||||||
|
return self._post(f"/issue", params={"issueType":0, "message":message, "mediaId":media_id}).json()
|
Loading…
Reference in a new issue