1

I want to have a script that is continuously running in the background while I connect my phone via Bluetooth to play music. I need the script to get the total time length of the track, the current time in the song, the artist of the song, and the title of the song. I need those items to be gathered and then printed in the output terminal, and I need this to be written in Python. I don't have any code at the moment but was hoping someone could give me some lines of code that would point me in the right direction.

Can someone provide me some information on how to get the total time length of the track, the current time in the song, the artist of the song, and the title of the song?

  • PulseAudio has no concept of "tracks" or "songs". – Dmitry Grigoryev Jul 8 at 13:45
  • Do you know of a way this can be accomplished then? Maybe with an alternative to PulseAudio. – ee94jrlc Jul 8 at 15:08
  • Have you ever seen a Bluetooth audio device (speaker or similar) which can do this? I haven't. (Not saying it doesn't exist, just that I've never seen it.) I wonder if this information is even available. – Mark Smith Jul 8 at 21:10
1

There cannot be given some simple example code in python because it depends on how to get the total time length of the track, the current time in the song, the artist of the song, and the title of the song. You must have a source that provides these meta data of a song. There are some services on the internet you can ask or you have a media server maybe with UPnP that can provide the information.

For example to ask an internet service with python you have to use a html- or browser library and program the http GETs and PUTs. To use UPnP you may use an UPnP library if available for python. Otherwise you have to do it yourself with network sockets and UDP multicast.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.