def set_cache(self, cache_size_in_bytes=None): if cache_size_in_bytes is None: cache_size_in_bytes = CACHE_SIZE_IN_BYTES cache = QtNetwork.QNetworkDiskCache() cache.setCacheDirectory(os.path.join(appdirs.cache_folder(), 'network')) cache.setMaximumCacheSize(cache_size_in_bytes) self.manager.setCache(cache) log.debug("NetworkDiskCache dir: %r current size: %s max size: %s", cache.cacheDirectory(), bytes2human.decimal(cache.cacheSize(), l10n=False), bytes2human.decimal(cache.maximumCacheSize(), l10n=False))
def test_cache_folder_linux(self): self.assert_home_path_equals('~/.cache/MusicBrainz/Picard', cache_folder())
def test_cache_folder_macos(self): self.assert_home_path_equals('~/Library/Caches/MusicBrainz/Picard', cache_folder())
def test_cache_folder_win(self): self.assert_home_path_equals( '~/AppData/Local/MusicBrainz/Picard/cache', cache_folder())