Fixed issue with deleting and re-downloading songs; fixed issue where all N songs started to download when prefetching
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
v0.11.2
|
||||||
|
=======
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
* Fixes bug where search didn't work in certain situations. (#253)
|
||||||
|
* Fixed bug when you deleted a song and then re-downloaded it.
|
||||||
|
* Fixed issue where all of the next N songs started downloading at once instead
|
||||||
|
of one at a time when prefetching songs for the play queue.
|
||||||
|
|
||||||
v0.11.1
|
v0.11.1
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
@@ -939,4 +939,5 @@ class FilesystemAdapter(CachingAdapter):
|
|||||||
table.truncate_table()
|
table.truncate_table()
|
||||||
|
|
||||||
if cache_info:
|
if cache_info:
|
||||||
cache_info.delete_instance()
|
cache_info.valid = False
|
||||||
|
cache_info.save()
|
||||||
|
@@ -952,7 +952,7 @@ class AdapterManager:
|
|||||||
cancelled = False
|
cancelled = False
|
||||||
AdapterManager._cancelled_song_ids -= set(song_ids)
|
AdapterManager._cancelled_song_ids -= set(song_ids)
|
||||||
|
|
||||||
def do_download_song(song_id: str):
|
def do_download_song(song_id: str) -> Result:
|
||||||
assert AdapterManager._instance
|
assert AdapterManager._instance
|
||||||
assert AdapterManager._instance.caching_adapter
|
assert AdapterManager._instance.caching_adapter
|
||||||
|
|
||||||
@@ -966,7 +966,7 @@ class AdapterManager:
|
|||||||
AdapterManager._instance.song_download_progress(
|
AdapterManager._instance.song_download_progress(
|
||||||
song_id, DownloadProgress(DownloadProgress.Type.CANCELLED),
|
song_id, DownloadProgress(DownloadProgress.Type.CANCELLED),
|
||||||
)
|
)
|
||||||
return
|
return Result('', is_download=True)
|
||||||
|
|
||||||
logging.info(f"Downloading {song_id}")
|
logging.info(f"Downloading {song_id}")
|
||||||
|
|
||||||
@@ -980,6 +980,7 @@ class AdapterManager:
|
|||||||
AdapterManager._instance.song_download_progress(
|
AdapterManager._instance.song_download_progress(
|
||||||
song_id, DownloadProgress(DownloadProgress.Type.DONE),
|
song_id, DownloadProgress(DownloadProgress.Type.DONE),
|
||||||
)
|
)
|
||||||
|
return Result('', is_download=True)
|
||||||
except CacheMissError:
|
except CacheMissError:
|
||||||
# The song is not already cached.
|
# The song is not already cached.
|
||||||
if before_download:
|
if before_download:
|
||||||
@@ -1004,9 +1005,6 @@ class AdapterManager:
|
|||||||
assert AdapterManager._instance.caching_adapter
|
assert AdapterManager._instance.caching_adapter
|
||||||
AdapterManager._instance.download_limiter_semaphore.release()
|
AdapterManager._instance.download_limiter_semaphore.release()
|
||||||
|
|
||||||
if AdapterManager._song_download_jobs.get(song_id):
|
|
||||||
del AdapterManager._song_download_jobs[song_id]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
AdapterManager._instance.caching_adapter.ingest_new_data(
|
AdapterManager._instance.caching_adapter.ingest_new_data(
|
||||||
CachingAdapter.CachedDataKey.SONG_FILE,
|
CachingAdapter.CachedDataKey.SONG_FILE,
|
||||||
@@ -1014,10 +1012,14 @@ class AdapterManager:
|
|||||||
(None, f.result(), None),
|
(None, f.result(), None),
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
|
if AdapterManager._song_download_jobs.get(song_id):
|
||||||
|
del AdapterManager._song_download_jobs[song_id]
|
||||||
|
|
||||||
on_song_download_complete(song_id)
|
on_song_download_complete(song_id)
|
||||||
|
|
||||||
song_tmp_filename_result.add_done_callback(on_download_done)
|
song_tmp_filename_result.add_done_callback(on_download_done)
|
||||||
AdapterManager._song_download_jobs[song_id] = song_tmp_filename_result
|
AdapterManager._song_download_jobs[song_id] = song_tmp_filename_result
|
||||||
|
return song_tmp_filename_result
|
||||||
|
|
||||||
def do_batch_download_songs():
|
def do_batch_download_songs():
|
||||||
sleep(delay)
|
sleep(delay)
|
||||||
@@ -1040,7 +1042,7 @@ class AdapterManager:
|
|||||||
# simultaneously.
|
# simultaneously.
|
||||||
AdapterManager._instance.download_limiter_semaphore.acquire()
|
AdapterManager._instance.download_limiter_semaphore.acquire()
|
||||||
|
|
||||||
result = Result(do_download_song, song_id, is_download=True)
|
result = do_download_song(song_id)
|
||||||
|
|
||||||
if one_at_a_time:
|
if one_at_a_time:
|
||||||
# Wait the file to download.
|
# Wait the file to download.
|
||||||
|
Reference in New Issue
Block a user