Skip to content

Commit f1e3fcd

Browse files
committed
Fix ruff check
1 parent 6523121 commit f1e3fcd

File tree

8 files changed

+22
-28
lines changed

8 files changed

+22
-28
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
python -m pip install ruff
2323
- name: Run Ruff check
2424
run: |
25-
ruff check . --fix --exclude Test --exclude GUI
25+
ruff check . --fix

StreamingCommunity/Api/Site/crunchyroll/site.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# 16.03.25
22

3-
import sys
4-
53

64
# External libraries
75
from rich.console import Console
@@ -42,13 +40,13 @@ def title_search(query: str) -> int:
4240
config = config_manager.get_dict("SITE_LOGIN", "crunchyroll")
4341
if not config.get('device_id') or not config.get('etp_rt'):
4442
console.print("[bold red] device_id or etp_rt is missing or empty in config.json.[/bold red]")
45-
sys.exit(0)
43+
raise Exception("device_id or etp_rt is missing or empty in config.json.")
4644

4745
# Initialize Crunchyroll client
4846
client = CrunchyrollClient()
4947
if not client.start():
5048
console.print("[bold red] Failed to authenticate with Crunchyroll.[/bold red]")
51-
sys.exit(0)
49+
raise Exception("Failed to authenticate with Crunchyroll.")
5250

5351
# Build new Crunchyroll API search URL
5452
api_url = "https://www.crunchyroll.com/content/v2/discover/search"

StreamingCommunity/Api/Site/mediasetinfinity/site.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,38 +58,30 @@ def title_search(query: str) -> int:
5858

5959
# Process items
6060
for item in items:
61-
item_type = "tv" if item.get("__typename") == "SeriesItem" else "film"
62-
63-
# Bastava un campo data ma no ...
64-
date = item.get("year")
61+
is_series = (
62+
item.get("__typename") == "SeriesItem"
63+
or item.get("cardLink", {}).get("referenceType") == "series"
64+
or bool(item.get("seasons"))
65+
)
66+
item_type = "tv" if is_series else "film"
67+
68+
# Get date
69+
date = item.get("year") or ''
6570
if not date:
66-
updated = item.get("updated")
71+
updated = item.get("updated") or item.get("r") or ''
6772
if updated:
6873
try:
69-
date = datetime.fromisoformat(updated.replace("Z", "+00:00")).year
74+
date = datetime.fromisoformat(str(updated).replace("Z", "+00:00")).year
7075
except Exception:
71-
try:
72-
timestamp_ms = int(updated)
73-
date = datetime.fromtimestamp(timestamp_ms / 1000).year
74-
except Exception:
75-
date = ""
76-
77-
date = item.get('year', '')
78-
if not date and item.get('updated'):
79-
try:
80-
81-
timestamp_ms = int(item.get('updated', 0))
82-
date = datetime.fromtimestamp(timestamp_ms / 1000).year
83-
except (ValueError, TypeError):
84-
date = ''
76+
date = ''
8577

8678
media_search_manager.add_media({
87-
"url": item.get("cardLink", "").get("value", ""),
79+
"url": item.get("cardLink", {}).get("value", ""),
8880
"id": item.get("guid", ""),
8981
"name": item.get("cardTitle", "No Title"),
9082
"type": item_type,
9183
"image": None,
9284
"date": date,
9385
})
9486

95-
return media_search_manager.get_length()
87+
return media_search_manager.get_length()

StreamingCommunity/Upload/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def update():
9393
console.print(f"\n[cyan]New version available: [yellow]{last_version}")
9494

9595
console.print(f"\n[red]{__title__} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\
96-
[green]Current installed version: [yellow]{current_version} [green]last commit: [white]''[yellow]{latest_commit_message.splitlines()[0]}[white]''\n\
96+
[green]Current installed version: [yellow]{current_version} [green]last commit: [white]'[yellow]{latest_commit_message.splitlines()[0]}[white]'\n\
9797
[cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!")
9898

9999
time.sleep(1)

Test/Downloads/DASH.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 29.07.25
2+
# ruff: noqa: E402
23

34
import os
45
import sys

Test/Downloads/HLS.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 23.06.24
2+
# ruff: noqa: E402
23

34
import os
45
import sys

Test/Downloads/MP4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 23.06.24
2+
# ruff: noqa: E402
23

34
import os
45
import sys

Test/Downloads/TOR.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 23.06.24
2+
# ruff: noqa: E402
23

34
import os
45
import sys

0 commit comments

Comments
 (0)