Info from music player

Post your questions and help other users.

Moderator: Martin

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Info from music player

Post by MURTUMA » 22 Dec 2013 13:03

Would it be possible to have a trigger fire when I start playing music or the song changes? Maybe with general broadcast? Also, is it possible to retrieve the tag info from currently playing song, specifically artist and song name?

I'd like tohave a flow which shows that info in toast when in full screen app and status bar isn't available.

I'm using powerAMP.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Info from music player

Post by Martin » 22 Dec 2013 15:26

Some music players send a broadcast with the track info that can be received with a trigger General Broadcast.

Following settings work for Play Music:
Action:
com.android.music.metachanged
Access Intent extras:
artist = getString("artist");
album = getString("album");
track = getString("track");


I found somewhere on the web that following action might work for PowerAMP (untested):
com.maxmpz.audioplayer.TRACK_CHANGED

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Info from music player

Post by MURTUMA » 22 Dec 2013 16:27

com.maxmpz.audioplayer.TRACK_CHANGED. This works well in both starting a new song or resuming playback.

How should I use following?
Access Intent extras:
artist = getString("artist");
album = getString("album");
track = getString("track");

EDIT: I found PowerAMP's api at github. I found the relevant things in there but I have no idea what should Ido with them to put the track info in a variable. https://github.com/maxmpz/powerampapi/b ... mpAPI.java
Last edited by MURTUMA on 23 Dec 2013 21:12, edited 1 time in total.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Info from music player

Post by Martin » 23 Dec 2013 19:04

Automagic can not access the track info yet since PowerAMP stores this info in a type 'Bundle' which is not supported in Automagic.
I can add support to access a Bundle for the next version.

The script will probably look something like this:

Code: Select all

track_info = getBundle("track");
title = getString(track_info, "title");

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Info from music player

Post by MURTUMA » 23 Dec 2013 21:18

I seem to have been too tired post a link there, but hopefully you found that yourself. That update would be good. Thanks!

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Info from music player

Post by MURTUMA » 15 Feb 2014 15:22

After last update,I believe it's time to give this question a little bump. How do I get the relevant info from bundle?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Info from music player

Post by Martin » 16 Feb 2014 10:01

The help page of trigger General Broadcast contains an example to access the intent extras of PowerAMP. Scroll down to the last section of field Access Intent Extras.
The action of the trigger should be set to com.maxmpz.audioplayer.TRACK_CHANGED to receive the intent.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Info from music player

Post by MURTUMA » 18 Feb 2014 20:18

Äh.. I checked there but missed that. Thanks!
I got the flow up and running good.

However.. The duration variable is in seconds. I managed to format it to 1m 10s (times are correct, this is just for an example). How can I format it to 1:10 instead?

http://automagic4android.com/flow.php?i ... 0a3f6f087e

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

Re: Info from music player

Post by angelatwork » 18 Feb 2014 22:35

Seems as you have the same problem as I posted below earlier today getting the format 1minute 10 seconds to 1:10 :-)
Best regards,
AngelAtwOrk

angelatwork
Posts: 186
Joined: 12 Feb 2014 01:45

Re: Info from music player

Post by angelatwork » 18 Feb 2014 22:36

Seems as you have the same problem as I posted below earlier today getting the format 1minute 10 seconds to 1:10 :-)
Best regards,
AngelAtwOrk

Post Reply