Merge pull request #57 from roadt/feature

add track no
This commit is contained in:
codezjx 2021-06-04 11:42:04 +08:00 committed by GitHub
commit 9622e98f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from mutagen.mp3 import MP3, HeaderNotFoundError from mutagen.mp3 import MP3, HeaderNotFoundError
from mutagen.id3 import ID3, APIC, TPE1, TIT2, TALB, error from mutagen.id3 import ID3, APIC, TPE1, TIT2, TALB, TRCK, error
from PIL import Image from PIL import Image
@ -72,4 +72,11 @@ def add_metadata_to_song(file_path, cover_path, song):
text=song['album']['name'] text=song['album']['name']
) )
) )
#add track no
id3.add(
TRCK(
encoding=3,
text="%s/%s" %(song['no'],song['album']['size'])
)
)
id3.save(v2_version=3) id3.save(v2_version=3)