add ping check

- fix artist downloader function
This commit is contained in:
geoffrey45
2022-06-20 09:49:16 +03:00
parent 3cf44759b5
commit 12c8406a0d
6 changed files with 48 additions and 15 deletions
+2 -2
View File
@@ -14,11 +14,11 @@ class Dir:
is_sym: bool
def get_folder_track_count(foldername: str) -> int:
def get_folder_track_count(path: str) -> int:
"""
Returns the number of files associated with a folder.
"""
tracks = instances.tracks_instance.find_tracks_inside_path_regex(foldername)
tracks = instances.tracks_instance.find_tracks_inside_path_regex(path)
return len(tracks)
+22 -4
View File
@@ -89,10 +89,23 @@ class CreateAlbums:
prealbums = self.filter_processed(self.db_albums, prealbums)
print(f"📌 {len(prealbums)}")
s = time.time()
albums = []
for album in tqdm(prealbums, desc="Creating albums"):
a = self.create_album(album)
albums.append(a)
if a is not None:
albums.append(a)
# with ThreadPoolExecutor() as pool:
# iterator = pool.map(self.create_album, prealbums)
# for i in iterator:
# if i is not None:
# albums.append(i)
d = time.time() - s
Log(f"Created {len(albums)} albums in {d} seconds")
if len(albums) > 0:
instances.album_instance.insert_many(albums)
@@ -131,15 +144,20 @@ class CreateAlbums:
hash = album.hash
album = {"image": None}
iter = 0
while album["image"] is None:
track = UseBisection(self.db_tracks, "albumhash", [hash])()[0]
if track is not None:
iter += 1
album = create_album(track)
self.db_tracks.remove(track)
else:
album["image"] = hash
album = Album(album)
return album
try:
album = Album(album)
return album
except KeyError:
print(f"📌 {iter}")
print(album)