Skip to content

Instantly share code, notes, and snippets.

@rinsuki
Created August 31, 2024 15:58
Show Gist options
  • Select an option

  • Save rinsuki/d3526c637ee6a1ac0bc10b55a0ef426b to your computer and use it in GitHub Desktop.

Select an option

Save rinsuki/d3526c637ee6a1ac0bc10b55a0ef426b to your computer and use it in GitHub Desktop.

Revisions

  1. rinsuki created this gist Aug 31, 2024.
    3 changes: 3 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    Check Picard plugin location with https://picard-docs.musicbrainz.org/en/troubleshooting/does_not_start.html and place to subdirectory of plugins folder.

    e.g. on macOS, `~/Library/Preferences/MusicBrainz/Picard/plugins/shiftjis-wav/__init__.py`
    17 changes: 17 additions & 0 deletions __init__.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    from picard import log
    from picard.formats.wav import RiffListInfo

    PLUGIN_API_VERSIONS = ["2.2"]

    # trying to patch here https://github.com/metabrainz/picard/blob/4d49ac4bfb9bed3c87ddd843d81235561b3b32bd/picard/formats/wav.py#L143-L149
    @staticmethod
    def decode(value: bytes):
    log.debug(f"patched decoder {value}")
    try:
    value = value.decode('utf-8')
    except UnicodeDecodeError:
    value = value.decode('shift-jis')
    return value.rstrip('\0')

    # https://docs.python.org/3/tutorial/classes.html#private-variables
    RiffListInfo._RiffListInfo__decode_data = decode