예제 #1
0
파일: cache.py 프로젝트: Freso/morituri
    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
    def __init__(self, path=None):
        if not path:
            self._path = directory.cache_path('table')
        else:
            self._path = path

        self._pcache = PersistedCache(self._path)
예제 #3
0
파일: cache.py 프로젝트: Freso/morituri
 def __init__(self, path=None):
     self._path = path or directory.cache_path('result')
     self._pcache = PersistedCache(self._path)
예제 #4
0
    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('/home'))

        path = directory.cache_path()
        self.failUnless(path.startswith('/home'))
예제 #6
0
 def __init__(self, path=None):
     self._path = path or directory.cache_path('result')
     self._pcache = PersistedCache(self._path)
예제 #7
0
파일: accurip.py 프로젝트: Freso/morituri
#
# 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)
예제 #8
0
# 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)