redesign progressbars

+ hide some progressbars
+ rewrite telemetry into a class
+ remove obsolete start info logs
+ update contributing.md to include contributing.md
+ send posthog event in a bg thread
+ related side effects
This commit is contained in:
mungai-njoroge
2023-09-27 17:18:52 +03:00
parent 54714a224b
commit 4f757e989f
20 changed files with 144 additions and 130 deletions
+2 -2
View File
@@ -1,13 +1,13 @@
import json
import random
from tqdm import tqdm
from app.db.sqlite.albumcolors import SQLiteAlbumMethods as aldb
from app.models import Album, Track
from ..utils.hashing import create_hash
from .tracks import TrackStore
from app.utils.progressbar import tqdm
ALBUM_LOAD_KEY = ""
@@ -49,7 +49,7 @@ class AlbumStore:
db_albums: list[tuple] = aldb.get_all_albums()
for album in tqdm(db_albums, desc="Mapping album colors"):
for album in db_albums:
albumhash = album[1]
colors = json.loads(album[2])
+2 -5
View File
@@ -1,11 +1,10 @@
import json
from tqdm import tqdm
from app.db.sqlite.artistcolors import SQLiteArtistMethods as ardb
from app.lib.artistlib import get_all_artists
from app.models import Artist
from app.utils.bisection import UseBisection
from app.utils.progressbar import tqdm
from .albums import AlbumStore
from .tracks import TrackStore
@@ -26,9 +25,7 @@ class ArtistStore:
cls.artists = get_all_artists(TrackStore.tracks, AlbumStore.albums)
# db_artists: list[tuple] = list(ardb.get_all_artists())
for artist in tqdm(ardb.get_all_artists(), desc="Loading artists"):
for artist in ardb.get_all_artists():
if instance_key != ARTIST_LOAD_KEY:
return
+3 -1
View File
@@ -1,10 +1,11 @@
from tqdm import tqdm
# from tqdm import tqdm
from app.db.sqlite.favorite import SQLiteFavoriteMethods as favdb
from app.db.sqlite.tracks import SQLiteTrackMethods as tdb
from app.models import Track
from app.utils.bisection import UseBisection
from app.utils.remove_duplicates import remove_duplicates
from app.utils.progressbar import tqdm
TRACKS_LOAD_KEY = ""
@@ -25,6 +26,7 @@ class TrackStore:
fav_hashes = favdb.get_fav_tracks()
fav_hashes = " ".join([t[1] for t in fav_hashes])
print("\n") # adds space between progress bars and startup info
for track in tqdm(cls.tracks, desc="Loading tracks"):
if instance_key != TRACKS_LOAD_KEY:
return