update
This commit is contained in:
@@ -16,7 +16,7 @@ app.include_router(download.router)
|
|||||||
app.include_router(system.router)
|
app.include_router(system.router)
|
||||||
|
|
||||||
@app.get("/", response_class=HTMLResponse)
|
@app.get("/", response_class=HTMLResponse)
|
||||||
async def index(request: Request):
|
def index(request: Request):
|
||||||
wrapper = TidalWrapper()
|
wrapper = TidalWrapper()
|
||||||
if not wrapper.is_authenticated():
|
if not wrapper.is_authenticated():
|
||||||
return templates.TemplateResponse("login.html", {"request": request})
|
return templates.TemplateResponse("login.html", {"request": request})
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class DownloadManager:
|
|||||||
return task
|
return task
|
||||||
|
|
||||||
def get_queue(self):
|
def get_queue(self):
|
||||||
return list(self.active_downloads.values()) + self.history
|
return list(self.active_downloads.values()) + self.history[-10:]
|
||||||
|
|
||||||
def _worker(self):
|
def _worker(self):
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@@ -27,7 +27,26 @@ class TidalWrapper:
|
|||||||
self.auth_status = {"status": "idle", "message": "", "link": "", "code": ""}
|
self.auth_status = {"status": "idle", "message": "", "link": "", "code": ""}
|
||||||
|
|
||||||
def is_authenticated(self) -> bool:
|
def is_authenticated(self) -> bool:
|
||||||
|
max_retries = 5
|
||||||
|
retry_delay = 5
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
return self.session.check_login()
|
return self.session.check_login()
|
||||||
|
except Exception as e:
|
||||||
|
error_str = str(e)
|
||||||
|
# Check for connection-related errors
|
||||||
|
if "Connection" in error_str or "RemoteDisconnected" in error_str or "Network" in error_str:
|
||||||
|
logger.warning(f"Connection error checking authentication (Attempt {attempt + 1}/{max_retries}): {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
logger.info(f"Waiting {retry_delay} seconds for network/gluetun to recover...")
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If it's not a connection error, or we've run out of retries
|
||||||
|
logger.error(f"Error checking authentication status: {e}")
|
||||||
|
return False
|
||||||
|
return False
|
||||||
|
|
||||||
def start_device_login(self) -> Dict[str, str]:
|
def start_device_login(self) -> Dict[str, str]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
- ./config:/app/config
|
- ./config:/app/config
|
||||||
- ./music:/app/music
|
- /mnt/big/media/music:/app/music
|
||||||
# Mount source for development
|
# Mount source for development
|
||||||
- ./app:/app/app
|
- ./app:/app/app
|
||||||
command: uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
|
||||||
|
|||||||
Reference in New Issue
Block a user