Example #1
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.m4a = mp4.MP4(path)
        f = self.m4a

        self.title = l(f.get(b'\xa9nam'))
        self.discnumber = reader.number(l(f.get(b'disk')))
        self.tracknumber = reader.number(l(f.get(b'trkn')))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = l(
            f.get(b'----:com.apple.iTunes:MusicBrainz Track Id'))
        self.genres = f.get(b'\xa9gen')

        artist = reader.Artist()
        artist.name = l(f.get(b'\xa9ART'))
        artist.sortname = l(f.get(b'soar'))
        artist.musicbrainz_artistid = [
            i.decode('utf-8')
            for i in f.get(b'----:com.apple.iTunes:MusicBrainz Artist Id', [])
        ]
        self.artist = artist

        for a, i in zip(
                f.get(b'----:com.apple.iTunes:ARTISTS', []),
                f.get(b'----:com.apple.iTunes:MusicBrainz Artist Id', []),
        ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get(b'\xa9alb'))
        album.date = l(f.get(b'\xa9day'))
        album.country = l(
            f.get(b'----:com.apple.iTunes:MusicBrainz Album Release Country'))
        album.musicbrainz_albumid = l(
            f.get(b'----:com.apple.iTunes:MusicBrainz Album Id'))
        album.musicbrainz_releasegroupid = l(
            f.get(b'----:com.apple.iTunes:MusicBrainz Release Group Id'))
        album.labels = f.get(b'----:com.apple.iTunes:LABEL')
        album.albumtypes = f.get(
            b'----:com.apple.iTunes:MusicBrainz Album Type')
        album.albumstatus = f.get(
            b'----:com.apple.iTunes:MusicBrainz Album Status')

        albumartist = reader.Artist()
        albumartist.name = l(f.get(b'aART'))
        albumartist.sortname = l(f.get(b'soaa'))
        albumartist.musicbrainz_artistid = [
            i.decode('utf-8') for i in f.get(
                b'----:com.apple.iTunes:MusicBrainz Album Artist Id', [])
        ]
        album.artist = albumartist

        self.album = album
Example #2
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.mp3 = MP3(path)

        self.title = self.mp3.get('TIT2')
        self.discnumber = reader.number(self.mp3.get('TPOS'))
        self.tracknumber = reader.number(self.mp3.get('TRCK'))
        self.length = int(self.mp3.info.length)
        self.bitrate = int(self.mp3.info.bitrate)

        self.musicbrainz_trackid = reader.data(
            self.mp3.get('UFID:http://musicbrainz.org'))
        self.genres = reader.item_to_list(self.mp3.get('TCON'))

        artist = reader.Artist()
        artist.name = l(self.mp3.get('TPE1'))
        artist.sortname = l(self.mp3.get('TSOP'))
        artist.musicbrainz_artistid = reader.item_to_list(
            self.mp3.get('TXXX:MusicBrainz Artist Id'))
        self.artist = artist

        for a, i in zip(
                reader.item_to_list(self.mp3.get('TXXX:Artists')) or [],
                reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Artist Id'))
                or [],
        ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(self.mp3.get('TALB'))
        album.date = l(self.mp3.get('TDOR') or self.mp3.get('TDRC'))
        album.country = l(
            self.mp3.get('TXXX:MusicBrainz Album Release Country'))
        album.musicbrainz_albumid = str(
            self.mp3.get('TXXX:MusicBrainz Album Id'))
        album.musicbrainz_releasegroupid = str(
            self.mp3.get('TXXX:MusicBrainz Release Group Id'))
        album.labels = reader.item_to_list(self.mp3.get('TPUB'))
        album.albumtypes = reader.item_to_list(
            self.mp3.get('TXXX:MusicBrainz Album Type'))
        album.albumstatus = reader.item_to_list(
            self.mp3.get('TXXX:MusicBrainz Album Status'))

        albumartist = reader.Artist()
        albumartist.name = l(self.mp3.get('TPE2'))
        albumartist.sortname = l(self.mp3.get('TSO2'))
        albumartist.musicbrainz_artistid = reader.item_to_list(
            self.mp3.get('TXXX:MusicBrainz Album Artist Id'))
        album.artist = albumartist

        self.album = album
Example #3
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.wma = ASF(path)
        f = self.wma

        self.title = l(f.get('Title'))
        self.discnumber = reader.number(l(f.get('WM/PartOfSet')))
        self.tracknumber = reader.number(l(f.get('WM/TrackNumber')))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = v(l(f.get('MusicBrainz/Track Id')))
        self.genres = f.get('WM/Genre')

        artist = reader.Artist()
        artist.name = l(f.get('Author'))
        artist.sortname = l(f.get('WM/ArtistSortOrder'))
        artist.musicbrainz_artistid = [
            v(i) for i in f.get('MusicBrainz/Artist Id', [])
        ]
        self.artist = artist

        for a, i in zip(
                f.get('WM/ARTISTS', []),
                f.get('MusicBrainz/Artist Id', []),
        ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = v(i)
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get('WM/AlbumTitle'))
        album.date = l(f.get('WM/OriginalReleaseYear') or f.get('WM/Year'))
        album.country = l(f.get('MusicBrainz/Album Release Country'))
        album.musicbrainz_albumid = v(l(f.get('MusicBrainz/Album Id')))
        album.musicbrainz_releasegroupid = v(
            l(f.get('MusicBrainz/Release Group Id')))
        album.labels = f.get('WM/Publisher')
        album.albumtypes = f.get('MusicBrainz/Album Type')
        album.albumstatus = f.get('MusicBrainz/Album Status')

        albumartist = reader.Artist()
        albumartist.name = l(f.get('WM/AlbumArtist'))
        albumartist.sortname = l(f.get('WM/AlbumArtistSortOrder'))
        albumartist.musicbrainz_artistid = [
            v(i) for i in f.get('MusicBrainz/Album Artist Id', [])
        ]
        album.artist = albumartist

        self.album = album
Example #4
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.mpc = Musepack(path)
        f = self.mpc

        self.title = f.get('Title')
        self.discnumber = reader.number(f.get('Disc'))
        self.tracknumber = reader.number(f.get('Track'))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = reader.value(f.get('Musicbrainz_Trackid'))
        self.genres = reader.item_to_list(f.get('Genre'))

        artist = reader.Artist()
        artist.name = f.get('Artist')
        artist.sortname = f.get('Artistsort')
        artist.musicbrainz_artistids = reader.item_to_list(
            f.get('Musicbrainz_Artistid'))
        self.artist = artist

        for a, i in zip(
                reader.item_to_list(f.get('Artists')),
                reader.item_to_list(f.get('Musicbrainz_Artistid')),
        ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = f.get('Album')
        album.date = f.get('Originaldate') or f.get('Year')
        album.country = f.get('Releasecountry')
        album.musicbrainz_albumid = reader.value(f.get('Musicbrainz_Albumid'))
        album.musicbrainz_releasegroupid = reader.value(
            f.get('Musicbrainz_Releasegroupid'))
        album.labels = reader.item_to_list(f.get('Label'))
        album.albumtypes = reader.item_to_list(f.get('MUSICBRAINZ_ALBUMTYPE'))
        album.albumstatus = reader.item_to_list(
            f.get('MUSICBRAINZ_ALBUMSTATUS'))

        albumartist = reader.Artist()
        albumartist.name = f.get('Album Artist') or f.get('Albumartist')
        albumartist.sortname = f.get('Albumartistsort')
        albumartist.musicbrainz_artistid = reader.item_to_list(
            f.get('Musicbrainz_Albumartistid'))
        album.artist = albumartist

        self.album = album
Example #5
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.flac = FLAC(path)
        f = self.flac

        self.title = l(f.get('title'))
        self.discnumber = reader.number(l(f.get('discnumber')))
        self.tracknumber = reader.number(l(f.get('tracknumber')))
        self.length = int(f.info.length)
        #self.bitrate

        self.musicbrainz_trackid = l(f.get('musicbrainz_trackid'))
        self.genres = f.get('genre')

        artist = reader.Artist()
        artist.name = l(f.get('artist'))
        artist.sortname = l(f.get('artistsort'))
        artist.musicbrainz_artistid = f.get('musicbrainz_artistid')
        self.artist = artist

        for a, i in zip(
                f.get('Artists', []),
                f.get('musicbrainz_artistid', []),
        ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get('album'))
        album.date = l(f.get('originaldate') or f.get('date'))
        album.country = l(f.get('releasecountry'))
        album.musicbrainz_albumid = l(f.get('musicbrainz_albumid'))
        album.musicbrainz_releasegroupid = l(
            f.get('musicbrainz_releasegroupid'))
        album.labels = f.get('label')
        album.albumtypes = f.get('releasetype')
        album.albumstatus = f.get('releasestatus')

        albumartist = reader.Artist()
        albumartist.name = l(f.get('albumartist') or f.get('album artist'))
        albumartist.sortname = l(f.get('albumartistsort'))
        albumartist.musicbrainz_artistid = f.get('musicbrainz_albumartistid')
        album.artist = albumartist

        self.album = album
Example #6
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.m4a = mp4.MP4(path)
        f = self.m4a

        self.title = l(f.get(b'\xa9nam'))
        self.discnumber = reader.number(l(f.get(b'disk')))
        self.tracknumber = reader.number(l(f.get(b'trkn')))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Track Id'))
        self.genres = f.get(b'\xa9gen')

        artist = reader.Artist()
        artist.name = l(f.get(b'\xa9ART'))
        artist.sortname = l(f.get(b'soar'))
        artist.musicbrainz_artistid = [ i.decode('utf-8') for i in f.get(b'----:com.apple.iTunes:MusicBrainz Artist Id', []) ]
        self.artist = artist

        for a, i in zip(
                f.get(b'----:com.apple.iTunes:ARTISTS', []),
                f.get(b'----:com.apple.iTunes:MusicBrainz Artist Id', []),
                ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get(b'\xa9alb'))
        album.date = l(f.get(b'\xa9day'))
        album.country = l(f.get(b'----:com.apple.iTunes:MusicBrainz Album Release Country'))
        album.musicbrainz_albumid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Album Id'))
        album.musicbrainz_releasegroupid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Release Group Id'))
        album.labels = f.get(b'----:com.apple.iTunes:LABEL')
        album.albumtypes = f.get(b'----:com.apple.iTunes:MusicBrainz Album Type')
        album.albumstatus = f.get(b'----:com.apple.iTunes:MusicBrainz Album Status')

        albumartist = reader.Artist()
        albumartist.name = l(f.get(b'aART'))
        albumartist.sortname = l(f.get(b'soaa'))
        albumartist.musicbrainz_artistid = [ i.decode('utf-8') for i in f.get(b'----:com.apple.iTunes:MusicBrainz Album Artist Id', []) ]
        album.artist = albumartist

        self.album = album
Example #7
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.ape = MonkeysAudio(path)
        f = self.ape

        self.title = f.get('Title')
        self.discnumber = reader.number(f.get('Disc'))
        self.tracknumber = reader.number(f.get('Track'))
        self.length = int(f.info.length)
        #self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = reader.value(f.get('Musicbrainz_Trackid'))
        self.genres = reader.item_to_list(f.get('Genre'))

        artist = reader.Artist()
        artist.name = f.get('Artist')
        artist.sortname = f.get('Artistsort')
        artist.musicbrainz_artistid = reader.item_to_list(f.get('Musicbrainz_Artistid'))
        self.artist = artist

        for a, i in zip(
                reader.item_to_list(f.get('Artists', [])),
                reader.item_to_list(f.get('Musicbrainz_Artistid', [])),
                ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = f.get('Album')
        album.date = f.get('Originaldate') or f.get('Year')
        album.country = f.get('Releasecountry')
        album.musicbrainz_albumid = reader.value(f.get('Musicbrainz_Albumid'))
        album.musicbrainz_releasegroupid = reader.value(f.get('Musicbrainz_Releasegroupid'))
        album.labels = reader.item_to_list(f.get('Label'))
        album.albumtypes = reader.item_to_list(f.get('MUSICBRAINZ_ALBUMTYPE'))
        album.albumstatus = reader.item_to_list(f.get('MUSICBRAINZ_ALBUMSTATUS'))

        albumartist = reader.Artist()
        albumartist.name = f.get('Album Artist') or f.get('Albumartist')
        albumartist.sortname = f.get('Albumartistsort')
        albumartist.musicbrainz_artistid = reader.item_to_list(f.get('Musicbrainz_Albumartistid'))
        album.artist = albumartist

        self.album = album
Example #8
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.mp3 = MP3(path)

        self.title = self.mp3.get('TIT2')
        self.discnumber = reader.number(self.mp3.get('TPOS'))
        self.tracknumber = reader.number(self.mp3.get('TRCK'))
        self.length = int(self.mp3.info.length)
        self.bitrate = int(self.mp3.info.bitrate)

        self.musicbrainz_trackid = reader.data(self.mp3.get('UFID:http://musicbrainz.org'))
        self.genres = reader.item_to_list(self.mp3.get('TCON'))

        artist = reader.Artist()
        artist.name = l(self.mp3.get('TPE1'))
        artist.sortname = l(self.mp3.get('TSOP'))
        artist.musicbrainz_artistid = reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Artist Id'))
        self.artist = artist

        for a, i in zip(
                reader.item_to_list(self.mp3.get('TXXX:Artists')) or [],
                reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Artist Id')) or [],
                ):
            artist = reader.Artist()
            artist.name = a
            artist.musicbrainz_artistid = i
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(self.mp3.get('TALB'))
        album.date = l(self.mp3.get('TDOR') or self.mp3.get('TDRC'))
        album.country = l(self.mp3.get('TXXX:MusicBrainz Album Release Country'))
        album.musicbrainz_albumid = str(self.mp3.get('TXXX:MusicBrainz Album Id'))
        album.musicbrainz_releasegroupid = str(self.mp3.get('TXXX:MusicBrainz Release Group Id'))
        album.labels = reader.item_to_list(self.mp3.get('TPUB'))
        album.albumtypes = reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Album Type'))
        album.albumstatus = reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Album Status'))

        albumartist = reader.Artist()
        albumartist.name = l(self.mp3.get('TPE2'))
        albumartist.sortname = l(self.mp3.get('TSO2'))
        albumartist.musicbrainz_artistid = reader.item_to_list(self.mp3.get('TXXX:MusicBrainz Album Artist Id'))
        album.artist = albumartist

        self.album = album
Example #9
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.wma = ASF(path)
        f = self.wma

        self.title = l(f.get('Title'))
        self.discnumber = reader.number(l(f.get('WM/PartOfSet')))
        self.tracknumber = reader.number(l(f.get('WM/TrackNumber')))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = l(f.get('MusicBrainz/Track Id'))
        self.genres = f.get('WM/Genre')

        artist = reader.Artist()
        artist.name = l(f.get('Author'))
        artist.sortname = l(f.get('WM/ArtistSortOrder'))
        #artist.musicbrainz_artistid = self.mp3.get('TXXX:MusicBrainz Artist Id')[0]
        self.artist = artist

        for a in f.get('WM/ARTISTS', []):
            artist = reader.Artist()
            artist.name = a
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get('WM/AlbumTitle'))
        album.date = l(f.get('WM/OriginalReleaseYear') or f.get('WM/Year'))
        album.country = l(f.get('MusicBrainz/Album Release Country'))
        album.musicbrainz_albumid = l(f.get('MusicBrainz/Album Id'))
        album.musicbrainz_releasegroupid = l(f.get('MusicBrainz/Release Group Id'))
        album.labels = f.get('WM/Publisher')
        album.albumtypes = f.get('MusicBrainz/Album Type')
        album.albumstatus = f.get('MusicBrainz/Album Status')

        albumartist = reader.Artist()
        albumartist.name = l(f.get('WM/AlbumArtist'))
        albumartist.sortname = l(f.get('WM/AlbumArtistSortOrder'))
        album.artist = albumartist

        self.album = album
Example #10
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.flac = FLAC(path)
        f = self.flac

        self.title = l(f.get('title'))
        self.discnumber = reader.number(l(f.get('discnumber')))
        self.tracknumber = reader.number(l(f.get('tracknumber')))
        self.length = int(f.info.length)
        #self.bitrate

        self.musicbrainz_trackid = l(f.get('musicbrainz_trackid'))
        self.genres = f.get('genre')

        artist = reader.Artist()
        artist.name = l(f.get('artist'))
        artist.sortname = l(f.get('artistsort'))
        #artist.musicbrainz_artistid = self.mp3.get('TXXX:MusicBrainz Artist Id')[0]
        self.artist = artist

        for a in f.get('Artists', []):
            artist = reader.Artist()
            artist.name = a
            self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get('album'))
        album.date = l(f.get('originaldate') or f.get('date'))
        album.country = l(f.get('releasecountry'))
        album.musicbrainz_albumid = l(f.get('musicbrainz_albumid'))
        album.musicbrainz_releasegroupid = l(f.get('musicbrainz_releasegroupid'))
        album.labels = f.get('label')
        album.albumtypes = f.get('releasetype')
        album.albumstatus = f.get('releasestatus')

        albumartist = reader.Artist()
        albumartist.name = l(f.get('albumartist') or f.get('album artist'))
        albumartist.sortname = l(f.get('albumartistsort'))
        album.artist = albumartist

        self.album = album
Example #11
0
    def __init__(self, path):
        super(Track, self).__init__(path)
        self.m4a = MP4(path)
        f = self.m4a

        self.title = l(f.get(b'\xa9nam'))
        self.discnumber = reader.number(l(f.get(b'disk')))
        self.tracknumber = reader.number(l(f.get(b'trkn')))
        self.length = int(f.info.length)
        self.bitrate = int(f.info.bitrate)

        self.musicbrainz_trackid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Track Id'))
        self.genres = f.get(b'\xa9gen')

        artist = reader.Artist()
        artist.name = l(f.get(b'\xa9ART'))
        artist.sortname = l(f.get(b'soar'))
        #artist.musicbrainz_artistid = self.mp3.get('TXXX:MusicBrainz Artist Id')[0]
        self.artists.append(artist)

        album = reader.Album()
        album.title = l(f.get(b'\xa9alb'))
        album.date = l(f.get(b'\xa9day'))
        album.country = l(f.get(b'----:com.apple.iTunes:MusicBrainz Album Release Country'))
        album.musicbrainz_albumid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Album Id'))
        album.musicbrainz_releasegroupid = l(f.get(b'----:com.apple.iTunes:MusicBrainz Release Group Id'))
        album.labels = f.get(b'----:com.apple.iTunes:LABEL')
        album.albumtypes = f.get(b'----:com.apple.iTunes:MusicBrainz Album Type')
        album.albumstatus = f.get(b'----:com.apple.iTunes:MusicBrainz Album Status')

        albumartist = reader.Artist()
        albumartist.name = l(f.get(b'aART'))
        albumartist.sortname = l(f.get(b'soaa'))
        album.albumartists.append(albumartist)

        self.album = album