- An android device capable of running Termux
- A music player app capable of showing notifications of current music being played
- Optionally a Google Pixel device if you want to detect Music playing around you.
- Install Termux and Termux:API apps from F-Droid.
- Launch Termux and run the following commands
apt update && apt dist-upgrade -y && apt update && apt install -y git nano python python-pip termux-api && chmod -w /data/data/com.termux/files/usr/libexec/termux-am/am.apk && git clone https://github.com/likeadragonmaid/Ongaku && cd ongaku && pip install virtualenv && virtualenv venv --system-site-packages && source venv/bin/activate && pip install -r requirements.txt && deactivate && cd .. && termux-notification-list
Optionally you can also add neofetch support by running
apt install -y neofetch python-pillow
You will be asked to provide notification access to Termux:API app. You must provide Termux:API app all the required permissions. You may be required to do Ctrl+C to continue.
-
When you run the Ongaku for the first time you are asked to enter your phone number to create a session. Ongaku uses this session to work with your telegram account.
-
Create a
config.envfile fromsample-config.env
$ cd ongaku && cp sample-config.env config.env
Edit config.env as instructed by the file itself.
$ nano config.env
-
You can get
API_IDandAPI_HASHfrom here. -
You can use this app to check package name of your music player app and add it to
MUSIC_PLAYERvalue. If you want to detect Music playing around you (pixel devices only) uncommentNOW_PLAYING_PIXEL_MODEand set it to 1. If enabled it will override your Music Player. -
To optionally get
LOG_CHANNELcreate a private telegram channel and send a random message in it. After that forward that message to @username_to_id_bot on telegram or here. -
You can leave out
STRING_SESSIONfor now by uncommenting it. -
Starting IDBot on telegram will also give you your own ID. Put that in
USERSvalue.
Use Ctrl+X to exit and save your changes.
-
Run
./launchinside the rootongakudirectory. You will receive yourSTRING_SESSIONin your saved messages in telegram app. -
Copy the session text and edit your
config.envfile once again by runningnano config.env -
Paste your session text according to the instructions in the file.
Use Ctrl+X to exit and save your changes.
-
Run
./launchinsideongakudirectory once again. -
If this is your first time launching Ongaku then you will be asked to enter your phone number to login. Next launches will work without having to re-login.
-
If everything went well you should be up and running. At this point you can start playing music and you should see current playing song in the Termux app and your telegram bio.
- Ongaku may stop detecting notifications and responding to commands if you
RELEASE WAKELOCKwhile it is running! It handles android wakelocks automatically. - If you frequently switch between multiple music players, you may want to keep multiple
config.envfiles. You can make any number of.envfiles named likeconfig-1.env, config-2.env, config-3.env...and so on. To keep any one the file active at one time, you just have to rename that file toconfig.envand use launch script as usual.
- Ongaku cannot yet differentiate between the states of music player itself i.e.
Playing,PausedandStopped. It simply assumes existing music player notification as aPlayingstate. - It is not yet possible to run Ongaku on a baremetal server or a VPS/PaaS such as Heroku.
- Devices running MIUI are unsupported as Xiaomi loves to corrupt notification permission after X amount of hours and even at each device reboot. However you can still use Ongaku if you are willing to provide notification access manually by uninstalling Termux:API app, reinstalling it again, running
termux-notification-listand lastly doingCtrl + Ceach time Ongaku starts malfunctioning! This is something you can also fix by running a reputable custom rom such as LineageOS. (#RipBozo 💯🤣🤣 if you choose to run MIUI on your phone anyway)
Send in any DM or Group chat
.about to view info about the project.
.history to get list of music played in current session.
.sync to force sync bio with latest notification.
.alive to get environment information in GIF format (not actual mp4 video with no audio scam format).
.alive -t to get environment information in text format.
This project is provided as is without any warranty. Telegram may ban your account for using Ongaku if your account is only 6 months old or for any other reason but it MAY be recovered as well if you explain your situtaion by writing to them at recover@telegram.org. The authors take no responsibilty of your device or your Telegram acount!
