@@ -437,37 +437,38 @@ def cache(self):
437
437
438
438
logger .info ("Caching %d permanent items." , len (cached_items ))
439
439
440
- for local_id in cached_items :
441
- logger .debug ("Caching item '%d'." , local_id )
442
- database_id , remote_id , file_suffix = cached_items [local_id ]
440
+ for item_id in cached_items :
441
+ logger .debug ("Caching item '%d'." , item_id )
442
+
443
+ database_id = cached_items [item_id ]["database_id" ]
444
+ remote_id = cached_items [item_id ]["remote_id" ]
445
+ file_suffix = cached_items [item_id ]["file_suffix" ]
443
446
444
447
# Artwork
445
- if not self .artwork_cache .contains (local_id ):
446
- cache_item = self .artwork_cache .get (local_id )
448
+ if not self .artwork_cache .contains (item_id ):
449
+ cache_item = self .artwork_cache .get (item_id )
447
450
448
451
if cache_item .ready is None :
449
452
remote_fd = self .connections [database_id ].getCoverArt (
450
453
remote_id )
451
- self .artwork_cache .download (
452
- local_id , cache_item , remote_fd )
454
+ self .artwork_cache .download (item_id , cache_item , remote_fd )
453
455
454
456
# Exhaust iterator so it downloads the artwork.
455
457
exhaust (cache_item .iterator ())
456
- self .artwork_cache .unload (local_id )
458
+ self .artwork_cache .unload (item_id , cache_item )
457
459
458
460
# Items
459
- if not self .item_cache .contains (local_id ):
460
- cache_item = self .item_cache .get (local_id )
461
+ if not self .item_cache .contains (item_id ):
462
+ cache_item = self .item_cache .get (item_id )
461
463
462
464
if cache_item .ready is None :
463
465
remote_fd = self .get_item_fd (
464
466
database_id , remote_id , file_suffix )
465
- self .item_cache .download (
466
- local_id , cache_item , remote_fd )
467
+ self .item_cache .download (item_id , cache_item , remote_fd )
467
468
468
469
# Exhaust iterator so it downloads the item.
469
470
exhaust (cache_item .iterator ())
470
- self .item_cache .unload (local_id )
471
+ self .item_cache .unload (item_id , cache_item )
471
472
472
473
logger .info ("Caching permanent items finished." )
473
474
0 commit comments