Example #1
0
    def ripTrack(self,
                 runner,
                 trackResult,
                 offset,
                 device,
                 taglist,
                 overread,
                 what=None):
        """
        Ripping the track may change the track's filename as stored in
        trackResult.

        :param trackResult: the object to store information in.
        :type  trackResult: result.TrackResult
        """
        if trackResult.number == 0:
            start, stop = self.getHTOA()
        else:
            start = self.result.table.getTrackStart(trackResult.number)
            stop = self.result.table.getTrackEnd(trackResult.number)

        dirname = os.path.dirname(trackResult.filename)
        if not os.path.exists(dirname):
            os.makedirs(dirname)

        if not what:
            what = 'track %d' % (trackResult.number, )

        t = cdparanoia.ReadVerifyTrackTask(trackResult.filename,
                                           self.result.table,
                                           start,
                                           stop,
                                           overread,
                                           offset=offset,
                                           device=device,
                                           taglist=taglist,
                                           what=what)

        runner.run(t)

        logger.debug('ripped track')
        logger.debug('test speed %.3f/%.3f seconds', t.testspeed,
                     t.testduration)
        logger.debug('copy speed %.3f/%.3f seconds', t.copyspeed,
                     t.copyduration)
        trackResult.testcrc = t.testchecksum
        trackResult.copycrc = t.copychecksum
        trackResult.peak = t.peak
        trackResult.quality = t.quality
        trackResult.testspeed = t.testspeed
        trackResult.copyspeed = t.copyspeed
        # we want rerips to add cumulatively to the time
        trackResult.testduration += t.testduration
        trackResult.copyduration += t.copyduration

        if trackResult.filename != t.path:
            trackResult.filename = t.path
            logger.info('filename changed to %r', trackResult.filename)
Example #2
0
    def ripTrack(self,
                 runner,
                 trackResult,
                 offset,
                 device,
                 taglist,
                 overread,
                 what=None,
                 coverArtPath=None):
        """
        Rip and store a track of the disc.

        Ripping the track may change the track's filename as stored in
        trackResult.

        :param runner: synchronous track rip task
        :type runner: task.SyncRunner
        :param trackResult: the object to store information in
        :type trackResult: result.TrackResult
        :param offset: ripping offset, in CD frames
        :type offset: int
        :param device: path to the hardware disc drive
        :type device: str
        :param taglist: dictionary of tags for the given track
        :type taglist: dict
        :param overread: whether to force overreading into the
                         lead-out portion of the disc
        :type overread: bool
        :param what: a string representing what's being read; e.g. Track
        :type what: str or None
        """
        if trackResult.number == 0:
            start, stop = self.getHTOA()
        else:
            start = self.result.table.getTrackStart(trackResult.number)
            stop = self.result.table.getTrackEnd(trackResult.number)

        dirname = os.path.dirname(trackResult.filename)
        os.makedirs(dirname, exist_ok=True)

        if not what:
            what = 'track %d' % (trackResult.number, )

        t = cdparanoia.ReadVerifyTrackTask(trackResult.filename,
                                           self.result.table,
                                           start,
                                           stop,
                                           overread,
                                           offset=offset,
                                           device=device,
                                           taglist=taglist,
                                           what=what,
                                           coverArtPath=coverArtPath)

        runner.run(t)

        logger.debug('ripped track')
        logger.debug('test speed %.3f/%.3f seconds', t.testspeed,
                     t.testduration)
        logger.debug('copy speed %.3f/%.3f seconds', t.copyspeed,
                     t.copyduration)
        trackResult.testcrc = t.testchecksum
        trackResult.copycrc = t.copychecksum
        trackResult.peak = t.peak
        trackResult.quality = t.quality
        trackResult.testspeed = t.testspeed
        trackResult.copyspeed = t.copyspeed
        # we want rerips to add cumulatively to the time
        trackResult.testduration += t.testduration
        trackResult.copyduration += t.copyduration

        if trackResult.filename != t.path:
            trackResult.filename = t.path
            logger.info('filename changed to %r', trackResult.filename)