From aafeb64d762dc6322064672826b07bc5be1f3464 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Mon, 28 Jun 2010 16:07:23 +0100 Subject: [PATCH] Clean up some comments --- src/calibre/devices/prs505/sony_cache.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index 8a11839902..03ae23db1c 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -189,13 +189,19 @@ class XMLCache(object): return playlist_map def reset_existing_playlists_map(self): - self._playlist_to_playlist_id_map = {} + ''' + Call this method before calling get_or_create_playlist in the context of + a given job. Call it again after deleting any playlists. The current + implementation adds all new playlists before deleting any, so that + constraint is respected. + ''' + self._playlist_to_playlist_id_map = {} def get_or_create_playlist(self, bl_idx, title): - root = self.record_roots[bl_idx] # maintain a private map of playlists to their ids. Don't check if it # exists, because reset_existing_playlist_map must be called before it # is used to ensure that deleted playlists are taken into account + root = self.record_roots[bl_idx] if bl_idx not in self._playlist_to_playlist_id_map: self._playlist_to_playlist_id_map[bl_idx] = {} for playlist in root.xpath('//*[local-name()="playlist"]'):