示例#1
0
    def __init__(self, path=None):
        if not path:
            self._path = directory.cache_path('table')
        else:
            self._path = path

        self._pcache = PersistedCache(self._path)
示例#2
0
文件: accurip.py 项目: tobbez/whipper
#
# 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)
示例#3
0
 def __init__(self, path=None):
     self._path = path or directory.cache_path('result')
     self._pcache = PersistedCache(self._path)
示例#4
0
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.
示例#5
0
文件: accurip.py 项目: sqozz/whipper
#
# 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)
示例#6
0
文件: accurip.py 项目: spvkgn/whipper
# 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
示例#7
0
    def testAll(self):
        path = directory.config_path()
        self.failUnless(path.startswith('/home'))

        path = directory.cache_path()
        self.failUnless(path.startswith('/home'))
示例#8
0
    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))
示例#9
0
    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))
示例#10
0
    def testAll(self):
        path = directory.config_path()
        self.failUnless(path.startswith('/home'))

        path = directory.cache_path()
        self.failUnless(path.startswith('/home'))