Utils#
Reader#
- class harmonize.utils.DataReader(base64_str: str)[source]#
A utility class for reading binary data from a base 64 track. Original
- read_nullable_utf(utfm: bool = False) str | None[source]#
Reads an optional UTF string from the stream.
Internally, this just reads a bool and then a string if the bool is
True.- Parameters:
utfm (
bool) – Whether to read the string as modified UTF.- Return type:
Optional[
str]
- read_utfm() str[source]#
Reads a UTF string from the stream.
This method is different to
read_utf()as it accounts for different encoding methods utilised by Java’s streams, which uses modified UTF for character encoding.- Return type:
Fields decoding functions#
- harmonize.utils.decode_probe_info(reader: DataReader) dict[str, any][source]#
Decodes the probe information from the provided DataReader.
- Parameters:
reader (
harmonize.utils.DataReader) – The DataReader object containing the probe information.- Return type:
Note
The dictionary contains the following key and its corresponding value:
‘probe_info’: The probe information as a string.
- harmonize.utils.decode_lavasrc_fields(reader: DataReader) dict[str, any][source]#
Decodes the Lava Source fields from the provided DataReader.
- Parameters:
reader (
harmonize.utils.DataReader) – The DataReader object containing the source data.- Return type:
Note
The dictionary contains the following keys and their corresponding values:
‘albumName’: The name of the album.
‘albumUrl’: The URL of the album.
‘artistUrl’: The URL of the artist.
‘artistArtworkUrl’: The URL of the artist’s artwork.
‘previewUrl’: The URL of the preview.
‘isPreview’: A boolean indicating whether the source is a preview.