lecture-manager 2.3.1__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.
@@ -0,0 +1,9 @@
1
+ # File __init__.py
2
+
3
+ """
4
+ YouTube Lecture Manager package.
5
+ """
6
+
7
+ from .facebook_manager import add_facebook_entry, get_facebook_entry_by_id, list_facebook_entries, delete_facebook_entry
8
+
9
+ __version__ = "2.3.1"
@@ -0,0 +1,85 @@
1
+ # File config.py
2
+
3
+ import os
4
+ import json
5
+ from .utils import color_text, print_colored, COLORS
6
+
7
+ CONFIG_FILE = os.path.expanduser("~/.lecture_manager_config.json")
8
+ db_config = None
9
+
10
+ def load_or_create_config():
11
+ global db_config
12
+ if os.path.exists(CONFIG_FILE):
13
+ try:
14
+ with open(CONFIG_FILE, 'r') as f:
15
+ db_config = json.load(f)
16
+ print_colored("[✓] Loaded database configuration.", COLORS.GREEN)
17
+ return
18
+ except Exception as e:
19
+ print_colored(f"[!] Error reading config: {e}. Will create new one.", COLORS.YELLOW)
20
+
21
+ print("\n" + "═" * 50)
22
+ print_colored(" DATABASE CONFIGURATION", COLORS.CYAN, bold=True)
23
+ print("═" * 50)
24
+ print("Please enter your MariaDB/MySQL connection details.")
25
+ host = input(color_text("Host (default: localhost): ", COLORS.MAGENTA)).strip() or "localhost"
26
+ database = input(color_text("Database name: ", COLORS.MAGENTA)).strip()
27
+ user = input(color_text("Username: ", COLORS.MAGENTA)).strip()
28
+ password = input(color_text("Password: ", COLORS.MAGENTA)).strip()
29
+ port = input(color_text("Port (default: 3306): ", COLORS.MAGENTA)).strip() or "3306"
30
+
31
+ if not database or not user:
32
+ print_colored("[!] Database name and username are required.", COLORS.RED)
33
+ exit(1)
34
+
35
+ db_config = {
36
+ 'host': host,
37
+ 'database': database,
38
+ 'user': user,
39
+ 'password': password,
40
+ 'port': int(port)
41
+ }
42
+
43
+ try:
44
+ with open(CONFIG_FILE, 'w') as f:
45
+ json.dump(db_config, f, indent=2)
46
+ print_colored(f"[✓] Configuration saved to {CONFIG_FILE}", COLORS.GREEN)
47
+ except Exception as e:
48
+ print_colored(f"[!] Failed to save config: {e}", COLORS.RED)
49
+
50
+ def edit_config():
51
+ global db_config
52
+ print("\n" + "═" * 50)
53
+ print_colored(" EDIT DATABASE CONFIGURATION", COLORS.CYAN, bold=True)
54
+ print("═" * 50)
55
+ print("Current settings:")
56
+ print(f" Host : {db_config.get('host', '')}")
57
+ print(f" Database : {db_config.get('database', '')}")
58
+ print(f" User : {db_config.get('user', '')}")
59
+ print(f" Port : {db_config.get('port', 3306)}")
60
+ print("(Leave blank to keep current value)")
61
+
62
+ host = input(color_text(f"Host [{db_config.get('host', 'localhost')}]: ", COLORS.MAGENTA)).strip() or db_config.get('host', 'localhost')
63
+ database = input(color_text(f"Database [{db_config.get('database', '')}]: ", COLORS.MAGENTA)).strip() or db_config.get('database', '')
64
+ user = input(color_text(f"Username [{db_config.get('user', '')}]: ", COLORS.MAGENTA)).strip() or db_config.get('user', '')
65
+ password = input(color_text(f"Password [{db_config.get('password', '')}]: ", COLORS.MAGENTA)).strip() or db_config.get('password', '')
66
+ port = input(color_text(f"Port [{db_config.get('port', 3306)}]: ", COLORS.MAGENTA)).strip() or db_config.get('port', 3306)
67
+
68
+ if not database or not user:
69
+ print_colored("[!] Database name and username are required. Aborting.", COLORS.RED)
70
+ return
71
+
72
+ new_config = {
73
+ 'host': host,
74
+ 'database': database,
75
+ 'user': user,
76
+ 'password': password,
77
+ 'port': int(port)
78
+ }
79
+ try:
80
+ with open(CONFIG_FILE, 'w') as f:
81
+ json.dump(new_config, f, indent=2)
82
+ db_config = new_config
83
+ print_colored("[✓] Configuration updated and saved.", COLORS.GREEN)
84
+ except Exception as e:
85
+ print_colored(f"[!] Failed to save config: {e}", COLORS.RED)