Skip to content

Commit 0ded4d0

Browse files
committed
Remove check_dns, check_tmdb_key
1 parent 96321bd commit 0ded4d0

File tree

7 files changed

+14
-224
lines changed

7 files changed

+14
-224
lines changed

GUI/config.json

Lines changed: 0 additions & 65 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,17 @@ python3 test_run.py
7777
```
7878
---
7979

80-
## TMDB API Key required
81-
To enable search features, you need to obtain a TMDB API key:
82-
1. Sign up at [The Movie Database (TMDB)](https://developer.themoviedb.org/docs/getting-started)
83-
2. Navigate to your account settings and find the API section
84-
3. Generate a new API key
85-
4. Add the API key to your .env file (inside the StreamingCommunity directory) under the `TMDB_API_KEY` variable or insert it when required during execution
80+
## DNS
81+
82+
DNS configuration is **required** to ensure full functionality, better reliability and proper connectivity.
83+
84+
- **Cloudflare DNS:**
85+
- Primary: `1.1.1.1`
86+
- Setup guide: https://developers.cloudflare.com/1.1.1.1/setup/
87+
88+
- **Quad9 DNS:**
89+
- Primary: `9.9.9.9`
90+
- Setup guide: https://quad9.net/
8691

8792

8893
---

StreamingCommunity/Lib/TMBD/tmdb.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@
1212
# Internal utilities
1313
from .obj_tmbd import Json_film
1414
from StreamingCommunity.Util.http_client import create_client
15-
from StreamingCommunity.Util.config_json import config_manager
1615
from StreamingCommunity.Util.table import TVShowManager
1716

1817

1918
# Variable
2019
load_dotenv()
2120
console = Console()
2221
table_show_manager = TVShowManager()
23-
show_trending = config_manager.get_bool('DEFAULT', 'show_trending')
2422
api_key = os.environ.get("TMDB_API_KEY")
2523

26-
if not api_key and show_trending:
27-
show_trending = False
2824

2925

3026
def get_select_title(table_show_manager, generic_obj):
@@ -155,10 +151,6 @@ def display_trending_tv_shows(self):
155151
Fetch and display the top 5 trending TV shows of the week.
156152
Uses cached data if available, otherwise makes a new request.
157153
"""
158-
159-
if not show_trending:
160-
return
161-
162154
if self._cached_trending_tv is None:
163155
self._cached_trending_tv = self._make_request("trending/tv/week").get("results", [])
164156

@@ -176,10 +168,6 @@ def display_trending_films(self):
176168
Fetch and display the top 5 trending films of the week.
177169
Uses cached data if available, otherwise makes a new request.
178170
"""
179-
180-
if not show_trending:
181-
return
182-
183171
if self._cached_trending_movies is None:
184172
self._cached_trending_movies = self._make_request("trending/movie/week").get("results", [])
185173

@@ -306,4 +294,4 @@ def get_episodes(self, tv_show_id: int, season_number: int):
306294

307295

308296
# Output
309-
tmdb = TheMovieDB(api_key)
297+
tmdb = TheMovieDB(api_key)

StreamingCommunity/TelegramHelp/config.json

Lines changed: 0 additions & 53 deletions
This file was deleted.

StreamingCommunity/Util/os.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
import shutil
55
import logging
6-
import socket
76
import platform
87
import inspect
98

@@ -286,28 +285,6 @@ def format_transfer_speed(self, bytes: float) -> str:
286285
else:
287286
return f"{bytes / (1024 * 1024):.2f} MB/s"
288287

289-
def check_dns_resolve(self, domains_list: list = None):
290-
"""
291-
Check if the system's current DNS server can resolve a domain name.
292-
Works on both Windows and Unix-like systems.
293-
294-
Args:
295-
domains_list (list, optional): List of domains to test. Defaults to common domains.
296-
297-
Returns:
298-
bool: True if the current DNS server can resolve a domain name,
299-
False if can't resolve or in case of errors
300-
"""
301-
test_domains = domains_list or ["github.com", "google.com", "microsoft.com", "amazon.com"]
302-
303-
try:
304-
for domain in test_domains:
305-
# socket.gethostbyname() works consistently across all platforms
306-
socket.gethostbyname(domain)
307-
return True
308-
except (socket.gaierror, socket.error):
309-
return False
310-
311288

312289
class OsSummary:
313290
def __init__(self):

StreamingCommunity/run.py

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import threading
1010
import asyncio
1111
import subprocess
12-
from urllib.parse import urlparse
1312
from typing import Callable, Tuple
1413

1514

@@ -23,15 +22,13 @@
2322
from StreamingCommunity.Api.Template.loader import load_search_functions
2423
from StreamingCommunity.Util.message import start_message
2524
from StreamingCommunity.Util.config_json import config_manager
26-
from StreamingCommunity.Util.os import internet_manager, os_manager
25+
from StreamingCommunity.Util.os import os_manager
2726
from StreamingCommunity.Util.logger import Logger
28-
from StreamingCommunity.Lib.TMBD import tmdb
2927
from StreamingCommunity.Upload.update import update as git_update
3028
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession
3129

3230

3331
# Config
34-
SHOW_TRENDING = config_manager.get_bool('DEFAULT', 'show_trending')
3532
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
3633
BYPASS_DNS = config_manager.get_bool('DEFAULT', 'bypass_dns')
3734
COLOR_MAP = {
@@ -70,12 +67,6 @@ def initialize():
7067
console.log("[red]Install python version > 3.7.16")
7168
sys.exit(0)
7269

73-
# Show trending content
74-
if SHOW_TRENDING:
75-
print()
76-
tmdb.display_trending_films()
77-
tmdb.display_trending_tv_shows()
78-
7970
# Attempt GitHub update
8071
try:
8172
git_update()
@@ -279,57 +270,8 @@ def force_exit():
279270
os._exit(0)
280271

281272

282-
def check_env_file():
283-
required_keys = ['TMDB_API_KEY']
284-
285-
env_path = os.path.join(os.getcwd(), '.env')
286-
if not os.path.isfile(env_path):
287-
console.print("\n[red]Please create a .env file in the current directory with the necessary configurations.")
288-
289-
for key in required_keys:
290-
console.print(f"\n[yellow]To get your {key}:[/yellow]")
291-
console.print(f"[cyan]1. Go to: https://www.themoviedb.org/settings/api/request")
292-
console.print(f"[cyan]2. Register or log in to your account")
293-
console.print(f"[cyan]3. Create an API request and copy your API key\n[/cyan]")
294-
295-
while True:
296-
value = console.input(f"[cyan]Please enter the value for [bold]{key}[/bold]: [/cyan]").strip()
297-
298-
if value:
299-
with open(env_path, 'a') as f:
300-
f.write(f"{key}={value}\n")
301-
console.print(f"[green]{key} added to .env file.[/green]")
302-
break
303-
else:
304-
console.print(f"[red]Error: {key} cannot be empty. Please try again.[/red]")
305-
306-
console.print("\n[green].env file created successfully. Please restart the application.[/green]")
307-
308-
309-
def check_dns():
310-
"""Check DNS configuration and exit if required."""
311-
if BYPASS_DNS:
312-
return
313-
314-
hostname_list = [
315-
urlparse(site_info.get('full_url')).hostname
316-
for site_info in config_manager.configSite.values()
317-
if urlparse(site_info.get('full_url')).hostname
318-
]
319-
320-
if not internet_manager.check_dns_resolve(hostname_list):
321-
console.print("[red]\nERROR: DNS configuration is required!")
322-
console.print("[red]The program cannot function correctly without proper DNS settings.")
323-
console.print("\n[yellow]Please configure one of these DNS servers:")
324-
console.print("[red]• Cloudflare (1.1.1.1) 'https://developers.cloudflare.com/1.1.1.1/setup/windows/'")
325-
console.print("[red]• Quad9 (9.9.9.9) 'https://docs.quad9.net/Setup_Guides/Windows/Windows_10/'")
326-
console.print("\n[yellow]-> The program will not work until you configure your DNS settings.")
327-
sys.exit(0)
328-
329-
330273
def setup_argument_parser(search_functions):
331274
"""Setup and return configured argument parser."""
332-
# Build help text
333275
module_info = {}
334276
for alias, (_func, _use_for) in search_functions.items():
335277
module_name = alias.split("_")[0].lower()
@@ -499,12 +441,10 @@ def main(script_id=0):
499441
get_bot_instance().send_message(f"Avviato script {script_id}", None)
500442

501443
Logger()
502-
check_env_file()
503444
execute_hooks('pre_run')
504445
initialize()
505446

506447
try:
507-
check_dns()
508448
search_functions = load_search_functions()
509449

510450
parser = setup_argument_parser(search_functions)

config.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
"DEFAULT": {
33
"debug": false,
44
"show_message": true,
5-
"show_trending": true,
65
"fetch_domain_online": true,
7-
"telegram_bot": false,
8-
"bypass_dns": false
6+
"telegram_bot": false
97
},
108
"OUT_FOLDER": {
119
"root_path": "Video",

0 commit comments

Comments
 (0)