查询谷歌播放音乐库中的Andr​​oid [英] Querying Google Play Music database in Android

查看:94
本文介绍了查询谷歌播放音乐库中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查询的谷歌播放音乐应用程序创建的播放列表,但一直没能如愿。我使用本地存储的内容创建的播放列表。我用下面的code查询:

I am trying to query for the playlists created by "Google Play Music" app but haven't been able to do so. I created a playlist using locally stored content. I used the following code to query:

光标C = managedQuery(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,                                        新的String [] {MediaStore.Audio.Playlists._ID,                                                      MediaStore.Audio.Playlists.NAME                                                     },NULL,NULL,NULL);

Cursor c = managedQuery(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, new String[] {MediaStore.Audio.Playlists._ID, MediaStore.Audio.Playlists.NAME }, null, null, null);

这工作正常Winamp的,但不是谷歌播放音乐。事实上,Winamp的不显示与谷歌播放音乐创建的播放列表。然而,谷歌播放音乐显示与Winamp的创建的播放列表。我的猜测是,谷歌播放音乐使用自己的数据库来存储时,其它玩家使用内容提供商与URI MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI来存储自己的播放列表播放列表。有没有办法让与谷歌播放音乐创建的播放列表?

This works fine for Winamp but not for Google Play Music. In fact, Winamp doesn't display the playlists created with Google Play Music. However, Google Play Music displays the playlists created with Winamp. My guess is that Google Play Music is using its own database to store the playlists where as other players use Content Provider with uri MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI to store their playlists. Is there a way to get playlists created with Google Play Music?

推荐答案

我知道这个线程是老了,但我一直在努力解决这个问题了。

I know this thread is old, but I have been grappling with this problem too.

谷歌播放音乐暴露了其播放列表,在这个不规范的内容URI

Google Play Music exposes its playlists at this non-standard Content URI

// list all playlists with their ID and Name
Cursor cursor = getContentResolver().query(
    "content://com.google.android.music.MusicContent/playlists", 
    new String[] {"_id", "playlist_name" }, 
    null, null, null);

在谷歌播放音乐内容提供商使用下面的列名

The Google Play Music content provider uses the following column names

  • isAllLocal
  • playlist_owner_name
  • hasLocal
  • hasRemote
  • hasAny
  • KeepOnId
  • playlist_art_url
  • playlist_share_token
  • _id
  • _count
  • playlist_owner_profile_photo_url
  • keeponSongCount
  • playlist_description
  • playlist_type
  • playlist_id
  • keeponDownloadedSongCount
  • PLAYLIST_NAME
  • isAllLocal
  • playlist_owner_name
  • hasLocal
  • hasRemote
  • hasAny
  • KeepOnId
  • playlist_art_url
  • playlist_share_token
  • _id
  • _count
  • playlist_owner_profile_photo_url
  • keeponSongCount
  • playlist_description
  • playlist_type
  • playlist_id
  • keeponDownloadedSongCount
  • playlist_name

我从来没有想通了这一点,如果没有这种真正有用的应用程序内容提供商助手

I would have never figured this out without this really helpful app Content Provider Helper

这篇关于查询谷歌播放音乐库中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆