Esempio n. 1
0
    def verifyImage(self, runner, table):
        """
        Verify table against AccurateRip and cue_path track lengths.

        Verify our image against the given AccurateRip responses.

        Needs an initialized self.result.
        Will set accurip and friends on each TrackResult.

        Populates self.result.tracks with above TrackResults.
        """
        cueImage = image.Image(self.cuePath)
        # assigns track lengths
        if self.skipped_tracks is not None:
            verifytask = image.ImageVerifyTask(
                cueImage,
                [os.path.basename(t.filename) for t in self.skipped_tracks])
        else:
            verifytask = image.ImageVerifyTask(cueImage)
        runner.run(verifytask)
        if verifytask.exception:
            logger.error(verifytask.exceptionMessage)
            return False

        responses = accurip.get_db_entry(table.accuraterip_path())
        logger.info('%d AccurateRip response(s) found', len(responses))

        checksums = accurip.calculate_checksums([
            os.path.join(os.path.dirname(self.cuePath), t.indexes[1].path)
            for t in [t for t in cueImage.cue.table.tracks if t.number != 0]
        ])
        if not (checksums and any(checksums['v1']) and any(checksums['v2'])):
            return False

        return accurip.verify_result(self.result, responses, checksums)
Esempio n. 2
0
    def verifyImage(self, runner, responses):
        """
        Verify our image against the given AccurateRip responses.

        Needs an initialized self.result.
        Will set accurip and friends on each TrackResult.
        """

        logger.debug('verifying Image against %d AccurateRip responses',
                     len(responses or []))

        cueImage = image.Image(self.cuePath)
        verifytask = image.ImageVerifyTask(cueImage)
        cuetask = image.AccurateRipChecksumTask(cueImage)
        runner.run(verifytask)
        runner.run(cuetask)

        self._verifyImageWithChecksums(responses, cuetask.checksums)