Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49cd84f3e5 | |||
| e46759347e | |||
| 75f743e6cc | |||
| 4dc5ffa19e | |||
| 1649a22418 | |||
| 246752e2fc | |||
| 84b24ed79e | |||
| bf3954587a |
@@ -17,6 +17,9 @@ __pycache__/
|
|||||||
# Docker files (not needed inside the image)
|
# Docker files (not needed inside the image)
|
||||||
Docker/
|
Docker/
|
||||||
|
|
||||||
|
# Exception: VERSION is needed by Dockerfile.app
|
||||||
|
!Docker/VERSION
|
||||||
|
|
||||||
# Test and dev files
|
# Test and dev files
|
||||||
tests/
|
tests/
|
||||||
Temp/
|
Temp/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ COPY src/ ./src/
|
|||||||
COPY run_server.py .
|
COPY run_server.py .
|
||||||
COPY pyproject.toml .
|
COPY pyproject.toml .
|
||||||
COPY data/config.json ./data/config.json
|
COPY data/config.json ./data/config.json
|
||||||
|
COPY Docker/VERSION ./Docker/VERSION
|
||||||
|
|
||||||
# Create runtime directories
|
# Create runtime directories
|
||||||
RUN mkdir -p /app/data/config_backups /app/logs
|
RUN mkdir -p /app/data/config_backups /app/logs
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v1.3.1
|
v1.3.4
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aniworld-web",
|
"name": "aniworld-web",
|
||||||
"version": "1.3.1",
|
"version": "1.3.4",
|
||||||
"description": "Aniworld Anime Download Manager - Web Frontend",
|
"description": "Aniworld Anime Download Manager - Web Frontend",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -454,6 +454,24 @@ class SerieScanner:
|
|||||||
str(e)
|
str(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Fetch series name from provider if not already set
|
||||||
|
if not serie.name:
|
||||||
|
try:
|
||||||
|
fetched_name = self.loader.get_title(serie.key)
|
||||||
|
if fetched_name:
|
||||||
|
serie.name = fetched_name
|
||||||
|
logger.info(
|
||||||
|
"Fetched name from provider: %s (name=%s)",
|
||||||
|
serie.key,
|
||||||
|
serie.name
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(
|
||||||
|
"Could not fetch name for %s: %s",
|
||||||
|
serie.key,
|
||||||
|
str(e)
|
||||||
|
)
|
||||||
|
|
||||||
# Delegate the provider to compare local files with
|
# Delegate the provider to compare local files with
|
||||||
# remote metadata, yielding missing episodes per
|
# remote metadata, yielding missing episodes per
|
||||||
# season. Results are saved back to disk so that both
|
# season. Results are saved back to disk so that both
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ logger = logging.getLogger(__name__)
|
|||||||
router = APIRouter(prefix="/health", tags=["health"])
|
router = APIRouter(prefix="/health", tags=["health"])
|
||||||
|
|
||||||
|
|
||||||
|
from src.server.utils.version import APP_VERSION
|
||||||
|
|
||||||
|
|
||||||
class HealthStatus(BaseModel):
|
class HealthStatus(BaseModel):
|
||||||
"""Basic health status response."""
|
"""Basic health status response."""
|
||||||
|
|
||||||
status: str
|
status: str
|
||||||
timestamp: str
|
timestamp: str
|
||||||
version: str = "1.0.1"
|
version: str = APP_VERSION
|
||||||
service: str = "aniworld-api"
|
service: str = "aniworld-api"
|
||||||
series_app_initialized: bool = False
|
series_app_initialized: bool = False
|
||||||
anime_directory_configured: bool = False
|
anime_directory_configured: bool = False
|
||||||
@@ -63,7 +66,7 @@ class DetailedHealthStatus(BaseModel):
|
|||||||
|
|
||||||
status: str
|
status: str
|
||||||
timestamp: str
|
timestamp: str
|
||||||
version: str = "1.0.1"
|
version: str = APP_VERSION
|
||||||
dependencies: DependencyHealth
|
dependencies: DependencyHealth
|
||||||
startup_time: datetime
|
startup_time: datetime
|
||||||
|
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ async def lifespan(_application: FastAPI):
|
|||||||
"""
|
"""
|
||||||
# Setup logging first with INFO level
|
# Setup logging first with INFO level
|
||||||
logger = setup_logging(log_level="INFO")
|
logger = setup_logging(log_level="INFO")
|
||||||
|
logger.info("Starting FastAPI application v%s", APP_VERSION)
|
||||||
|
|
||||||
# Track successful initialization steps
|
# Track successful initialization steps
|
||||||
initialized = {
|
initialized = {
|
||||||
@@ -410,9 +411,7 @@ async def lifespan(_application: FastAPI):
|
|||||||
# anime_directory may be configured there even if the env var is empty.
|
# anime_directory may be configured there even if the env var is empty.
|
||||||
try:
|
try:
|
||||||
logger.info("Initializing scheduler service...")
|
logger.info("Initializing scheduler service...")
|
||||||
from src.server.services.scheduler_service import (
|
from src.server.services.scheduler_service import get_scheduler_service
|
||||||
get_scheduler_service,
|
|
||||||
)
|
|
||||||
scheduler_service = get_scheduler_service()
|
scheduler_service = get_scheduler_service()
|
||||||
logger.info("Scheduler service instance obtained, starting...")
|
logger.info("Scheduler service instance obtained, starting...")
|
||||||
await scheduler_service.start()
|
await scheduler_service.start()
|
||||||
@@ -542,8 +541,8 @@ async def lifespan(_application: FastAPI):
|
|||||||
|
|
||||||
# 4. Shutdown download service and persist active downloads
|
# 4. Shutdown download service and persist active downloads
|
||||||
try:
|
try:
|
||||||
from src.server.services.download_service import ( # noqa: E501
|
from src.server.services.download_service import (
|
||||||
_download_service_instance,
|
_download_service_instance, # noqa: E501
|
||||||
)
|
)
|
||||||
if _download_service_instance is not None:
|
if _download_service_instance is not None:
|
||||||
logger.info("Stopping download service...")
|
logger.info("Stopping download service...")
|
||||||
@@ -600,11 +599,13 @@ async def lifespan(_application: FastAPI):
|
|||||||
raise startup_error
|
raise startup_error
|
||||||
|
|
||||||
|
|
||||||
|
from src.server.utils.version import APP_VERSION
|
||||||
|
|
||||||
# Initialize FastAPI app with lifespan
|
# Initialize FastAPI app with lifespan
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="Aniworld Download Manager",
|
title="Aniworld Download Manager",
|
||||||
description="Modern web interface for Aniworld anime download management",
|
description="Modern web interface for Aniworld anime download management",
|
||||||
version="1.0.1",
|
version=APP_VERSION,
|
||||||
docs_url="/api/docs",
|
docs_url="/api/docs",
|
||||||
redoc_url="/api/redoc",
|
redoc_url="/api/redoc",
|
||||||
lifespan=lifespan
|
lifespan=lifespan
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ async def _update_database_paths(
|
|||||||
|
|
||||||
async with get_db_session() as db:
|
async with get_db_session() as db:
|
||||||
# 1. Update AnimeSeries.folder
|
# 1. Update AnimeSeries.folder
|
||||||
series = await AnimeSeriesService.get_by_key(db, old_folder)
|
series = await AnimeSeriesService.get_by_folder(db, old_folder)
|
||||||
if series is None:
|
if series is None:
|
||||||
# Fallback: try to find by folder name
|
# Fallback: try to find by folder name
|
||||||
all_series = await AnimeSeriesService.get_all(db)
|
all_series = await AnimeSeriesService.get_all(db)
|
||||||
@@ -615,7 +615,7 @@ async def validate_and_rename_series_folders(dry_run: bool = False) -> Dict[str,
|
|||||||
|
|
||||||
# Delete source DB record (cascades to episodes and download items)
|
# Delete source DB record (cascades to episodes and download items)
|
||||||
async with get_db_session() as db:
|
async with get_db_session() as db:
|
||||||
source_series = await AnimeSeriesService.get_by_key(db, current_name)
|
source_series = await AnimeSeriesService.get_by_folder(db, current_name)
|
||||||
if source_series is None:
|
if source_series is None:
|
||||||
# Fallback: find by folder name
|
# Fallback: find by folder name
|
||||||
all_series = await AnimeSeriesService.get_all(db)
|
all_series = await AnimeSeriesService.get_all(db)
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ from typing import Any, Dict, List, Optional
|
|||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
from src.server.utils.version import APP_VERSION
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Configure templates directory
|
# Configure templates directory
|
||||||
@@ -48,7 +50,7 @@ def get_base_context(
|
|||||||
"request": request,
|
"request": request,
|
||||||
"title": title,
|
"title": title,
|
||||||
"app_name": "Aniworld Download Manager",
|
"app_name": "Aniworld Download Manager",
|
||||||
"version": "1.0.1",
|
"version": APP_VERSION,
|
||||||
"static_v": STATIC_VERSION,
|
"static_v": STATIC_VERSION,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
src/server/utils/version.py
Normal file
26
src/server/utils/version.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
"""Version management utilities for Aniworld application."""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
def get_version() -> str:
|
||||||
|
"""
|
||||||
|
Get the current application version from Docker/VERSION file.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Version string from the VERSION file, or "unknown" if not found.
|
||||||
|
"""
|
||||||
|
version_file = Path(__file__).parent.parent.parent.parent / "Docker" / "VERSION"
|
||||||
|
|
||||||
|
try:
|
||||||
|
if version_file.exists():
|
||||||
|
return version_file.read_text().strip()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return "unknown"
|
||||||
|
|
||||||
|
|
||||||
|
# Module-level version constant (loaded once at import)
|
||||||
|
APP_VERSION: str = get_version()
|
||||||
Reference in New Issue
Block a user