예제 #1
0
    def getMusicBrainz(self,
                       ittoc,
                       mbdiscid,
                       release=None,
                       country=None,
                       prompt=False):
        """
        @type  ittoc: L{morituri.image.table.Table}
        """
        # look up disc on musicbrainz
        self._stdout.write(
            'Disc duration: %s, %d audio tracks\n' % (common.formatTime(
                ittoc.duration() / 1000.0), ittoc.getAudioTracks()))
        self.debug('MusicBrainz submit url: %r',
                   ittoc.getMusicBrainzSubmitURL())
        ret = None

        metadatas = None
        e = None

        for _ in range(0, 4):
            try:
                metadatas = mbngs.musicbrainz(mbdiscid,
                                              country=country,
                                              record=self._record)
            except mbngs.NotFoundException, e:
                break
            except musicbrainz.NetworkError, e:
                self._stdout.write("Warning: network error: %r\n" % (e, ))
                break
예제 #2
0
    def getMusicBrainz(self, ittoc, mbdiscid, release=None, country=None, prompt=False):
        """
        @type  ittoc: L{morituri.image.table.Table}
        """
        # look up disc on musicbrainz
        self._stdout.write('Disc duration: %s, %d audio tracks\n' % (
            common.formatTime(ittoc.duration() / 1000.0),
            ittoc.getAudioTracks()))
        logger.debug('MusicBrainz submit url: %r',
            ittoc.getMusicBrainzSubmitURL())
        ret = None

        metadatas = None
        e = None

        for _ in range(0, 4):
            try:
                metadatas = mbngs.musicbrainz(mbdiscid,
                    country=country,
                    record=self._record)
            except mbngs.NotFoundException, e:
                break
            except musicbrainzngs.NetworkError, e:
                self._stdout.write("Warning: network error: %r\n" % (e, ))
                break
예제 #3
0
    def getMusicBrainz(self, ittoc, mbdiscid, release=None):
        """
        @type  ittoc: L{morituri.image.table.Table}
        """
        # look up disc on musicbrainz
        self._stdout.write('Disc duration: %s, %d audio tracks\n' % (
            common.formatTime(ittoc.duration() / 1000.0),
            ittoc.getAudioTracks()))
        self.debug('MusicBrainz submit url: %r',
            ittoc.getMusicBrainzSubmitURL())
        ret = None

        metadatas = None
        e = None

        for _ in range(0, 4):
            try:
                metadatas = mbngs.musicbrainz(mbdiscid,
                    record=self._record)
            except mbngs.NotFoundException, e:
                break
            except mbngs.MusicBrainzException, e:
                self._stdout.write("Warning: %r\n" % (e, ))
                time.sleep(5)
                continue
예제 #4
0
    def getMusicBrainz(self, ittoc, mbdiscid, release=None):
        # look up disc on musicbrainz
        self._stdout.write('Disc duration: %s\n' % common.formatTime(
            ittoc.duration() / 1000.0))
        self.debug('MusicBrainz submit url: %r',
            ittoc.getMusicBrainzSubmitURL())
        ret = None

        metadatas = None
        e = None

        for _ in range(0, 4):
            try:
                metadatas = musicbrainzngs.musicbrainz(mbdiscid,
                    record=self._record)
            except musicbrainzngs.NotFoundException, e:
                break
            except musicbrainzngs.MusicBrainzException, e:
                self._stdout.write("Warning: %r\n" % (e, ))
                time.sleep(5)
                continue
예제 #5
0
    def getMusicBrainz(self, ittoc, mbdiscid, release=None):
        # look up disc on musicbrainz
        print 'Disc duration: %s' % common.formatTime(
            ittoc.duration() / 1000.0)
        self.debug('MusicBrainz submit url: %r',
            ittoc.getMusicBrainzSubmitURL())
        ret = None

        metadatas = None
        e = None

        for _ in range(0, 4):
            try:
                metadatas = musicbrainzngs.musicbrainz(mbdiscid,
                    record=self._record)
            except musicbrainzngs.NotFoundException, e:
                break
            except musicbrainzngs.MusicBrainzException, e:
                print "Warning:", e
                time.sleep(5)
                continue
예제 #6
0
 def testFormatTime(self):
     self.assertEquals(common.formatTime(7202), '02:00:02.000')
예제 #7
0
                self._stdout.write("Error: %r\n" % (e, ))
            self._stdout.write('Continuing without metadata\n')

        if metadatas:
            deltas = {}

            self._stdout.write('\nMatching releases:\n')

            for metadata in metadatas:
                self._stdout.write('\n')
                self._stdout.write('Artist  : %s\n' %
                    metadata.artist.encode('utf-8'))
                self._stdout.write('Title   : %s\n' %
                    metadata.title.encode('utf-8'))
                self._stdout.write('Duration: %s\n' %
                    common.formatTime(metadata.duration / 1000.0))
                self._stdout.write('URL     : %s\n' % metadata.url)
                self._stdout.write('Release : %s\n' % metadata.mbid)
                self._stdout.write('Type    : %s\n' % metadata.releaseType)

                delta = abs(metadata.duration - ittoc.duration())
                if not delta in deltas:
                    deltas[delta] = []
                deltas[delta].append(metadata)

            if release:
                metadatas = [m for m in metadatas if m.url.endswith(release)]
                self.debug('Asked for release %r, only kept %r',
                    release, metadatas)
                if len(metadatas) == 1:
                    self._stdout.write('\n')
예제 #8
0
            self._stdout.write('Continuing without metadata\n')

        if metadatas:
            deltas = {}

            self._stdout.write('\nMatching releases:\n')

            for metadata in metadatas:
                self._stdout.write('\n')
                self._stdout.write('Artist  : %s\n' %
                                   metadata.artist.encode('utf-8'))
                self._stdout.write('Title   : %s\n' %
                                   metadata.title.encode('utf-8'))
                self._stdout.write(
                    'Duration: %s\n' %
                    common.formatTime(metadata.duration / 1000.0))
                self._stdout.write('URL     : %s\n' % metadata.url)
                self._stdout.write('Release : %s\n' % metadata.mbid)
                self._stdout.write('Type    : %s\n' % metadata.releaseType)
                if metadata.barcode:
                    self._stdout.write("Barcode : %s\n" % metadata.barcode)
                if metadata.catalogNumber:
                    self._stdout.write("Cat no  : %s\n" %
                                       metadata.catalogNumber)

                delta = abs(metadata.duration - ittoc.duration())
                if not delta in deltas:
                    deltas[delta] = []
                deltas[delta].append(metadata)

            lowest = None
예제 #9
0
파일: program.py 프로젝트: chadberg/whipper
        if not metadatas:
            if e:
                self._stdout.write("Error: %r\n" % (e,))
            self._stdout.write("Continuing without metadata\n")

        if metadatas:
            deltas = {}

            self._stdout.write("\nMatching releases:\n")

            for metadata in metadatas:
                self._stdout.write("\n")
                self._stdout.write("Artist  : %s\n" % metadata.artist.encode("utf-8"))
                self._stdout.write("Title   : %s\n" % metadata.title.encode("utf-8"))
                self._stdout.write("Duration: %s\n" % common.formatTime(metadata.duration / 1000.0))
                self._stdout.write("URL     : %s\n" % metadata.url)
                self._stdout.write("Release : %s\n" % metadata.mbid)
                self._stdout.write("Type    : %s\n" % metadata.releaseType)
                if metadata.barcode:
                    self._stdout.write("Barcode : %s\n" % metadata.barcode)
                if metadata.catalogNumber:
                    self._stdout.write("Cat no  : %s\n" % metadata.catalogNumber)

                delta = abs(metadata.duration - ittoc.duration())
                if not delta in deltas:
                    deltas[delta] = []
                deltas[delta].append(metadata)

            lowest = None
예제 #10
0
 def testFormatTime(self):
     self.assertEquals(common.formatTime(7202), '02:00:02.000')
예제 #11
0
                continue

        if not metadatas:
            if e:
                print "Error:", e
            print 'Continuing without metadata'

        if metadatas:
            print
            print 'Matching releases:'
            deltas = {}
            for metadata in metadatas:

                print 'Artist  : %s' % metadata.artist.encode('utf-8')
                print 'Title   : %s' % metadata.title.encode('utf-8')
                print 'Duration: %s' % common.formatTime(
                    metadata.duration / 1000.0)
                print 'URL     : %s' % metadata.url

                delta = abs(metadata.duration - ittoc.duration())
                if not delta in deltas:
                    deltas[delta] = []
                deltas[delta].append(metadata)

            if release:
                metadatas = [m for m in metadatas if m.url.endswith(release)]
                self.debug('Asked for release %r, only kept %r',
                    release, metadatas)
                if len(metadatas) == 1:
                    print
                    print 'Picked requested release id %s' % release
                    print 'Artist : %s' % metadatas[0].artist.encode('utf-8')