def __init__(self, path=None): if not path: self._path = directory.cache_path('table') else: self._path = path self._pcache = PersistedCache(self._path)
# # You should have received a copy of the GNU General Public License # along with whipper. If not, see <http://www.gnu.org/licenses/>. import errno import os import struct import urlparse import urllib2 from whipper.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)
def __init__(self, path=None): self._path = path or directory.cache_path('result') self._pcache = PersistedCache(self._path)
import requests import struct from errno import EEXIST from os import makedirs from os.path import dirname, exists, join from whipper.common import directory from whipper.program.arc import accuraterip_checksum import logging logger = logging.getLogger(__name__) ACCURATERIP_URL = "http://www.accuraterip.com/accuraterip/" _CACHE_DIR = join(directory.cache_path(), 'accurip') class EntryNotFound(Exception): pass class _AccurateRipResponse(object): """I represent an AccurateRip response with its metadata. An AccurateRip response contains a collection of metadata identifying a particular digital audio compact disc. For disc level metadata it contains the track count, two internal disc IDs, and the CDDB disc ID.
# # You should have received a copy of the GNU General Public License # along with whipper. If not, see <http://www.gnu.org/licenses/>. import errno import os import struct import urlparse import urllib2 from whipper.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) path = self._getPath(url)
# along with whipper. If not, see <http://www.gnu.org/licenses/>. import requests import struct from errno import EEXIST from os import makedirs from os.path import dirname, exists, join from whipper.common import directory from whipper.program.arc import accuraterip_checksum import logging logger = logging.getLogger(__name__) ACCURATERIP_URL = "http://www.accuraterip.com/accuraterip/" _CACHE_DIR = join(directory.cache_path(), 'accurip') class EntryNotFound(Exception): pass class _AccurateRipResponse(object): """ An AccurateRip response contains a collection of metadata identifying a particular digital audio compact disc. For disc level metadata it contains the track count, two internal disc IDs, and the CDDB disc ID. A checksum and a confidence score is stored sequentially for each track in
def testAll(self): path = directory.config_path() self.failUnless(path.startswith('/home')) path = directory.cache_path() self.failUnless(path.startswith('/home'))
def testAll(self): path = directory.config_path() self.failUnless(path.startswith(DirectoryTestCase.HOME_PARENT)) path = directory.cache_path() self.failUnless(path.startswith(DirectoryTestCase.HOME_PARENT))
def testAll(self): path = directory.config_path() self.assertTrue(path.startswith(DirectoryTestCase.HOME_PARENT)) path = directory.cache_path() self.assertTrue(path.startswith(DirectoryTestCase.HOME_PARENT))