mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-09-21 22:12:19 +03:00
- Moved main execution logic to cli.py and updated imports accordingly. - Created a new __init__.py file to export the main function from the cli module. - Implemented the PlaylistDownloader class in downloader.py to handle playlist downloading logic. - Added ConfigLoader class in config.py to manage configuration settings. - Introduced PlaylistManager class in manager.py to manage multiple playlists. - Updated encoding handling for Windows in the main execution block. - Removed redundant code and improved overall structure for better readability and maintainability.
23 lines
778 B
Python
23 lines
778 B
Python
import time
|
||
|
||
from .downloader import PlaylistDownloader
|
||
|
||
|
||
class PlaylistManager:
|
||
def __init__(self, config):
|
||
self.config = config
|
||
self.playlists = [PlaylistDownloader(config, pl, idx) for idx, pl in enumerate(config.playlists)]
|
||
|
||
def run(self):
|
||
total_connections = self.config.max_parallel_downloads * self.config.aria2c_connections
|
||
if total_connections > 100:
|
||
print(
|
||
"\033[91m"
|
||
f"⚠[WARNING] Total connections ({self.config.max_parallel_downloads} × {self.config.aria2c_connections} = {total_connections}) may overload your network! Pausing 5 seconds..."
|
||
"\033[0m"
|
||
)
|
||
time.sleep(5)
|
||
|
||
for playlist in self.playlists:
|
||
playlist.update()
|