Page 1 of 2
Info from music player
Posted: 22 Dec 2013 13:03
by MURTUMA
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.
Re: Info from music player
Posted: 22 Dec 2013 15:26
by Martin
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
Re: Info from music player
Posted: 22 Dec 2013 16:27
by MURTUMA
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
Re: Info from music player
Posted: 23 Dec 2013 19:04
by Martin
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");
Re: Info from music player
Posted: 23 Dec 2013 21:18
by MURTUMA
I seem to have been too tired post a link there, but hopefully you found that yourself. That update would be good. Thanks!
Re: Info from music player
Posted: 15 Feb 2014 15:22
by MURTUMA
After last update,I believe it's time to give this question a little bump. How do I get the relevant info from bundle?
Re: Info from music player
Posted: 16 Feb 2014 10:01
by Martin
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.
Re: Info from music player
Posted: 18 Feb 2014 20:18
by MURTUMA
Ä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
Re: Info from music player
Posted: 18 Feb 2014 22:35
by angelatwork
Seems as you have the same problem as I posted below earlier today getting the format 1minute 10 seconds to 1:10

Re: Info from music player
Posted: 18 Feb 2014 22:36
by angelatwork
Seems as you have the same problem as I posted below earlier today getting the format 1minute 10 seconds to 1:10
