Jump to content

new URIs confusing me ... also what are "CATS"?


DulcetTone

Recommended Posts

I want to line up all the tracks by a given artist, and it does not seem to work.

Here is my code. I am omitting a /media_id suffix, as I have zero interest in expressing a single track.. I want all the given artist's tracks to play.

protected void _playArtist(long artist_id, boolean shuffle) {

startService("playArtist(" + artist_id + ", " + shuffle + ")",

new Intent(PowerAMPiAPI.ACTION_API_COMMAND)

.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)

.putExtra(PowerAMPiAPI.SHUFFLE,

shuffle ? PowerAMPiAPI.ShuffleMode.SHUFFLE_CATS : PowerAMPiAPI.ShuffleMode.SHUFFLE_NONE)

.setData(Uri.parse("content://com.maxmpz.audioplayer/ARTIST/" + artist_id))

);

// this does a TOGGLE_UNPAUSE if the music is already paused...

// why is there no unconditional PLAY? Would RESUME do that?

unpauseIfPaused();

showActivity();

}

Second question... I take it that "cats" are categories, but what are categories? These seem to be concepts with no equivalents in other music apps, and my own UI is common to a variety of players.

Thanks in advance.

tone

Link to comment
Share on other sites

CATegory is basically a list type (albums/artist/genre/etc).

SHUFFLE_CATS is "Shuffle Lists, Songs in Order" shuffle mode.

poweramp_api_example/MainActivity.java has a good example of opening PowerAMP track URI:

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND)

.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)
.setData(Uri.parse("file://" + ((TextView)findViewById(R.id.play_file_path)).getText().toString())));

This will play exactly the file from textview=play_file_path. Note that PowerAMP will match the file against Folders, if matched, appropriate Folder will be actually played, starting from the song.

More advanced approach (playing categories, such as albums, artists, etc.) are also available in that example project, but you need to get ids for the appropriate categories first:

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND)

.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)
.setData(PowerAMPiAPI.ROOT_URI.buildUpon()
.appendEncodedPath("albums")
.appendEncodedPath(Long.toString(albumId))
.appendEncodedPath("files")
.build()));

PowerAMP 2.0 uris looks like:

content://com.maxmpz.audioplayer.data/albums/55/files/22

This indicates file id=22 from album id=55, but you can also start the (e.g.) album from the first song:

content://com.maxmpz.audioplayer.data/albums/55/files/

PowerAMP 2.0 uris are basically direct REST representation of folders/library hierarchical UI.

I.e. if you navigate to just all songs, it's /files/,

albums songs - /albums/ALBUM_ID/files

artist album songs - /artist/ARTIST_ID/albums/ALBUM_ID/files

etc.

Link to comment
Share on other sites

Something is not working. First off, what you write above does not agree with the comments in the API file.

The example you cite above:

content://com.maxmpz.audioplayer.data/albums/55/files/22

is in the API file indicated as

content://com.maxmpz.audioplayer/ALBUM/55/22

That is: no ".data" mentioned, "albums" is "ALBUM" (though there is a public static final String ALBUM = "album"), and the "/files" part is also not indicated. It's hard to guess my way to success.

My app is a voice-driven one, and so I pause Poweramp playback the moment my app is invoked (which works fine). I then field a spoken command description of a set of songs to be played (or played in a shuffle mode) and then wish to ask Poweramp to play them.

Whether I ask Poweramp to play

1. a given single song

2. a given artist's music -- all of it

3. a given album's music -- all of it

4. a given playlist -- all of it

Poweramp simply resumes playing the playback that was paused at the start of the proceedings. I would like to have any previous music queueing context thrown out wholesale when I request any music such as the above basic flavors.

Is the issue that I am asking Poweramp to play specific content while it is paused?

Is the issue perhaps that I am both requesting this music and also specifying a shuffle mode in the same startService() call?

tone

tone

Link to comment
Share on other sites

  • 4 weeks later...

Can you offer me any direction in how to queue up and play music? I've had to mark your app as incompatible for the nicest features.

I changed my code for playing a given album given its id to precisely the code you advise (see below). it does not queue up that album for play -- it appears to do nothing.

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND)

.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)

.setData(PowerAMPiAPI.ROOT_URI.buildUpon()

.appendEncodedPath("albums")

.appendEncodedPath(Long.toString(albumId))

.appendEncodedPath("files")

.build()));

Link to comment
Share on other sites

  • 3 weeks later...

I am also using his voice dialing app and miss the ability to play songs by speaking the song names or the album titles. This app used to work superbly with Poweramp, but since 2.0 came out, it no longer works, except to start and stop the music and select the next track. This guy would really like to recommend Poweramp for use with his app, but can't because the new API Lib documentation doesn't have some of the details he needs. I was about to buy Poweramp until 2.0 broke the voice dialing interface with his app. Can you try to answer his questions?

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...