#!/usr/bin/env python3 """ SpotSpot - A Spotify to MP3 downloader with a web interface. """ import os import sys import logging # Add the application directory to the Python path APP_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, APP_DIR) def check_dependencies(): """Check if all required dependencies are installed.""" try: import spotipy, flask, flask_socketio, spotdl, requests return True except ImportError as e: logging.error(f"Missing dependency: {e}") logging.info("Please install the required dependencies by running: pip install -r requirements.txt") return False def main(): """Main entry point for the application.""" if not check_dependencies(): sys.exit(1) try: from app.spotspot import SpotSpotApp from app.services.config_service import ConfigService # Initialize config service to setup logging and get settings config = ConfigService() logger = logging.getLogger(__name__) logger.info("Starting SpotSpot application...") # Pass config to the app app = SpotSpotApp(config=config) app.run(host=config.host, port=config.port, debug=config.debug) except Exception as e: logging.critical(f"Fatal error during application startup: {e}", exc_info=True) sys.exit(1) if __name__ == "__main__": main()