# -------------------------------- c_path = config['mpdc']['collections'] try: open(c_path, 'r') except IOError: warning('Collections file [{}] does not seem readable'.format(c_path)) sys.exit(0) from mpdc.libs.collectionsmanager import CollectionsManager collectionsmanager = CollectionsManager(c_path) update_collections = False if (not cache.exists('playlists') or cache.read('playlists') != mpd.get_stored_playlists_info()): cache.write('playlists', mpd.get_stored_playlists_info()) update_collections = True if (update_collections or not cache.exists('collections') or cache.last_modified('collections') < os.path.getmtime(c_path)): collectionsmanager.feed(force=True) collectionsmanager.update_cache() else: collectionsmanager.feed() # -------------------------------- # Lastfm initialization # --------------------------------
# -------------------------------- try: open(config['mpdc']['collections'], 'r') except IOError: warning('The collections file [%s] doesn\'t seem readable' % config['mpdc']['collections']) sys.exit(0) from mpdc.libs.collectionsmanager import CollectionsManager collectionsmanager = CollectionsManager(config['mpdc']['collections']) update_collections = False if (not is_cached('playlists') or read_cache('playlists') != mpd.get_stored_playlists_info()): write_cache('playlists', mpd.get_stored_playlists_info()) update_collections = True if (update_collections or not is_cached('collections') or cache_last_modified('collections') < os.path.getmtime(config['mpdc']['collections'])): collectionsmanager.feed(force=True) collectionsmanager.update_cache() else: collectionsmanager.feed() collections = collectionsmanager.collections # --------------------------------