Beispiel #1
0
    def do(self, args):
        self._cache = cache.ResultCache()

        try:
            discid = args[0]
        except IndexError:
            self.stderr.write('Please specify a cddb disc id\n')
            return 3

        persisted = self._cache.getRipResult(discid, create=False)

        if not persisted:
            self.stderr.write('Could not find a result for cddb disc id %s\n' %
                              discid)
            return 3

        self.stdout.write(persisted.object.table.cue().encode('utf-8'))
Beispiel #2
0
    def do(self, args):
        self._cache = cache.ResultCache()
        results = []

        for i in self._cache.getIds():
            r = self._cache.getRipResult(i, create=False)
            results.append((r.object.artist, r.object.title, i))

        results.sort()

        for artist, title, cddbid in results:
            if artist is None:
                artist = '(None)'
            if title is None:
                title = '(None)'

            self.stdout.write('%s: %s - %s\n' % (
                cddbid, artist.encode('utf-8'), title.encode('utf-8')))
Beispiel #3
0
    def do(self, args):
        self._cache = cache.ResultCache()

        persisted = self._cache.getRipResult(args[0], create=False)

        if not persisted:
            self.stderr.write('Could not find a result for cddb disc id %s\n' %
                              args[0])
            return 3

        try:
            klazz = result.getLoggers()[self.options.logger]
        except KeyError:
            self.stderr.write("No logger named %s found!\n" %
                              (self.options.logger))
            return 3

        logger = klazz()
        self.stdout.write(logger.log(persisted.object).encode('utf-8'))
Beispiel #4
0
    def __init__(self, config, record=False, stdout=sys.stdout):
        """
        @param record: whether to record results of API calls for playback.
        """
        self._record = record
        self._cache = cache.ResultCache()
        self._stdout = stdout
        self._config = config

        d = {}

        for key, default in {'fat': True, 'special': False}.items():
            value = None
            value = self._config.getboolean('main', 'path_filter_' + key)
            if value is None:
                value = default

            d[key] = value

        self._filter = path.PathFilter(**d)
Beispiel #5
0
 def setUp(self):
     self.cache = cache.ResultCache(
         os.path.join(os.path.dirname(__file__), 'cache', 'result'))