style: apply ruff auto-fixes
This commit is contained in:
@@ -13,8 +13,6 @@ from __future__ import annotations
|
||||
import sqlite3
|
||||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
import shutil
|
||||
import time
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
@@ -303,8 +301,21 @@ class API_folder_store:
|
||||
|
||||
if should_check_empty:
|
||||
# Check if there are any files or directories in the library root (excluding the DB itself if it was just created)
|
||||
# We use a generator and next() for efficiency.
|
||||
existing_items = [item for item in self.library_root.iterdir() if item.name != self.DB_NAME]
|
||||
|
||||
# Allow an empty 'incoming' directory created by upload flow to exist
|
||||
# (this prevents a false-positive safety check when an upload endpoint
|
||||
# creates the incoming dir before DB initialization).
|
||||
if existing_items:
|
||||
if len(existing_items) == 1 and existing_items[0].name == "incoming" and existing_items[0].is_dir():
|
||||
try:
|
||||
# If the incoming directory is empty, treat it as harmless.
|
||||
if not any(existing_items[0].iterdir()):
|
||||
existing_items = []
|
||||
except Exception:
|
||||
# If we can't inspect it safely, leave the original items in place
|
||||
pass
|
||||
|
||||
if existing_items:
|
||||
# Log the items found for debugging
|
||||
item_names = [i.name for i in existing_items[:5]]
|
||||
@@ -1378,7 +1389,7 @@ class API_folder_store:
|
||||
(file_hash,
|
||||
existing_title[0]),
|
||||
)
|
||||
logger.debug(f"[save_tags] Preserved existing title tag")
|
||||
logger.debug("[save_tags] Preserved existing title tag")
|
||||
elif not existing_title and not new_title_provided:
|
||||
filename_without_ext = abs_path.stem
|
||||
if filename_without_ext:
|
||||
|
||||
Reference in New Issue
Block a user