Fixup replace_files for Alchemical
This commit is contained in:
parent
134961abfd
commit
189efb379f
@ -4,20 +4,25 @@
|
||||
# the current directory contains a "better" version of the file than the
|
||||
# parent (eg, bettet bitrate).
|
||||
|
||||
# Standard library imports
|
||||
import os
|
||||
import pydymenu # type: ignore
|
||||
import shutil
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
# PyQt imports
|
||||
|
||||
# Third party imports
|
||||
import pydymenu # type: ignore
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm.session import Session
|
||||
|
||||
# App imports
|
||||
from helpers import (
|
||||
get_tags,
|
||||
set_track_metadata,
|
||||
)
|
||||
|
||||
from models import Tracks
|
||||
from dbconfig import Session
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from typing import List
|
||||
from models import db, Tracks
|
||||
|
||||
# ###################### SETTINGS #########################
|
||||
process_name_and_tags_matches = True
|
||||
@ -42,7 +47,7 @@ def main():
|
||||
# We only want to run this against the production database because
|
||||
# we will affect files in the common pool of tracks used by all
|
||||
# databases
|
||||
if "musicmuster_prod" not in os.environ.get("MM_DB"):
|
||||
if "musicmuster_prod" not in os.environ.get("ALCHEMICAL_DATABASE_URI"):
|
||||
response = input("Not on production database - c to continue: ")
|
||||
if response != "c":
|
||||
sys.exit(0)
|
||||
@ -51,7 +56,7 @@ def main():
|
||||
assert source_dir != parent_dir
|
||||
|
||||
# Scan parent directory
|
||||
with Session() as session:
|
||||
with db.Session() as session:
|
||||
all_tracks = Tracks.get_all(session)
|
||||
parent_tracks = [a for a in all_tracks if parent_dir in a.path]
|
||||
parent_fnames = [os.path.basename(a.path) for a in parent_tracks]
|
||||
@ -239,7 +244,7 @@ def process_track(src, dst, title, artist, bitrate):
|
||||
if not do_processing:
|
||||
return
|
||||
|
||||
with Session() as session:
|
||||
with db.Session() as session:
|
||||
track = Tracks.get_by_path(session, dst)
|
||||
if track:
|
||||
# Update path, but workaround MariaDB bug
|
||||
|
||||
@ -59,7 +59,7 @@ explicit_package_bases = true
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "--exitfirst --showlocals --capture=no"
|
||||
pythonpath = [".", "app"]
|
||||
filterwarnings = "ignore:'audioop' is deprecated"
|
||||
filterwarnings = ["ignore:'audioop' is deprecated", "ignore:pkg_resources"]
|
||||
|
||||
[tool.vulture]
|
||||
exclude = ["migrations", "app/ui", "archive"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user