示例#1
0
 def test_playlist_metadata(self):
     for id in ['37i9dQZF1DXc9orRugI29r', '4365127622']:
         playlist = self.deezer.get_playlist(id)
         for track in playlist.songs:
             track.update_tags(self.deezer)
             tagger = Tagger(track, '.flac')
             self.assertTrue(cover_tester(track.album.picture_url))
示例#2
0
    def _tag_flac(self, file):
        """
        Tag Flac file only called from `track.tag()`
        """
        tagger = Tagger(self, '.flac')
        tag = FLAC(file)
        tag.delete()

        for tag_obj in tagger.tag_map:
            tag[tag_obj.key] = str(tag_obj.value)

        # image
        if cc.tag_cover and self.album.picture_url is not None:
            cover_data = self.get_cover_data()
            if cover_data:
                img = Picture()
                img.type = 3
                img.data = cover_data
                tag.clear_pictures()
                tag.add_picture(img)
            else:
                log.warning(f'No Cover for {self}')
        tag.save()
示例#3
0
    def _tag_mp3(self, file):
        """
        Tag Mp3 file only called from `track.tag()`
        """
        tagger = Tagger(self, '.mp3')
        tag = EasyMP3(file)
        EasyID3.RegisterTextKey('comment', 'COMM')
        tag.delete()

        for tag_obj in tagger.tag_map:
            tag[tag_obj.key] = str(tag_obj.value)
        tag.save()

        # image
        if cc.tag_cover and self.album.picture_url is not None:
            cover_data = self.get_cover_data()
            if cover_data:
                audio = MP3(file, ID3=ID3)
                audio.tags.add(
                    APIC(encoding=3,
                         mime='image/jpeg',
                         type=3,
                         desc=u'Cover',
                         data=cover_data))
                audio.save()
            else:
                log.warning(f'No Cover for {self}')

        # lyrics
        if cc.tag_lyrics:
            if self.lyrics != None:
                tag = ID3(file)
                tag[u"USLT::'eng'"] = (USLT(encoding=3,
                                            lang=u'eng',
                                            desc=u'desc',
                                            text=self.lyrics.lyrics_text))
                tag.save()
示例#4
0
    def _tag_m4a(self, file):
        tagger = Tagger(self, '.m4a')
        tag = MP4(file)

        for tag_obj in tagger.tag_map:
            if tag_obj.key in ['trkn']:
                tnr, dnr = tag_obj.value.split('/')
                tag[tag_obj.key] = [(int(tnr), int(dnr))]
            elif tag_obj.key in ['disk']:
                tag[tag_obj.key] = [(int(tag_obj.value), 0)]
            elif tag_obj.key in ['tmpo']:
                tag[tag_obj.key] = [int(tag_obj.value)]
            else:
                tag[tag_obj.key] = str(tag_obj.value)

        if cc.tag_cover and self.album.picture_url is not None:
            cover_data = self.get_cover_data()
            if cover_data:
                tag['covr'] = [
                    MP4Cover(cover_data, imageformat=MP4Cover.FORMAT_JPEG)
                ]
            else:
                log.warning(f'No Cover for {self}')
        tag.save()
示例#5
0
 def test_album_metadata(self):
     album = self.deezer.get_album(7463461)
     for track in album.songs:
         track.update_tags(self.deezer)
         tagger = Tagger(track, '.flac')
示例#6
0
 def test_album_grab(self):
     album = self.gpm.get_album('Btak6x6jwqxkgo6b5w4gr4vuhzi')
     for track in album.songs:
         track.update_tags(self.gpm)
         tagger = Tagger(track, '.m4a')
示例#7
0
 def test_track_metadata(self):
     track = self.deezer.get_track(698905582)
     track.update_tags(self.deezer)
     tagger = Tagger(track, '.flac')
示例#8
0
 def test_playlist_metadata(self):
     playlist = self.qobuz.get_playlist(1784198)
     for track in playlist.songs:
         track.update_tags(self.qobuz)
         tagger = Tagger(track, '.flac')
示例#9
0
 def test_track_grab(self):
     track = self.gpm.get_track('Tswhyxgv4dkxo5ikcwrz7qrtmiy')
     track.update_tags(self.gpm)
     tagger = Tagger(track, '.m4a')
示例#10
0
 def test_track_metadata(self):
     track = self.qobuz.get_track(64366361)
     status = track.update_tags(self.qobuz)
     tagger = Tagger(track, '.flac')
示例#11
0
 def test_album_metadata(self):
     album = self.qobuz.get_album('wu7uac4147csc')
     for track in album.songs:
         track.update_tags(self.qobuz)
         tagger = Tagger(track, '.flac')
示例#12
0
 def test_album_metadata(self):
     album = self.napster.get_album('alb.365693020')
     for track in album.songs:
         track.update_tags(self.napster)
         tagger = Tagger(track, '.m4a')
示例#13
0
 def test_track_metadata(self):
     track = self.napster.get_track(365693021)
     track.update_tags(self.napster)
     tagger = Tagger(track, '.m4a')
示例#14
0
 def test_playlist_metadata(self):
     playlist = self.tidal.get_playlist(
         'ee210a7d-ffba-4fdf-a0b1-31c763b2c6d1')
     for track in playlist.songs:
         track.update_tags(self.tidal)
         tagger = Tagger(track, '.flac')
示例#15
0
 def test_album_metadata(self):
     album = self.tidal.get_album(26531974)
     for track in album.songs:
         track.update_tags(self.tidal)
         tagger = Tagger(track, '.flac')
示例#16
0
 def test_track_metadata(self):
     track = self.tidal.get_track(113297575)
     status = track.update_tags(self.tidal)
     tagger = Tagger(track, '.flac')