def __init__(self, path=None): if not path: self._path = directory.cache_path('table') else: self._path = path self._pcache = PersistedCache(self._path)
def __init__(self, path=None): self._path = path or directory.cache_path('result') self._pcache = PersistedCache(self._path)
def testAll(self): path = directory.config_path() self.failUnless(path.startswith('/home')) path = directory.cache_path() self.failUnless(path.startswith('/home'))
# # You should have received a copy of the GNU General Public License # along with morituri. If not, see <http://www.gnu.org/licenses/>. import errno import os import struct import urlparse import urllib2 from morituri.common import directory import logging logger = logging.getLogger(__name__) _CACHE_DIR = directory.cache_path() class AccuCache: def __init__(self): if not os.path.exists(_CACHE_DIR): logger.debug('Creating cache directory %s', _CACHE_DIR) os.makedirs(_CACHE_DIR) def _getPath(self, url): # split path starts with / return os.path.join(_CACHE_DIR, urlparse.urlparse(url)[2][1:]) def retrieve(self, url, force=False): logger.debug("Retrieving AccurateRip URL %s", url)
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with morituri. If not, see <http://www.gnu.org/licenses/>. import errno import os import struct import urlparse import urllib2 from morituri.common import log, directory _CACHE_DIR = directory.cache_path() class AccuCache(log.Loggable): def __init__(self): if not os.path.exists(_CACHE_DIR): self.debug('Creating cache directory %s', _CACHE_DIR) os.makedirs(_CACHE_DIR) def _getPath(self, url): # split path starts with / return os.path.join(_CACHE_DIR, urlparse.urlparse(url)[2][1:]) def retrieve(self, url, force=False): self.debug("Retrieving AccurateRip URL %s", url)