break down store.py into multiple files in a module

+ fix last updated date bug
This commit is contained in:
geoffrey45
2023-03-25 03:05:38 +03:00
parent 43c480cf3e
commit d43dcbff46
26 changed files with 688 additions and 636 deletions
+5 -4
View File
@@ -1,13 +1,14 @@
import os
from concurrent.futures import ThreadPoolExecutor
from pprint import pprint
from app.db.store import Store
from app.models import Folder, Track
from app.settings import SUPPORTED_FILES
from app.logger import log
from app.utils.wintools import win_replace_slash
from app.store.store import FolderStore
from app.store.tracks import TrackStore
class GetFilesAndDirs:
"""
@@ -49,12 +50,12 @@ class GetFilesAndDirs:
files_.sort(key=lambda f: f["time"])
files = [f["path"] for f in files_]
tracks = Store.get_tracks_by_filepaths(files)
tracks = TrackStore.get_tracks_by_filepaths(files)
# TODO: Remove this threadpool and modify the get_folder store
# method to accept a list of paths.
with ThreadPoolExecutor() as pool:
iterable = pool.map(Store.get_folder, dirs)
iterable = pool.map(FolderStore.get_folder, dirs)
folders = [i for i in iterable if i is not None]
folders = filter(lambda f: f.has_tracks, folders)