quasarr 1.20.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of quasarr might be problematic. Click here for more details.
- quasarr/__init__.py +460 -0
- quasarr/api/__init__.py +187 -0
- quasarr/api/arr/__init__.py +373 -0
- quasarr/api/captcha/__init__.py +1075 -0
- quasarr/api/config/__init__.py +23 -0
- quasarr/api/sponsors_helper/__init__.py +166 -0
- quasarr/api/statistics/__init__.py +196 -0
- quasarr/downloads/__init__.py +267 -0
- quasarr/downloads/linkcrypters/__init__.py +0 -0
- quasarr/downloads/linkcrypters/al.py +237 -0
- quasarr/downloads/linkcrypters/filecrypt.py +444 -0
- quasarr/downloads/linkcrypters/hide.py +123 -0
- quasarr/downloads/packages/__init__.py +467 -0
- quasarr/downloads/sources/__init__.py +0 -0
- quasarr/downloads/sources/al.py +697 -0
- quasarr/downloads/sources/by.py +106 -0
- quasarr/downloads/sources/dd.py +76 -0
- quasarr/downloads/sources/dj.py +7 -0
- quasarr/downloads/sources/dt.py +66 -0
- quasarr/downloads/sources/dw.py +65 -0
- quasarr/downloads/sources/he.py +112 -0
- quasarr/downloads/sources/mb.py +47 -0
- quasarr/downloads/sources/nk.py +51 -0
- quasarr/downloads/sources/nx.py +105 -0
- quasarr/downloads/sources/sf.py +159 -0
- quasarr/downloads/sources/sj.py +7 -0
- quasarr/downloads/sources/sl.py +90 -0
- quasarr/downloads/sources/wd.py +110 -0
- quasarr/providers/__init__.py +0 -0
- quasarr/providers/cloudflare.py +204 -0
- quasarr/providers/html_images.py +20 -0
- quasarr/providers/html_templates.py +241 -0
- quasarr/providers/imdb_metadata.py +142 -0
- quasarr/providers/log.py +19 -0
- quasarr/providers/myjd_api.py +917 -0
- quasarr/providers/notifications.py +124 -0
- quasarr/providers/obfuscated.py +51 -0
- quasarr/providers/sessions/__init__.py +0 -0
- quasarr/providers/sessions/al.py +286 -0
- quasarr/providers/sessions/dd.py +78 -0
- quasarr/providers/sessions/nx.py +76 -0
- quasarr/providers/shared_state.py +826 -0
- quasarr/providers/statistics.py +154 -0
- quasarr/providers/version.py +118 -0
- quasarr/providers/web_server.py +49 -0
- quasarr/search/__init__.py +153 -0
- quasarr/search/sources/__init__.py +0 -0
- quasarr/search/sources/al.py +448 -0
- quasarr/search/sources/by.py +203 -0
- quasarr/search/sources/dd.py +135 -0
- quasarr/search/sources/dj.py +213 -0
- quasarr/search/sources/dt.py +265 -0
- quasarr/search/sources/dw.py +214 -0
- quasarr/search/sources/fx.py +223 -0
- quasarr/search/sources/he.py +196 -0
- quasarr/search/sources/mb.py +195 -0
- quasarr/search/sources/nk.py +188 -0
- quasarr/search/sources/nx.py +197 -0
- quasarr/search/sources/sf.py +374 -0
- quasarr/search/sources/sj.py +213 -0
- quasarr/search/sources/sl.py +246 -0
- quasarr/search/sources/wd.py +208 -0
- quasarr/storage/__init__.py +0 -0
- quasarr/storage/config.py +163 -0
- quasarr/storage/setup.py +458 -0
- quasarr/storage/sqlite_database.py +80 -0
- quasarr-1.20.6.dist-info/METADATA +304 -0
- quasarr-1.20.6.dist-info/RECORD +72 -0
- quasarr-1.20.6.dist-info/WHEEL +5 -0
- quasarr-1.20.6.dist-info/entry_points.txt +2 -0
- quasarr-1.20.6.dist-info/licenses/LICENSE +21 -0
- quasarr-1.20.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Quasarr
|
|
3
|
+
# Project by https://github.com/rix1337
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
import requests
|
|
9
|
+
|
|
10
|
+
from quasarr.providers.imdb_metadata import get_imdb_id_from_title
|
|
11
|
+
from quasarr.providers.imdb_metadata import get_poster_link
|
|
12
|
+
from quasarr.providers.log import info
|
|
13
|
+
|
|
14
|
+
# Discord message flag for suppressing notifications
|
|
15
|
+
SUPPRESS_NOTIFICATIONS = 1 << 12 # 4096
|
|
16
|
+
|
|
17
|
+
silent = False
|
|
18
|
+
if os.getenv('SILENT'):
|
|
19
|
+
silent = True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def send_discord_message(shared_state, title, case, imdb_id=None, details=None, source=None):
|
|
23
|
+
"""
|
|
24
|
+
Sends a Discord message to the webhook provided in the shared state, based on the specified case.
|
|
25
|
+
|
|
26
|
+
:param shared_state: Shared state object containing configuration.
|
|
27
|
+
:param title: Title of the embed to be sent.
|
|
28
|
+
:param case: A string representing the scenario (e.g., 'captcha', 'failed', 'unprotected').
|
|
29
|
+
:param imdb_id: A string starting with "tt" followed by at least 7 digits, representing an object on IMDb
|
|
30
|
+
:param details: A dictionary containing additional details, such as version and link for updates.
|
|
31
|
+
:param source: Optional source of the notification, sent as a field in the embed.
|
|
32
|
+
:return: True if the message was sent successfully, False otherwise.
|
|
33
|
+
"""
|
|
34
|
+
if not shared_state.values.get("discord"):
|
|
35
|
+
return False
|
|
36
|
+
|
|
37
|
+
poster_object = None
|
|
38
|
+
if case == "unprotected" or case == "captcha":
|
|
39
|
+
if not imdb_id and " " not in title: # this should prevent imdb_search for ebooks and magazines
|
|
40
|
+
imdb_id = get_imdb_id_from_title(shared_state, title)
|
|
41
|
+
if imdb_id:
|
|
42
|
+
poster_link = get_poster_link(shared_state, imdb_id)
|
|
43
|
+
if poster_link:
|
|
44
|
+
poster_object = {
|
|
45
|
+
'url': poster_link
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Decide the embed content based on the case
|
|
49
|
+
if case == "unprotected":
|
|
50
|
+
description = 'No CAPTCHA required. Links were added directly!'
|
|
51
|
+
fields = None
|
|
52
|
+
elif case == "solved":
|
|
53
|
+
description = 'CAPTCHA solved by SponsorsHelper!'
|
|
54
|
+
fields = None
|
|
55
|
+
elif case == "failed":
|
|
56
|
+
description = 'SponsorsHelper failed to solve the CAPTCHA! Package marked es failed.'
|
|
57
|
+
fields = None
|
|
58
|
+
elif case == "captcha":
|
|
59
|
+
description = 'Download will proceed, once the CAPTCHA has been solved.'
|
|
60
|
+
fields = [
|
|
61
|
+
{
|
|
62
|
+
'name': 'Solve CAPTCHA',
|
|
63
|
+
'value': f'Open [this link]({f"{shared_state.values['external_address']}/captcha"}) to solve the CAPTCHA.',
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
if not shared_state.values.get("helper_active"):
|
|
67
|
+
fields.append({
|
|
68
|
+
'name': 'SponsorsHelper',
|
|
69
|
+
'value': f'[Sponsors get automated CAPTCHA solutions!](https://github.com/rix1337/Quasarr?tab=readme-ov-file#sponsorshelper)',
|
|
70
|
+
})
|
|
71
|
+
elif case == "quasarr_update":
|
|
72
|
+
description = f'Please update to {details["version"]} as soon as possible!'
|
|
73
|
+
if details:
|
|
74
|
+
fields = [
|
|
75
|
+
{
|
|
76
|
+
'name': 'Release notes at: ',
|
|
77
|
+
'value': f'[GitHub.com: rix1337/Quasarr/{details["version"]}]({details["link"]})',
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
else:
|
|
81
|
+
fields = None
|
|
82
|
+
else:
|
|
83
|
+
info(f"Unknown notification case: {case}")
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
data = {
|
|
87
|
+
'username': 'Quasarr',
|
|
88
|
+
'avatar_url': 'https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png',
|
|
89
|
+
'embeds': [{
|
|
90
|
+
'title': title,
|
|
91
|
+
'description': description,
|
|
92
|
+
}]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if source and source.startswith("http"):
|
|
96
|
+
if not fields:
|
|
97
|
+
fields = []
|
|
98
|
+
fields.append({
|
|
99
|
+
'name': 'Source',
|
|
100
|
+
'value': f'[View release details here]({source})',
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
if fields:
|
|
104
|
+
data['embeds'][0]['fields'] = fields
|
|
105
|
+
|
|
106
|
+
if poster_object:
|
|
107
|
+
data['embeds'][0]['thumbnail'] = poster_object
|
|
108
|
+
data['embeds'][0]['image'] = poster_object
|
|
109
|
+
elif case == "quasarr_update":
|
|
110
|
+
data['embeds'][0]['thumbnail'] = {
|
|
111
|
+
'url': "https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Apply silent mode: suppress notifications for all cases except 'deleted'
|
|
115
|
+
if silent and case not in ["failed", "quasarr_update"]:
|
|
116
|
+
data['flags'] = SUPPRESS_NOTIFICATIONS
|
|
117
|
+
|
|
118
|
+
response = requests.post(shared_state.values["discord"], data=json.dumps(data),
|
|
119
|
+
headers={"Content-Type": "application/json"})
|
|
120
|
+
if response.status_code != 204:
|
|
121
|
+
info(f"Failed to send message to Discord webhook. Status code: {response.status_code}")
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
return True
|