Giter Club home page Giter Club logo

ongaku's Introduction

A **smol and fluffy** telegram bot to update your bio with music playing on your android phone in real time!

Requirements

  • An android device capable of running Termux
  • A music player app capable of showing notifications of current music being played

Getting started

  • 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 termux-api && git clone https://github.com/gibcheesepuffs/ongaku --depth=1 && cd ongaku && pip install virtualenv && virtualenv venv && source venv/bin/activate
pip install -r requirements.txt && deactivate && cd .. && termux-notification-list

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.env file from sample-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_ID and API_HASH from here.

  • You can use this app to check package name of your music player app and add it to MUSIC_PLAYER value.

  • To optionally get LOG_CHANNEL create 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_SESSION for now by uncommenting it.

  • Starting IDBot on telegram will also give you your own ID. Put that in USERS value.

Use Ctrl+X to exit and save your changes.

  • Run ./launch inside ongaku directory. You will receive your STRING_SESSION in your saved messages in telegram app.

  • Copy the session text and edit your config.env file once again by running nano config.env

  • Paste your session text according to the instructions in the file.

Use Ctrl+X to exit and save your changes.

  • Run ./launch inside ongaku directory 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 in the telegram channel you set for logging if any.

Tips

  • Ongaku may stop detecting notifications and responding to commands if you RELEASE WAKELOCK while it is running! It handles android wakelocks automatically.
  • If you frequently switch between multiple music players, you may want to keep multiple config.env files. You can make any number of .env files named like config-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 to config.env and use launch script as usual.

Known Limitations

  • Ongaku cannot yet differentiate between the states of music player itself i.e. Playing, Paused and Stopped. It simply assumes existing music player notification as a Playing state.
  • 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-list and lastly doing Ctrl + C each 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)

Optional commands

Send in any telegram 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.

Authors

Support

Shouko's Lab

ongaku's People

Contributors

likeadragonmaid avatar anonymousx97 avatar

Stargazers

INDRAJEETH avatar

Forkers

tamilvip007

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.