-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
137 lines (111 loc) · 4.33 KB
/
run.py
File metadata and controls
137 lines (111 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env python3
"""
Hikari TikTok Downloader Launcher
Simple launcher script that checks dependencies and runs the application
Copyright (C) 2025 Gary19gts
This program is dual-licensed:
1. GNU Affero General Public License v3 (AGPLv3) for open source use
2. Proprietary license for commercial/closed source use
For open source use:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, contact Gary19gts.
Author: Gary19gts
"""
import sys
import subprocess
import importlib.util
import os
from pathlib import Path
# Configure console colors
def setup_console_colors():
"""Setup console colors"""
if sys.platform == "win32":
os.system('color')
def colored_print(text):
"""Print text with TikTok cyan color"""
print(f"\033[38;2;0;224;183m{text}\033[0m")
# Setup colors at import
setup_console_colors()
def check_dependency(package_name, import_name=None):
"""Check if a package is installed"""
if import_name is None:
import_name = package_name
spec = importlib.util.find_spec(import_name)
return spec is not None
def install_missing_dependencies():
"""Install missing dependencies"""
required_packages = [
('customtkinter', 'customtkinter'),
('pillow', 'PIL'),
('yt-dlp', 'yt_dlp'),
('requests', 'requests')
]
missing_packages = []
colored_print("🔍 Checking dependencies...")
for package, import_name in required_packages:
if not check_dependency(package, import_name):
missing_packages.append(package)
colored_print(f"❌ Missing: {package}")
else:
colored_print(f"✅ Found: {package}")
if missing_packages:
colored_print(f"\n📦 Installing missing packages: {', '.join(missing_packages)}")
try:
subprocess.check_call([
sys.executable, "-m", "pip", "install"
] + missing_packages)
colored_print("✅ Dependencies installed successfully!")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Failed to install dependencies: {e}")
print("\n💡 Try running manually:")
print(f" pip install {' '.join(missing_packages)}")
return False
else:
colored_print("✅ All dependencies are installed!")
return True
def create_directories():
"""Create necessary directories"""
directories = ['logs']
for directory in directories:
Path(directory).mkdir(exist_ok=True)
def main():
"""Main launcher function"""
colored_print("🚀 Hikari TikTok Downloader Launcher")
colored_print("=" * 40)
# Check Python version
if sys.version_info < (3, 7):
print("❌ Python 3.7 or higher is required")
print(f" Current version: {sys.version}")
input("Press Enter to exit...")
sys.exit(1)
# Create directories
create_directories()
# Check and install dependencies
if not install_missing_dependencies():
input("Press Enter to exit...")
sys.exit(1)
# Launch the application
colored_print("\n🎬 Starting Hikari TikTok Downloader...")
try:
from main import HikariTikTokDownloader
app = HikariTikTokDownloader()
app.run()
except ImportError as e:
print(f"❌ Failed to import main application: {e}")
print("Make sure main.py is in the same directory")
input("Press Enter to exit...")
except Exception as e:
print(f"❌ Error starting application: {e}")
input("Press Enter to exit...")
if __name__ == "__main__":
main()