mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
Restyle Implement Fuzzy search using rapidfuzz (#60)
This commit is contained in:
+16
-17
@@ -1,26 +1,26 @@
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from multiprocessing import Pool
|
||||
from copy import deepcopy
|
||||
import os
|
||||
from os import path
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from copy import deepcopy
|
||||
from multiprocessing import Pool
|
||||
from os import path
|
||||
from typing import List
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
from app import api
|
||||
from app import settings
|
||||
from app.helpers import create_album_hash, run_fast_scandir
|
||||
from app.helpers import create_album_hash
|
||||
from app.helpers import run_fast_scandir
|
||||
from app.instances import album_instance
|
||||
from app.instances import tracks_instance
|
||||
from app.lib import folderslib
|
||||
from app.lib.albumslib import create_album
|
||||
from app.lib.albumslib import find_album
|
||||
from app.lib.taglib import get_tags
|
||||
from app.logger import Log
|
||||
from app.models import Album, Track
|
||||
|
||||
from app.lib.trackslib import find_track
|
||||
from app.logger import Log
|
||||
from app.models import Album
|
||||
from app.models import Track
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
class Populate:
|
||||
@@ -95,7 +95,8 @@ class Populate:
|
||||
folder = tags["folder"]
|
||||
self.folders.add(folder)
|
||||
|
||||
tags["albumhash"] = create_album_hash(tags["album"], tags["albumartist"])
|
||||
tags["albumhash"] = create_album_hash(tags["album"],
|
||||
tags["albumartist"])
|
||||
self.tagged_tracks.append(tags)
|
||||
api.DB_TRACKS.append(tags)
|
||||
|
||||
@@ -168,9 +169,8 @@ class Populate:
|
||||
for album in tqdm(self.pre_albums, desc="Building albums"):
|
||||
self.create_album(album)
|
||||
|
||||
Log(
|
||||
f"{self.exist_count} of {len(self.pre_albums)} albums were already in the database"
|
||||
)
|
||||
Log(f"{self.exist_count} of {len(self.pre_albums)} albums were already in the database"
|
||||
)
|
||||
|
||||
def create_track(self, track: dict):
|
||||
"""
|
||||
@@ -205,9 +205,8 @@ class Populate:
|
||||
with ThreadPoolExecutor() as executor:
|
||||
executor.map(self.create_track, self.tagged_tracks)
|
||||
|
||||
Log(
|
||||
f"Added {len(self.tagged_tracks)} new tracks and {len(self.albums)} new albums"
|
||||
)
|
||||
Log(f"Added {len(self.tagged_tracks)} new tracks and {len(self.albums)} new albums"
|
||||
)
|
||||
|
||||
def save_albums(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user