jimu-decompiled/sources/com/baidu/cloud/media/download/DownloadableVideoItem.java
2025-05-13 19:24:51 +02:00

109 lines
3.1 KiB
Java

package com.baidu.cloud.media.download;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubt.jimu.base.entities.Course;
import java.util.Observable;
/* loaded from: classes.dex */
public abstract class DownloadableVideoItem extends Observable {
public static final int ERROR_CODE_INVALID_URL = 1;
public static final int ERROR_CODE_M3U8_DRM_INVALID = 6;
public static final int ERROR_CODE_M3U8_INVALID_FORMAT = 4;
public static final int ERROR_CODE_M3U8_SAVE_FAILED = 5;
public static final int ERROR_CODE_NETWORK_FAILED = 2;
public static final int ERROR_CODE_NO_ERROR = 0;
public static final int ERROR_CODE_SDCARD_UNMOUNTED = 3;
public static final int ERROR_CODE_TS_SAVE_FAILED = 7;
public static final String[] a = {"ERROR_CODE_NO_ERROR", "ERROR_CODE_INVALID_URL", "ERROR_CODE_NETWORK_FAILED", "ERROR_CODE_SDCARD_UNMOUNTED", "ERROR_CODE_M3U8_INVALID_FORMAT", "ERROR_CODE_M3U8_SAVE_FAILED", "ERROR_CODE_M3U8_DRM_INVALID", "ERROR_CODE_TS_SAVE_FAILED"};
protected String b;
protected String c;
protected String d;
protected volatile int e;
protected volatile int f;
protected volatile int g;
protected volatile DownloadStatus h = DownloadStatus.NONE;
protected String i;
protected volatile int j;
public enum DownloadStatus {
NONE(0, "first add"),
DOWNLOADING(1, "downloading videos"),
PAUSED(2, "paused"),
COMPLETED(3, Course.STATUS_COMPLETED),
ERROR(4, "failed to download"),
DELETED(5, "delete manually"),
PENDING(6, "pending, will start automatically(blocked by Parallel Strategy)");
private int code;
private String msg;
DownloadStatus(int i, String str) {
this.code = i;
this.msg = str;
}
public int getCode() {
return this.code;
}
public String getMessage() {
return this.msg;
}
}
public int getErrorCode() {
return this.j;
}
public String getFailReason() {
return this.i;
}
public String getLocalAbsolutePath() {
String str = this.d;
if (str == null || str.equals("")) {
return this.c;
}
String str2 = this.c;
if (str2 == null || str2.equals("")) {
return null;
}
return this.c + "/" + this.d;
}
public float getProgress() {
return this.e / 100.0f;
}
public String getSpeed() {
StringBuilder sb;
String str;
if (this.h != DownloadStatus.DOWNLOADING) {
return "0KB/s";
}
if (this.f < 1024) {
sb = new StringBuilder();
sb.append(this.f);
str = "KB/s";
} else {
sb = new StringBuilder();
sb.append(this.f / DataDecryptTool.DECRYPT_SP_FILE);
str = "MB/s";
}
sb.append(str);
return sb.toString();
}
public DownloadStatus getStatus() {
return this.h;
}
public int getTotalSize() {
return this.g;
}
public String getUrl() {
return this.b;
}
}