Show synced lyric in the touch-bar with BetterTouchTool and NetEase APIs. Based on the idea of Kashi.
#Note: Only tested with Catalina. If you are on Mojave, please clone the repo and change the the following code:
edit touchbar_lyric/__init__.py
change the code in get_info
(basically change Music
to iTunes
)
else if application "Music" is running then
tell application "Music"
set currentInfo to {"Music", artist of current track, "###", name of current track, player position, player state, duration of current track}
end tell
end if
to
else if application "iTunes" is running then
tell application "iTunes"
set currentInfo to {"iTunes", artist of current track, "###", name of current track, player position, player state, duration of current track}
end tell
end if
the execute the following command in the directory of the repo:
pip install --editable .
- Netease music web apis for synced lyrics;
- cachier to cache function calls and reduce the need to call webapis;
- Apple script for Spotify & iTunes/Music background track information;
- Support for English/Chinese;
First check your python version, which should be 3.6+. All commands should be executed in your terminal.
python3 --version
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
You might want to restart your terminal.
pip3 install touchbar_lyric
Take a note for the python3 path. We will refer it as ${PYTHONPATH}
whereis python3
Same as Kashi:
- Copy&paste the content in
lyric.json
in Meun Bar > Touch Bar; - Change the python path
/Users/chenghaomou/Anaconda/bin/python
to your own python path in the script area; - Optional: You can use pubproxy api to remedy netease's anti-crawler mechanism.
${PYTHONPATH} -m touchbar_lyric --api ${PUBPROXY_API}
Where --api ${PUBPROXY_API}
is optional.
Note: In case there is no synced lyric, each sentence will be displayed at an evenly time interval.