OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.discover.bbs;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.excelliance.kxqp.gs.discover.model.CDNData;
import com.excelliance.kxqp.gs.discover.model.MediaCategory;
import com.excelliance.kxqp.gs.discover.model.MediaResource;
import com.excelliance.kxqp.gs.discover.model.ResourceType;
import com.excelliance.kxqp.gs.discover.model.ResponseData;
import com.excelliance.kxqp.gs.discover.model.request.CacheRequestData;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bp;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.cn;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class b {
private static b f4711a;
private Context f4712b;
public static b a(Context context) {
if (f4711a == null) {
synchronized (b.class) {
if (f4711a == null) {
f4711a = new b(context.getApplicationContext());
}
}
}
return f4711a;
}
private b(Context context) {
this.f4712b = context;
}
public List<MediaCategory> a(ResourceType resourceType) {
ArrayList arrayList = new ArrayList();
if (resourceType == ResourceType.VIDEO_MP4) {
MediaCategory mediaCategory = new MediaCategory(0, "我的相机", Environment.DIRECTORY_DCIM);
MediaCategory mediaCategory2 = new MediaCategory(0, "我的下载", Environment.DIRECTORY_DOWNLOADS);
MediaCategory mediaCategory3 = new MediaCategory(0, "全部视频", "");
arrayList.add(mediaCategory);
arrayList.add(mediaCategory2);
arrayList.add(mediaCategory3);
ArrayList arrayList2 = new ArrayList();
a(arrayList2, Environment.getExternalStoragePublicDirectory(mediaCategory.getPath()), mediaCategory);
a(arrayList2, Environment.getExternalStoragePublicDirectory(mediaCategory2.getPath()), mediaCategory2);
a(arrayList2, Environment.getExternalStorageDirectory(), mediaCategory3);
}
return arrayList;
}
public static void a(final List<MediaResource> list, File file, final MediaCategory mediaCategory) {
mediaCategory.setMedias(list);
file.listFiles(new FileFilter() {
@Override
public boolean accept(File file2) {
String name = file2.getName();
int indexOf = name.indexOf(46);
if (indexOf != -1) {
String substring = name.substring(indexOf);
if (!substring.equalsIgnoreCase(".mp4") && !substring.equalsIgnoreCase(".3gp") && !substring.equalsIgnoreCase(".wmv") && !substring.equalsIgnoreCase(".ts") && !substring.equalsIgnoreCase(".rmvb") && !substring.equalsIgnoreCase(".mov") && !substring.equalsIgnoreCase(".m4v") && !substring.equalsIgnoreCase(".avi") && !substring.equalsIgnoreCase(".m3u8") && !substring.equalsIgnoreCase(".3gpp") && !substring.equalsIgnoreCase(".3gpp2") && !substring.equalsIgnoreCase(".mkv") && !substring.equalsIgnoreCase(".flv") && !substring.equalsIgnoreCase(".divx") && !substring.equalsIgnoreCase(".f4v") && !substring.equalsIgnoreCase(".rm") && !substring.equalsIgnoreCase(".asf") && !substring.equalsIgnoreCase(".ram") && !substring.equalsIgnoreCase(".mpg") && !substring.equalsIgnoreCase(".v8") && !substring.equalsIgnoreCase(".swf") && !substring.equalsIgnoreCase(".m2v") && !substring.equalsIgnoreCase(".asx") && !substring.equalsIgnoreCase(".ra") && !substring.equalsIgnoreCase(".ndivx") && !substring.equalsIgnoreCase(".xvid")) {
return false;
}
MediaResource mediaResource = new MediaResource();
mediaResource.setMediaCategory(MediaCategory.this);
mediaResource.setName(file2.getName());
mediaResource.setLocalPath(file2.getAbsolutePath());
list.add(mediaResource);
return true;
}
if (!file2.isDirectory()) {
return false;
}
b.a(list, file2, MediaCategory.this);
return false;
}
});
}
public ResponseData<CDNData> a(ResourceType resourceType, String str, String str2, String str3) {
T t;
ResponseData<CDNData> responseData = new ResponseData<>();
responseData.code = 1;
responseData.msg = com.excelliance.kxqp.swipe.a.a.getString(this.f4712b, "server_wrong");
if (TextUtils.isEmpty(str3)) {
responseData.msg = "无效的文件路径~";
return responseData;
}
String str4 = resourceType.getName() + bx.a().a(this.f4712b) + String.valueOf(System.currentTimeMillis()) + resourceType.getSuffix();
File file = new File(str3);
HashMap hashMap = new HashMap();
hashMap.put("key", "xspace/" + str4);
hashMap.put("token", str);
HashMap hashMap2 = new HashMap();
hashMap2.put(file.getName(), file);
String a2 = com.excelliance.kxqp.gs.discover.a.a(str2, hashMap, hashMap2);
if (a2 != null) {
try {
t = (CDNData) new Gson().a(a2, new TypeToken<CDNData>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
t = 0;
}
if (t != 0) {
responseData.code = 0;
responseData.data = t;
responseData.msg = str3;
}
}
return responseData;
}
public ResponseData a(String str) {
CacheRequestData cacheRequestData;
String a2;
ResponseData responseData;
Gson gson = new Gson();
ResponseData responseData2 = new ResponseData();
responseData2.code = 1;
responseData2.msg = com.excelliance.kxqp.swipe.a.a.getString(this.f4712b, "server_wrong");
try {
cacheRequestData = (CacheRequestData) gson.a(cn.i(this.f4712b).toString(), new TypeToken<CacheRequestData>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
Log.e("MediaRepository", e.toString());
cacheRequestData = null;
}
if (cacheRequestData == null) {
cacheRequestData = new CacheRequestData(str);
} else {
cacheRequestData.setData(str);
}
String a3 = bd.a("https://www.ourplay.com.cn/api/setvideomsg", gson.a(cacheRequestData));
if (a3 != null && (a2 = bp.a(a3, "fuck_snsslmm_bslznw", "utf-8")) != null) {
try {
responseData = (ResponseData) gson.a(a2, new TypeToken<ResponseData>() {
}.getType());
} catch (Exception e2) {
e2.printStackTrace();
Log.e("MediaRepository", "MediaRepository/cacheVideoInfo:" + e2.toString());
responseData = null;
}
if (responseData != null) {
return responseData;
}
}
return responseData2;
}
}