Initial commit
This commit is contained in:
81
navipy.py
Executable file
81
navipy.py
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
NaviPy - Accessible Navidrome Client
|
||||
|
||||
An accessible music player for Navidrome servers, built with PySide6
|
||||
for full keyboard navigation and screen reader compatibility.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import signal
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
# Add src to path for imports
|
||||
srcPath = Path(__file__).parent / 'src'
|
||||
sys.path.insert(0, str(srcPath.parent))
|
||||
|
||||
from src.main_window import MainWindow
|
||||
from src.config.settings import getDataDir
|
||||
|
||||
|
||||
def setupLogging():
|
||||
"""Setup logging configuration"""
|
||||
logDir = getDataDir()
|
||||
logFile = logDir / 'navipy.log'
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(message)s [%(asctime)s]',
|
||||
datefmt='%a %b %d %I:%M:%S %p %Z %Y',
|
||||
handlers=[
|
||||
logging.FileHandler(logFile, encoding='utf-8'),
|
||||
logging.StreamHandler(sys.stdout)
|
||||
]
|
||||
)
|
||||
|
||||
return logging.getLogger('navipy')
|
||||
|
||||
|
||||
def signalHandler(sig, frame):
|
||||
"""Handle interrupt signals for clean shutdown"""
|
||||
logging.info("Received shutdown signal")
|
||||
QApplication.quit()
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point"""
|
||||
logger = setupLogging()
|
||||
logger.info("NaviPy starting")
|
||||
|
||||
# Setup signal handlers for clean shutdown
|
||||
signal.signal(signal.SIGINT, signalHandler)
|
||||
signal.signal(signal.SIGTERM, signalHandler)
|
||||
|
||||
# Create application
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("NaviPy")
|
||||
app.setApplicationVersion("0.1.0")
|
||||
app.setOrganizationName("NaviPy")
|
||||
|
||||
# Enable accessibility
|
||||
app.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||
|
||||
# Create and show main window
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
|
||||
logger.info("NaviPy started successfully")
|
||||
|
||||
# Run the application
|
||||
exitCode = app.exec()
|
||||
|
||||
logger.info("NaviPy shutting down")
|
||||
sys.exit(exitCode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user