Skip to content

Commit 73f47d0

Browse files
Bump v3.4.4.5
* Add .env file check and creation prompt in run.py * Enhance .env file check to validate required keys and their values * Update tmdb.py * Update run.py * Update version.py --------- Co-authored-by: Unemployed <[email protected]>
1 parent d6367e6 commit 73f47d0

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

StreamingCommunity/Lib/TMBD/tmdb.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
if not api_key and show_trending:
2727
show_trending = False
28-
print("TMDB_API_KEY non trovata nel file .env")
29-
#raise ValueError("TMDB_API_KEY non trovata nel file .env")
3028

3129

3230
def get_select_title(table_show_manager, generic_obj):
@@ -307,6 +305,5 @@ def get_episodes(self, tv_show_id: int, season_number: int):
307305
return data[choice]
308306

309307

310-
311308
# Output
312-
tmdb = TheMovieDB(api_key)
309+
tmdb = TheMovieDB(api_key)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = 'StreamingCommunity'
2-
__version__ = '3.4.4'
2+
__version__ = '3.4.4.5'
33
__author__ = 'Arrowar'
44
__description__ = 'A command-line program to download film'
55
__copyright__ = 'Copyright 2025'

StreamingCommunity/run.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,23 @@ def force_exit():
278278
print("Uscita forzata con os._exit(0)")
279279
os._exit(0)
280280

281+
def check_env_file():
282+
required_keys = ['TMDB_API_KEY']
283+
284+
env_path = os.path.join(os.getcwd(), '.env')
285+
if not os.path.isfile(env_path):
286+
console.print("\n[red]Please create a .env file in the current directory with the necessary configurations.")
287+
288+
for key in required_keys:
289+
while True:
290+
value = console.input(f"[cyan]Please enter the value for [bold]{key}[/bold]: [/cyan]").strip()
291+
292+
with open(env_path, 'a') as f:
293+
f.write(f"{key}={value}\n")
294+
console.print(f"[green]{key} added to .env file.[/green]")
295+
break
296+
297+
console.print("\n[green].env file created successfully. Please restart the application.[/green]")
281298

282299
def check_dns():
283300
"""Check DNS configuration and exit if required."""
@@ -472,6 +489,7 @@ def main(script_id=0):
472489
get_bot_instance().send_message(f"Avviato script {script_id}", None)
473490

474491
Logger()
492+
check_env_file()
475493
execute_hooks('pre_run')
476494
initialize()
477495

@@ -512,4 +530,4 @@ def main(script_id=0):
512530
if script_id != "unknown":
513531
TelegramSession.deleteScriptId(script_id)
514532
finally:
515-
execute_hooks('post_run')
533+
execute_hooks('post_run')

0 commit comments

Comments
 (0)