album artist
This commit is contained in:
parent
d258b93347
commit
0b1c8806a2
BIN
arts/Aperture Science Psychoacoustics Laboratories_Portal_.png
Executable file
BIN
arts/Aperture Science Psychoacoustics Laboratories_Portal_.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
24
mobject.py
24
mobject.py
@ -1,4 +1,4 @@
|
|||||||
from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB, Encoding, PictureType
|
from mutagen.id3 import ID3, APIC, TIT2, TPE1, TPE2, TALB, Encoding, PictureType
|
||||||
from mutagen.flac import FLAC, Picture
|
from mutagen.flac import FLAC, Picture
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import io
|
import io
|
||||||
@ -21,6 +21,9 @@ class MObject:
|
|||||||
def get_album(self) -> list[str]:
|
def get_album(self) -> list[str]:
|
||||||
raise Exception("unimplemented")
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
|
def get_album_artist(self) -> list[str]:
|
||||||
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
def get_artist(self) -> list[str]:
|
def get_artist(self) -> list[str]:
|
||||||
raise Exception("unimplemented")
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
@ -30,6 +33,9 @@ class MObject:
|
|||||||
def set_artist(self, val : list[str]) -> None:
|
def set_artist(self, val : list[str]) -> None:
|
||||||
raise Exception("unimplemented")
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
|
def set_album_artist(self, val : list[str]) -> None:
|
||||||
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
def set_album(self, val : list[str]) -> None:
|
def set_album(self, val : list[str]) -> None:
|
||||||
raise Exception("unimplemented")
|
raise Exception("unimplemented")
|
||||||
|
|
||||||
@ -78,6 +84,16 @@ class MMP3Object(MObject):
|
|||||||
self._file_io.seek(0)
|
self._file_io.seek(0)
|
||||||
self._id3.save(self._file_io)
|
self._id3.save(self._file_io)
|
||||||
|
|
||||||
|
def get_album_artist(self) -> list[str]:
|
||||||
|
return self._id3.get("TPE2")
|
||||||
|
|
||||||
|
def set_album_artist(self, val : list[str]) -> None:
|
||||||
|
self._id3.delall("TPE2")
|
||||||
|
self._id3.add(TPE2(text = val))
|
||||||
|
|
||||||
|
self._file_io.seek(0)
|
||||||
|
self._id3.save(self._file_io)
|
||||||
|
|
||||||
def get_cover(self) -> bytes:
|
def get_cover(self) -> bytes:
|
||||||
cover = self._id3.getall("APIC")
|
cover = self._id3.getall("APIC")
|
||||||
if (cover == None or len(cover) == 0):
|
if (cover == None or len(cover) == 0):
|
||||||
@ -118,6 +134,12 @@ class MFLACObject(MObject):
|
|||||||
self._file_io.seek(0)
|
self._file_io.seek(0)
|
||||||
self._flac.save(self._file_io)
|
self._flac.save(self._file_io)
|
||||||
|
|
||||||
|
def get_album_artist(self) -> list[str]:
|
||||||
|
return self.get_artist()
|
||||||
|
|
||||||
|
def set_album_artist(self, val : list[str]) -> None:
|
||||||
|
return self.set_artist(val)
|
||||||
|
|
||||||
def get_artist(self) -> list[str]:
|
def get_artist(self) -> list[str]:
|
||||||
return self._flac.get("ARTIST")
|
return self._flac.get("ARTIST")
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ def process_file(f: str, odir: str):
|
|||||||
f" Title: \"{mobj.get_title()}\" -> \"{title}\"")
|
f" Title: \"{mobj.get_title()}\" -> \"{title}\"")
|
||||||
|
|
||||||
mobj.set_artist(artist)
|
mobj.set_artist(artist)
|
||||||
|
mobj.set_album_artist(artist)
|
||||||
mobj.set_album(album)
|
mobj.set_album(album)
|
||||||
mobj.set_title(title)
|
mobj.set_title(title)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user