quasarr 2.4.8__py3-none-any.whl → 2.4.9__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.
Files changed (76) hide show
  1. quasarr/__init__.py +134 -70
  2. quasarr/api/__init__.py +40 -31
  3. quasarr/api/arr/__init__.py +116 -108
  4. quasarr/api/captcha/__init__.py +262 -137
  5. quasarr/api/config/__init__.py +76 -46
  6. quasarr/api/packages/__init__.py +138 -102
  7. quasarr/api/sponsors_helper/__init__.py +29 -16
  8. quasarr/api/statistics/__init__.py +19 -19
  9. quasarr/downloads/__init__.py +165 -72
  10. quasarr/downloads/linkcrypters/al.py +35 -18
  11. quasarr/downloads/linkcrypters/filecrypt.py +107 -52
  12. quasarr/downloads/linkcrypters/hide.py +5 -6
  13. quasarr/downloads/packages/__init__.py +342 -177
  14. quasarr/downloads/sources/al.py +191 -100
  15. quasarr/downloads/sources/by.py +31 -13
  16. quasarr/downloads/sources/dd.py +27 -14
  17. quasarr/downloads/sources/dj.py +1 -3
  18. quasarr/downloads/sources/dl.py +126 -71
  19. quasarr/downloads/sources/dt.py +11 -5
  20. quasarr/downloads/sources/dw.py +28 -14
  21. quasarr/downloads/sources/he.py +32 -24
  22. quasarr/downloads/sources/mb.py +19 -9
  23. quasarr/downloads/sources/nk.py +14 -10
  24. quasarr/downloads/sources/nx.py +8 -18
  25. quasarr/downloads/sources/sf.py +45 -20
  26. quasarr/downloads/sources/sj.py +1 -3
  27. quasarr/downloads/sources/sl.py +9 -5
  28. quasarr/downloads/sources/wd.py +32 -12
  29. quasarr/downloads/sources/wx.py +35 -21
  30. quasarr/providers/auth.py +42 -37
  31. quasarr/providers/cloudflare.py +28 -30
  32. quasarr/providers/hostname_issues.py +2 -1
  33. quasarr/providers/html_images.py +2 -2
  34. quasarr/providers/html_templates.py +22 -14
  35. quasarr/providers/imdb_metadata.py +149 -80
  36. quasarr/providers/jd_cache.py +131 -39
  37. quasarr/providers/log.py +1 -1
  38. quasarr/providers/myjd_api.py +260 -196
  39. quasarr/providers/notifications.py +53 -41
  40. quasarr/providers/obfuscated.py +9 -4
  41. quasarr/providers/sessions/al.py +71 -55
  42. quasarr/providers/sessions/dd.py +21 -14
  43. quasarr/providers/sessions/dl.py +30 -19
  44. quasarr/providers/sessions/nx.py +23 -14
  45. quasarr/providers/shared_state.py +292 -141
  46. quasarr/providers/statistics.py +75 -43
  47. quasarr/providers/utils.py +33 -27
  48. quasarr/providers/version.py +45 -14
  49. quasarr/providers/web_server.py +10 -5
  50. quasarr/search/__init__.py +30 -18
  51. quasarr/search/sources/al.py +124 -73
  52. quasarr/search/sources/by.py +110 -59
  53. quasarr/search/sources/dd.py +57 -35
  54. quasarr/search/sources/dj.py +69 -48
  55. quasarr/search/sources/dl.py +159 -100
  56. quasarr/search/sources/dt.py +110 -74
  57. quasarr/search/sources/dw.py +121 -61
  58. quasarr/search/sources/fx.py +108 -62
  59. quasarr/search/sources/he.py +78 -49
  60. quasarr/search/sources/mb.py +96 -48
  61. quasarr/search/sources/nk.py +80 -50
  62. quasarr/search/sources/nx.py +91 -62
  63. quasarr/search/sources/sf.py +171 -106
  64. quasarr/search/sources/sj.py +69 -48
  65. quasarr/search/sources/sl.py +115 -71
  66. quasarr/search/sources/wd.py +67 -44
  67. quasarr/search/sources/wx.py +188 -123
  68. quasarr/storage/config.py +65 -52
  69. quasarr/storage/setup.py +238 -140
  70. quasarr/storage/sqlite_database.py +10 -4
  71. {quasarr-2.4.8.dist-info → quasarr-2.4.9.dist-info}/METADATA +2 -2
  72. quasarr-2.4.9.dist-info/RECORD +81 -0
  73. quasarr-2.4.8.dist-info/RECORD +0 -81
  74. {quasarr-2.4.8.dist-info → quasarr-2.4.9.dist-info}/WHEEL +0 -0
  75. {quasarr-2.4.8.dist-info → quasarr-2.4.9.dist-info}/entry_points.txt +0 -0
  76. {quasarr-2.4.8.dist-info → quasarr-2.4.9.dist-info}/licenses/LICENSE +0 -0
@@ -7,19 +7,20 @@ import os
7
7
 
8
8
  import requests
9
9
 
10
- from quasarr.providers.imdb_metadata import get_imdb_id_from_title
11
- from quasarr.providers.imdb_metadata import get_poster_link
10
+ from quasarr.providers.imdb_metadata import get_imdb_id_from_title, get_poster_link
12
11
  from quasarr.providers.log import info
13
12
 
14
13
  # Discord message flag for suppressing notifications
15
14
  SUPPRESS_NOTIFICATIONS = 1 << 12 # 4096
16
15
 
17
16
  silent = False
18
- if os.getenv('SILENT'):
17
+ if os.getenv("SILENT"):
19
18
  silent = True
20
19
 
21
20
 
22
- def send_discord_message(shared_state, title, case, imdb_id=None, details=None, source=None):
21
+ def send_discord_message(
22
+ shared_state, title, case, imdb_id=None, details=None, source=None
23
+ ):
23
24
  """
24
25
  Sends a Discord message to the webhook provided in the shared state, based on the specified case.
25
26
 
@@ -36,48 +37,50 @@ def send_discord_message(shared_state, title, case, imdb_id=None, details=None,
36
37
 
37
38
  poster_object = None
38
39
  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
+ if (
41
+ not imdb_id and " " not in title
42
+ ): # this should prevent imdb_search for ebooks and magazines
40
43
  imdb_id = get_imdb_id_from_title(shared_state, title)
41
44
  if imdb_id:
42
45
  poster_link = get_poster_link(shared_state, imdb_id)
43
46
  if poster_link:
44
- poster_object = {
45
- 'url': poster_link
46
- }
47
+ poster_object = {"url": poster_link}
47
48
 
48
49
  # Decide the embed content based on the case
49
50
  if case == "unprotected":
50
- description = 'No CAPTCHA required. Links were added directly!'
51
+ description = "No CAPTCHA required. Links were added directly!"
51
52
  fields = None
52
53
  elif case == "solved":
53
- description = 'CAPTCHA solved by SponsorsHelper!'
54
+ description = "CAPTCHA solved by SponsorsHelper!"
54
55
  fields = None
55
56
  elif case == "failed":
56
- description = 'SponsorsHelper failed to solve the CAPTCHA! Package marked as failed for deletion.'
57
+ description = "SponsorsHelper failed to solve the CAPTCHA! Package marked as failed for deletion."
57
58
  fields = None
58
59
  elif case == "disabled":
59
- description = 'SponsorsHelper failed to solve the CAPTCHA! Please solve it manually to proceed.'
60
+ description = "SponsorsHelper failed to solve the CAPTCHA! Please solve it manually to proceed."
60
61
  fields = None
61
62
  elif case == "captcha":
62
- description = 'Download will proceed, once the CAPTCHA has been solved.'
63
+ description = "Download will proceed, once the CAPTCHA has been solved."
63
64
  fields = [
64
65
  {
65
- 'name': 'Solve CAPTCHA',
66
- 'value': f'Open [this link]({f"{shared_state.values['external_address']}/captcha"}) to solve the CAPTCHA.',
66
+ "name": "Solve CAPTCHA",
67
+ "value": f"Open [this link]({f'{shared_state.values["external_address"]}/captcha'}) to solve the CAPTCHA.",
67
68
  }
68
69
  ]
69
70
  if not shared_state.values.get("helper_active"):
70
- fields.append({
71
- 'name': 'SponsorsHelper',
72
- 'value': f'[Sponsors get automated CAPTCHA solutions!](https://github.com/rix1337/Quasarr?tab=readme-ov-file#sponsorshelper)',
73
- })
71
+ fields.append(
72
+ {
73
+ "name": "SponsorsHelper",
74
+ "value": f"[Sponsors get automated CAPTCHA solutions!](https://github.com/rix1337/Quasarr?tab=readme-ov-file#sponsorshelper)",
75
+ }
76
+ )
74
77
  elif case == "quasarr_update":
75
- description = f'Please update to {details["version"]} as soon as possible!'
78
+ description = f"Please update to {details['version']} as soon as possible!"
76
79
  if details:
77
80
  fields = [
78
81
  {
79
- 'name': 'Release notes at: ',
80
- 'value': f'[GitHub.com: rix1337/Quasarr/{details["version"]}]({details["link"]})',
82
+ "name": "Release notes at: ",
83
+ "value": f"[GitHub.com: rix1337/Quasarr/{details['version']}]({details['link']})",
81
84
  }
82
85
  ]
83
86
  else:
@@ -87,41 +90,50 @@ def send_discord_message(shared_state, title, case, imdb_id=None, details=None,
87
90
  return False
88
91
 
89
92
  data = {
90
- 'username': 'Quasarr',
91
- 'avatar_url': 'https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png',
92
- 'embeds': [{
93
- 'title': title,
94
- 'description': description,
95
- }]
93
+ "username": "Quasarr",
94
+ "avatar_url": "https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png",
95
+ "embeds": [
96
+ {
97
+ "title": title,
98
+ "description": description,
99
+ }
100
+ ],
96
101
  }
97
102
 
98
103
  if source and source.startswith("http"):
99
104
  if not fields:
100
105
  fields = []
101
- fields.append({
102
- 'name': 'Source',
103
- 'value': f'[View release details here]({source})',
104
- })
106
+ fields.append(
107
+ {
108
+ "name": "Source",
109
+ "value": f"[View release details here]({source})",
110
+ }
111
+ )
105
112
 
106
113
  if fields:
107
- data['embeds'][0]['fields'] = fields
114
+ data["embeds"][0]["fields"] = fields
108
115
 
109
116
  if poster_object:
110
- data['embeds'][0]['thumbnail'] = poster_object
111
- data['embeds'][0]['image'] = poster_object
117
+ data["embeds"][0]["thumbnail"] = poster_object
118
+ data["embeds"][0]["image"] = poster_object
112
119
  elif case == "quasarr_update":
113
- data['embeds'][0]['thumbnail'] = {
114
- 'url': "https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png"
120
+ data["embeds"][0]["thumbnail"] = {
121
+ "url": "https://raw.githubusercontent.com/rix1337/Quasarr/main/Quasarr.png"
115
122
  }
116
123
 
117
124
  # Apply silent mode: suppress notifications for all cases except 'deleted'
118
125
  if silent and case not in ["failed", "quasarr_update", "disabled"]:
119
- data['flags'] = SUPPRESS_NOTIFICATIONS
126
+ data["flags"] = SUPPRESS_NOTIFICATIONS
120
127
 
121
- response = requests.post(shared_state.values["discord"], data=json.dumps(data),
122
- headers={"Content-Type": "application/json"})
128
+ response = requests.post(
129
+ shared_state.values["discord"],
130
+ data=json.dumps(data),
131
+ headers={"Content-Type": "application/json"},
132
+ )
123
133
  if response.status_code != 204:
124
- info(f"Failed to send message to Discord webhook. Status code: {response.status_code}")
134
+ info(
135
+ f"Failed to send message to Discord webhook. Status code: {response.status_code}"
136
+ )
125
137
  return False
126
138
 
127
139
  return True