This commit is contained in:
Шурупов Илья Викторович 2026-02-07 15:17:59 +03:00
parent b6c59e81ad
commit 9cd2c9189b
6 changed files with 112 additions and 128 deletions

38
Gui.py
View file

@ -6,34 +6,36 @@ import pandas as pd
import Flow
from src.Library import Library, Artist, Album, Track, Playlist
from src.Library import *
def entity_to_row(entity: Entity):
return {
"id": entity.id,
"mbid": entity.mbid,
"Title": entity.title,
"PLay Count": entity.play_count,
"Resolved": int(entity.resolved_percentage * 100),
"AutoScore": entity.auto_score,
"Added": entity.date_added.strftime("%Y-%m-%d") if entity.date_added else None,
"Played": entity.date_last_play.strftime("%Y-%m-%d") if entity.date_last_play else None,
"Released": entity.date_released.strftime("%Y-%m-%d") if entity.date_released else None,
"LocalId": str(entity.local_id) if entity.local_id else None,
"Path": str(entity.local_path) if entity.local_path else None,
}
def track_to_row(track: Track):
return {
"Title": track.title,
return entity_to_row(track) | {
"Album": track.album.title if track.album else "",
"Artists": ", ".join(a.title if a.title else "no_arist_name" for a in track.artists),
"Lyrics": track.has_lyrics,
"AutoScore": track.auto_score,
"Added": track.added_at.strftime("%Y-%m-%d") if track.added_at else "",
"LocalId": str(track.local_id) if track.local_id else "",
"Path": str(track.local_path) if track.local_path else "",
}
def artist_to_row(artist: Artist):
return {
"Title": artist.title,
"AutoScore": artist.auto_score,
"Resolved": int(artist.resolved_percentage * 100),
"LocalId": str(artist.local_id) if artist.local_id else "",
return entity_to_row(artist) | {
}
def album_to_row(album: Album):
return {
"Title": album.title,
"AutoScore": album.auto_score,
"Resolved": int(album.resolved_percentage * 100),
"LocalId": str(album.local_id) if album.local_id else "",
return entity_to_row(album) | {
}
@ -200,7 +202,7 @@ def run():
# flow.log_stats()
gui = LibraryView()
gui.add_libraries([flow.spotify_library, flow.local_library])
gui.add_libraries([flow.spotify_library, flow.itunes_library, flow.local_library])
gui.render()
run()