use of com.lzx.musiclibrary.aidl.model.AlbumInfo in project NiceMusic by lizixian18.
the class DbManager method queryFavoriteList.
/**
* 获取我的歌单
*
* @return
*/
private List<SongInfo> queryFavoriteList() {
Uri uri = MusicContentProvider.FAVORITES_URI;
Cursor cursor = mResolver.query(uri, null, null, null, null);
if (cursor == null) {
return new ArrayList<>();
}
List<SongInfo> musicInfos = new ArrayList<>();
while (cursor.moveToNext()) {
String musicId = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_ID));
String artist = cursor.getString(cursor.getColumnIndex(DbConstants.ARTIST));
String musicTitle = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_TITLE));
String albumTitle = cursor.getString(cursor.getColumnIndex(DbConstants.ALBUM_TITLE));
long duration = cursor.getLong(cursor.getColumnIndex(DbConstants.DURATION));
String cover = cursor.getString(cursor.getColumnIndex(DbConstants.COVER));
String url = cursor.getString(cursor.getColumnIndex(DbConstants.URL));
SongInfo info = new SongInfo();
info.setSongId(musicId);
info.setArtist(artist);
info.setSongName(musicTitle);
info.setDuration(duration);
info.setSongCover(cover);
info.setSongUrl(url);
AlbumInfo albumInfo = new AlbumInfo();
albumInfo.setAlbumName(albumTitle);
info.setAlbumInfo(albumInfo);
musicInfos.add(info);
}
cursor.close();
return musicInfos;
}
use of com.lzx.musiclibrary.aidl.model.AlbumInfo in project NiceMusic by lizixian18.
the class DataHelper method getSongInfo.
private static SongInfo getSongInfo(JSONObject billboard, JSONObject object, int i) throws IOException, JSONException {
SongInfo info = new SongInfo();
// 音乐id
info.setSongId(object.getString("song_id"));
// 音乐标题
info.setSongName(object.getString("title"));
// 音乐封面
info.setSongCover(object.getString("pic_s500"));
// 音乐播放地址
info.setSongUrl("");
if (billboard != null) {
// 类型(流派)
info.setGenre(billboard.getString("name"));
// 类型
info.setType(billboard.getString("billboard_type"));
}
// 音乐大小
info.setSize("");
// 音乐长度
info.setDuration(object.getInt("file_duration") * 1000);
// 音乐艺术家
info.setArtist(object.getString("author"));
// 音乐艺术家id
info.setArtistId(object.getString("ting_uid"));
// 音乐下载地址
info.setDownloadUrl("");
// 地点
info.setSite(object.getString("country"));
// 喜欢数
info.setFavorites(Integer.parseInt(object.optString("hot", "0")));
// 播放数
info.setPlayCount(info.getFavorites() * 2);
// 媒体的曲目号码(序号:1234567……)
info.setTrackNumber(i);
// 语言
info.setLanguage(object.getString("language"));
// 地区
info.setCountry(object.getString("country"));
// 代理公司
info.setProxyCompany(object.getString("si_proxycompany"));
// 发布时间
info.setPublishTime(object.getString("publishtime"));
// 音乐描述
info.setDescription(object.getString("info"));
// 版本
info.setVersions(object.getString("versions"));
AlbumInfo albumInfo = new AlbumInfo();
// 专辑id
albumInfo.setAlbumId(object.getString("album_id"));
// 专辑名称
albumInfo.setAlbumName(object.getString("album_title"));
// 专辑封面
albumInfo.setAlbumCover(object.getString("album_500_500"));
// 长方形的封面
albumInfo.setAlbumRectCover(object.getString("pic_huge"));
// 高清的封面
albumInfo.setAlbumHDCover(object.getString("pic_premium"));
// 专辑艺术家
albumInfo.setArtist(object.optString("artist_name"));
// 专辑音乐数
albumInfo.setSongCount(0);
// 专辑播放数
albumInfo.setPlayCount(0);
info.setAlbumInfo(albumInfo);
return info;
}
use of com.lzx.musiclibrary.aidl.model.AlbumInfo in project NiceMusic by lizixian18.
the class DbManager method queryPlayList.
/**
* 获取播放列表
*
* @return
*/
private List<SongInfo> queryPlayList() {
Uri uri = MusicContentProvider.SONG_LIST_URI;
Cursor cursor = mResolver.query(uri, null, null, null, null);
if (cursor == null) {
return new ArrayList<>();
}
List<SongInfo> musicInfos = new ArrayList<>();
while (cursor.moveToNext()) {
String musicId = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_ID));
String artist = cursor.getString(cursor.getColumnIndex(DbConstants.ARTIST));
String musicTitle = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_TITLE));
String albumTitle = cursor.getString(cursor.getColumnIndex(DbConstants.ALBUM_TITLE));
long duration = cursor.getLong(cursor.getColumnIndex(DbConstants.DURATION));
String cover = cursor.getString(cursor.getColumnIndex(DbConstants.COVER));
String url = cursor.getString(cursor.getColumnIndex(DbConstants.URL));
SongInfo info = new SongInfo();
info.setSongId(musicId);
info.setArtist(artist);
info.setSongName(musicTitle);
info.setDuration(duration);
info.setSongCover(cover);
info.setSongUrl(url);
AlbumInfo albumInfo = new AlbumInfo();
albumInfo.setAlbumName(albumTitle);
info.setAlbumInfo(albumInfo);
musicInfos.add(info);
}
cursor.close();
return musicInfos;
}
use of com.lzx.musiclibrary.aidl.model.AlbumInfo in project NiceMusic by lizixian18.
the class DbManager method querySongInfoById.
/**
* 获取一条音乐信息
*/
private SongInfo querySongInfoById(String songId) {
Uri uri = MusicContentProvider.SONG_LIST_URI;
Cursor cursor = mResolver.query(uri, null, DbConstants.MUSIC_ID + " = ?", new String[] { songId }, null);
if (cursor == null) {
return null;
}
SongInfo info = new SongInfo();
while (cursor.moveToNext()) {
String musicId = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_ID));
String artist = cursor.getString(cursor.getColumnIndex(DbConstants.ARTIST));
String musicTitle = cursor.getString(cursor.getColumnIndex(DbConstants.MUSIC_TITLE));
String albumTitle = cursor.getString(cursor.getColumnIndex(DbConstants.ALBUM_TITLE));
long duration = cursor.getLong(cursor.getColumnIndex(DbConstants.DURATION));
String cover = cursor.getString(cursor.getColumnIndex(DbConstants.COVER));
String url = cursor.getString(cursor.getColumnIndex(DbConstants.URL));
info.setSongId(musicId);
info.setArtist(artist);
info.setSongName(musicTitle);
info.setDuration(duration);
info.setSongCover(cover);
info.setSongUrl(url);
AlbumInfo albumInfo = new AlbumInfo();
albumInfo.setAlbumName(albumTitle);
info.setAlbumInfo(albumInfo);
}
cursor.close();
return info;
}
use of com.lzx.musiclibrary.aidl.model.AlbumInfo in project NiceMusic by lizixian18.
the class SongListPresenter method requestLiveList.
@Override
public void requestLiveList(String title) {
int mRadioType = 2;
int mProvinceCode = 360000;
Map<String, String> map = new HashMap<String, String>();
map.put(DTransferConstants.RADIOTYPE, "" + mRadioType);
map.put(DTransferConstants.PROVINCECODE, "" + mProvinceCode);
CommonRequest.getRadios(map, new IDataCallBack<RadioList>() {
@Override
public void onSuccess(RadioList object) {
if (object != null && object.getRadios() != null) {
List<SongInfo> musicInfos = new ArrayList<>();
for (int i = 0; i < object.getRadios().size(); i++) {
Radio radio = object.getRadios().get(i);
SongInfo info = new SongInfo();
// 音乐id
info.setSongId(String.valueOf(radio.getDataId()));
// 音乐标题
info.setSongName(radio.getRadioName());
// 音乐封面
info.setSongCover(radio.getCoverUrlLarge());
// 音乐播放地址
info.setSongUrl(radio.getRate64AacUrl());
// 类型(流派)
info.setGenre(radio.getKind());
// 类型
info.setType(radio.getKind());
// 音乐大小
info.setSize("");
// 音乐长度
info.setDuration(0);
// 音乐艺术家
info.setArtist(radio.getRadioName());
// 媒体的曲目号码(序号:1234567……)
info.setTrackNumber(i);
AlbumInfo albumInfo = new AlbumInfo();
// 专辑id
albumInfo.setAlbumId(String.valueOf(radio.getDataId()));
// 专辑名称
albumInfo.setAlbumName(radio.getProgramName());
// 专辑封面
albumInfo.setAlbumCover(radio.getCoverUrlLarge());
// 专辑音乐数
albumInfo.setSongCount(0);
// 专辑播放数
albumInfo.setPlayCount(0);
info.setAlbumInfo(albumInfo);
musicInfos.add(info);
}
mView.onGetSongListSuccess(musicInfos, title);
mView.onGetLiveSongSuccess(musicInfos);
}
}
@Override
public void onError(int code, String message) {
LogUtil.i("直播 = " + message);
Toast.makeText(mContext, "获取直播数据失败", Toast.LENGTH_SHORT).show();
}
});
}
Aggregations