酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319
以下内容为反编译后的 d.java 源代码,内容仅作参考
package com.kugou.android.app.player.domain.rec;
import android.content.Context;
import android.text.TextUtils;
import com.kugou.common.config.ConfigKey;
import com.kugou.common.utils.as;
import com.kugou.common.utils.ba;
import com.kugou.common.utils.bq;
import com.kugou.common.utils.br;
import com.kugou.framework.musicfees.a.i;
import com.kugou.framework.netmusic.bills.a.m;
import com.kugou.framework.netmusic.bills.entity.SingerAlbum;
import com.tencent.connect.common.Constants;
import com.tencent.stat.DeviceInfo;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import org.apache.commons.codec.net.StringEncodings;
import org.apache.http.HttpEntity;
import org.apache.http.entity.StringEntity;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class d {
private Context f17885a;
private String f17886b;
private String f17887c;
private Comparator<SingerAlbum> f17888d = new Comparator<SingerAlbum>() {
@Override
public int compare(SingerAlbum singerAlbum, SingerAlbum singerAlbum2) {
if (TextUtils.isEmpty(singerAlbum.e()) || TextUtils.isEmpty(singerAlbum.e())) {
return -1;
}
return d.this.a(singerAlbum.e(), singerAlbum2.e());
}
};
public d(Context context, String str, String str2) {
this.f17885a = context;
this.f17886b = str;
this.f17887c = str2;
}
public m.b a() {
m.b bVar = new m.b();
a aVar = new a();
b bVar2 = new b();
try {
com.kugou.common.network.f.d().a(aVar, bVar2);
bVar2.getResponseData(bVar);
return bVar;
} catch (Exception e2) {
e2.printStackTrace();
return bVar;
}
}
public class a extends com.kugou.common.network.d.e {
@Override
public String getRequestModuleName() {
return "MVRelated";
}
@Override
public String getRequestType() {
return Constants.HTTP_POST;
}
a() {
}
@Override
public HttpEntity getPostRequestEntity() {
StringEntity stringEntity;
JSONObject jSONObject = new JSONObject();
try {
String b2 = com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.lo);
String b3 = com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.lp);
String valueOf = String.valueOf(br.F(d.this.f17885a));
Object k = bq.k(br.l(d.this.f17885a));
String valueOf2 = String.valueOf(System.currentTimeMillis() / 1000);
Object a2 = new ba().a(b2 + b3 + valueOf + valueOf2);
jSONObject.put("appid", b2);
jSONObject.put("clientver", valueOf);
jSONObject.put(DeviceInfo.TAG_MID, k);
jSONObject.put("clienttime", valueOf2);
jSONObject.put("key", a2);
jSONObject.put("fields", "authors,album_name,album_id,intro,cover,publish_date");
jSONObject.put("dfid", com.kugou.common.q.b.a().cQ());
jSONObject.put("plat", 1);
JSONArray jSONArray = new JSONArray();
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("audio_id", d.this.f17886b);
jSONObject2.put("hash", d.this.f17887c);
jSONArray.put(jSONObject2);
jSONObject.put("data", jSONArray);
} catch (JSONException e2) {
as.e(e2);
}
try {
stringEntity = new StringEntity(jSONObject.toString(), StringEncodings.UTF8);
} catch (UnsupportedEncodingException e3) {
e = e3;
stringEntity = null;
}
try {
stringEntity.setContentType("application/json");
} catch (UnsupportedEncodingException e4) {
e = e4;
if (as.f54365e) {
as.d("BLUE", "JsonRequestPackage MV Related getPostRequestEntity error");
}
as.e(e);
return stringEntity;
}
return stringEntity;
}
@Override
public ConfigKey a() {
return com.kugou.android.app.a.a.T;
}
@Override
public String getGetRequestParams() {
return "?dfid=" + com.kugou.common.q.b.a().cQ();
}
}
public class b extends com.kugou.android.common.d.b<m.b> {
public b() {
}
@Override
public void getResponseData(m.b bVar) {
int i;
JSONObject jSONObject;
JSONArray optJSONArray;
if (bVar == null || TextUtils.isEmpty(this.i)) {
return;
}
try {
JSONObject jSONObject2 = new JSONObject(this.i);
if (jSONObject2.getString("status") == null) {
return;
}
if (!"1".equalsIgnoreCase(jSONObject2.getString("status"))) {
bVar.f60153b = jSONObject2.getInt("errcode");
bVar.f60154c = jSONObject2.getString("error");
return;
}
bVar.f60152a = true;
JSONArray optJSONArray2 = jSONObject2.getJSONArray("data").optJSONArray(0);
if (optJSONArray2 == null || optJSONArray2.length() <= 0) {
return;
}
bVar.f60156e = new ArrayList<>(optJSONArray2.length());
int i2 = 0;
while (i2 < optJSONArray2.length()) {
try {
jSONObject = optJSONArray2.getJSONObject(i2);
} catch (Exception unused) {
}
if (jSONObject != null && !jSONObject.isNull("album_id") && !jSONObject.isNull("album_name") && !jSONObject.isNull("intro")) {
SingerAlbum singerAlbum = new SingerAlbum();
i = i2;
singerAlbum.a(jSONObject.getLong("album_id"));
singerAlbum.a(jSONObject.getString("album_name"));
singerAlbum.c(jSONObject.getString("intro"));
singerAlbum.e(jSONObject.optInt("buycount"));
if (jSONObject.has("authors") && (optJSONArray = jSONObject.optJSONArray("authors")) != null && optJSONArray.length() > 0) {
JSONObject jSONObject3 = optJSONArray.getJSONObject(0);
singerAlbum.b(jSONObject3.optString("author_name"));
singerAlbum.a(jSONObject3.optInt("author_id"));
}
i.a(jSONObject, singerAlbum);
singerAlbum.d(jSONObject.getString("publish_date"));
if (jSONObject.has("cover")) {
singerAlbum.e(d.this.a(jSONObject.getString("cover")));
}
try {
singerAlbum.b(jSONObject.getInt("privilege"));
if (as.f54365e) {
as.f("eaway", "privilege:" + jSONObject.getInt("privilege"));
}
} catch (Exception unused2) {
as.f("eaway", "privilege:" + b.class.getName());
}
if (jSONObject.has("songcount")) {
singerAlbum.f60219a = jSONObject.getInt("songcount");
}
singerAlbum.h(jSONObject.optInt("isfirst"));
bVar.f60156e.add(singerAlbum);
i2 = i + 1;
}
i = i2;
i2 = i + 1;
}
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
Collections.sort(bVar.f60156e, d.this.f17888d);
} catch (Exception e2) {
as.e(e2);
}
}
}
public int a(String str, String str2) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return simpleDateFormat.parse(str).before(simpleDateFormat.parse(str2)) ? 1 : -1;
} catch (ParseException e2) {
as.e(e2);
return 0;
}
}
public String a(String str) {
if (TextUtils.isEmpty(str) || str.length() < 8) {
return null;
}
return "http://imge.kugou.com/stdmusic/{size}/" + str.substring(0, 8) + "/" + str;
}
}