@@ -437,37 +437,38 @@ def cache(self):
437437
438438 logger .info ("Caching %d permanent items." , len (cached_items ))
439439
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" ]
443446
444447 # 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 )
447450
448451 if cache_item .ready is None :
449452 remote_fd = self .connections [database_id ].getCoverArt (
450453 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 )
453455
454456 # Exhaust iterator so it downloads the artwork.
455457 exhaust (cache_item .iterator ())
456- self .artwork_cache .unload (local_id )
458+ self .artwork_cache .unload (item_id , cache_item )
457459
458460 # 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 )
461463
462464 if cache_item .ready is None :
463465 remote_fd = self .get_item_fd (
464466 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 )
467468
468469 # Exhaust iterator so it downloads the item.
469470 exhaust (cache_item .iterator ())
470- self .item_cache .unload (local_id )
471+ self .item_cache .unload (item_id , cache_item )
471472
472473 logger .info ("Caching permanent items finished." )
473474
0 commit comments