Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions controllers/cluster_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def cluster_library(
"""Generate clustered playlists for ``library_path`` and return features."""

tracks = gather_tracks(library_path, folder_filter)
docs_dir = os.path.join(library_path, "Docs")
os.makedirs(docs_dir, exist_ok=True)
log_path = os.path.join(docs_dir, f"{method}_log.txt")
log_path = os.path.join(library_path, f"{method}_log.txt")

def log(msg: str) -> None:
log_callback(msg)
Expand Down
4 changes: 1 addition & 3 deletions controllers/library_index_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def extract_tags(path: str) -> dict:

def generate_index(folder_path: str) -> str:
"""Generate library_index.html for ``folder_path`` and return its path."""
docs_dir = os.path.join(folder_path, "Docs")
os.makedirs(docs_dir, exist_ok=True)
entries = []
for dirpath, _, files in os.walk(folder_path):
for fname in files:
Expand Down Expand Up @@ -95,7 +93,7 @@ def generate_index(folder_path: str) -> str:
html_lines.append("</table>")
html_lines.append("</body></html>")

out_path = os.path.join(docs_dir, "library_index.html")
out_path = os.path.join(folder_path, "library_index.html")
with open(out_path, "w", encoding="utf-8") as f:
f.write("\n".join(html_lines))
messagebox.showinfo(
Expand Down
8 changes: 3 additions & 5 deletions controllers/normalize_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

def load_mapping(folder: str) -> tuple[Dict[str, str], str]:
"""Return genre mapping dict and path."""
docs_dir = os.path.join(folder, "Docs")
path = os.path.join(docs_dir, ".genre_mapping.json")
path = os.path.join(folder, ".genre_mapping.json")
mapping: Dict[str, str] = {}
if os.path.isfile(path):
try:
Expand All @@ -41,9 +40,8 @@ def load_mapping(folder: str) -> tuple[Dict[str, str], str]:

def save_mapping(folder: str, mapping: Dict[str, str]) -> str:
"""Save mapping JSON and return path."""
docs_dir = os.path.join(folder, "Docs")
path = os.path.join(docs_dir, ".genre_mapping.json")
os.makedirs(docs_dir, exist_ok=True)
path = os.path.join(folder, ".genre_mapping.json")
os.makedirs(folder, exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
json.dump(mapping, f, indent=2)
return path
Expand Down
2 changes: 1 addition & 1 deletion controllers/tagfix_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def prepare_library(folder: str) -> tuple[str, dict]:
db_path = os.path.join(docs_dir, ".soundvault.db")
init_db(db_path)

mapping_path = os.path.join(docs_dir, ".genre_mapping.json")
mapping_path = os.path.join(folder, ".genre_mapping.json")
mapping = {}
if os.path.isfile(mapping_path):
try:
Expand Down
10 changes: 5 additions & 5 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def km_func(X, p):
def update_controls():
lib_var.set(app.library_path or "No library selected")
norm_status.set(
os.path.join(app.library_path, "Docs", ".genre_mapping.json")
os.path.join(app.library_path, ".genre_mapping.json")
if app.library_path
else "Select a library to enable normalization."
)
Expand All @@ -283,7 +283,7 @@ def update_controls():
intro,
text=(
"Normalize genre labels across your library by generating or "
"updating the Docs/.genre_mapping.json file."
"updating the .genre_mapping.json file."
),
wraplength=480,
justify="left",
Expand Down Expand Up @@ -405,7 +405,7 @@ def finish_scan(folder: str):
scan_status.set(f"Found {len(getattr(app, 'raw_genre_list', []))} genres.")
populate_raw_genres(getattr(app, "raw_genre_list", []))
prog["value"] = prog["maximum"]
app.mapping_path = os.path.join(folder, "Docs", ".genre_mapping.json")
app.mapping_path = os.path.join(folder, ".genre_mapping.json")

def start_scan():
folder = app.require_library()
Expand Down Expand Up @@ -4217,7 +4217,7 @@ def select_library(self):
self.library_path = info["path"]
self.library_name_var.set(info["name"])
self.library_path_var.set(info["path"])
self.mapping_path = os.path.join(self.library_path, "Docs", ".genre_mapping.json")
self.mapping_path = os.path.join(self.library_path, ".genre_mapping.json")
self._load_genre_mapping()
if hasattr(self, "player_search_var"):
self.player_search_var.set("")
Expand Down Expand Up @@ -4954,7 +4954,7 @@ def fix_tags_gui(self):
self.tagfix_folder_var.set(folder)

self.tagfix_db_path, _ = prepare_library(folder)
self.mapping_path = os.path.join(folder, "Docs", ".genre_mapping.json")
self.mapping_path = os.path.join(folder, ".genre_mapping.json")
self._load_genre_mapping()

files = discover_files(folder)
Expand Down
4 changes: 1 addition & 3 deletions update_genres.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ def main():
print("No folder selected; exiting.")
sys.exit(0)

docs_dir = os.path.join(folder, "Docs")
os.makedirs(docs_dir, exist_ok=True)
logpath = os.path.join(docs_dir, "genre_update_log.txt")
logpath = os.path.join(folder, "genre_update_log.txt")
try:
logfile = open(logpath, "w", encoding="utf-8")
except Exception as e:
Expand Down