mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-29 06:02:06 +00:00
fix duplicate tracks due to use of extract_feat
~ caused duplicate tracks to have different track hashes
This commit is contained in:
parent
9bfc1ceed2
commit
3ef2516210
@ -2,14 +2,17 @@
|
|||||||
Reads and saves the latest database migrations version.
|
Reads and saves the latest database migrations version.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from app.db.sqlite.utils import SQLiteManager
|
from app.db.sqlite.utils import SQLiteManager
|
||||||
|
|
||||||
|
|
||||||
class MigrationManager:
|
class MigrationManager:
|
||||||
all_get_sql = "SELECT * FROM migrations"
|
all_get_sql = "SELECT * FROM migrations"
|
||||||
pre_init_set_sql = "UPDATE migrations SET pre_init_version = ? WHERE id = 1"
|
|
||||||
post_init_set_sql = "UPDATE migrations SET post_init_version = ? WHERE id = 1"
|
_base = "UPDATE migrations SET"
|
||||||
|
_end = "= ? WHERE id = 1"
|
||||||
|
|
||||||
|
pre_init_set_sql = f"{_base} pre_init_version {_end}"
|
||||||
|
post_init_set_sql = f"{_base} post_init_version {_end}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_preinit_version(cls) -> int:
|
def get_preinit_version(cls) -> int:
|
||||||
|
@ -68,3 +68,11 @@ class Track:
|
|||||||
self.genre = str(self.genre).replace("/", ",").replace(";", ",")
|
self.genre = str(self.genre).replace("/", ",").replace(";", ",")
|
||||||
self.genre = str(self.genre).lower().split(",")
|
self.genre = str(self.genre).lower().split(",")
|
||||||
self.genre = [g.strip() for g in self.genre]
|
self.genre = [g.strip() for g in self.genre]
|
||||||
|
|
||||||
|
self.recreate_hash()
|
||||||
|
|
||||||
|
def recreate_hash(self):
|
||||||
|
if self.og_title == self.title:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.trackhash = create_hash(", ".join([a.name for a in self.artist]), self.album, self.title)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user