Initial commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package com.baidu.cloud.videocache.sourcestorage;
|
||||
|
||||
import com.baidu.cloud.videocache.aa;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface SourceInfoStorage {
|
||||
void a(String str, aa aaVar);
|
||||
|
||||
aa get(String str);
|
||||
}
|
87
sources/com/baidu/cloud/videocache/sourcestorage/a.java
Normal file
87
sources/com/baidu/cloud/videocache/sourcestorage/a.java
Normal file
@@ -0,0 +1,87 @@
|
||||
package com.baidu.cloud.videocache.sourcestorage;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import com.baidu.cloud.media.player.misc.IMediaFormat;
|
||||
import com.baidu.cloud.videocache.aa;
|
||||
import com.baidu.cloud.videocache.t;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class a extends SQLiteOpenHelper implements SourceInfoStorage {
|
||||
private static final String[] a = {FileDownloadModel.ID, "url", "length", IMediaFormat.KEY_MIME};
|
||||
|
||||
a(Context context) {
|
||||
super(context, "AndroidVideoCache.db", (SQLiteDatabase.CursorFactory) null, 1);
|
||||
t.a(context);
|
||||
}
|
||||
|
||||
private ContentValues a(aa aaVar) {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put("url", aaVar.a);
|
||||
contentValues.put("length", Long.valueOf(aaVar.b));
|
||||
contentValues.put(IMediaFormat.KEY_MIME, aaVar.c);
|
||||
return contentValues;
|
||||
}
|
||||
|
||||
private aa a(Cursor cursor) {
|
||||
return new aa(cursor.getString(cursor.getColumnIndexOrThrow("url")), cursor.getLong(cursor.getColumnIndexOrThrow("length")), cursor.getString(cursor.getColumnIndexOrThrow(IMediaFormat.KEY_MIME)));
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.videocache.sourcestorage.SourceInfoStorage
|
||||
public void a(String str, aa aaVar) {
|
||||
t.a(str, aaVar);
|
||||
boolean z = get(str) != null;
|
||||
ContentValues a2 = a(aaVar);
|
||||
if (z) {
|
||||
getWritableDatabase().update("SourceInfo", a2, "url=?", new String[]{str});
|
||||
} else {
|
||||
getWritableDatabase().insert("SourceInfo", null, a2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.videocache.sourcestorage.SourceInfoStorage
|
||||
public aa get(String str) {
|
||||
t.a(str);
|
||||
Cursor cursor = null;
|
||||
r0 = null;
|
||||
aa a2 = null;
|
||||
try {
|
||||
Cursor query = getReadableDatabase().query("SourceInfo", a, "url=?", new String[]{str}, null, null, null);
|
||||
if (query != null) {
|
||||
try {
|
||||
if (query.moveToFirst()) {
|
||||
a2 = a(query);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
cursor = query;
|
||||
th = th;
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
return a2;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||||
t.a(sQLiteDatabase);
|
||||
sQLiteDatabase.execSQL("CREATE TABLE SourceInfo (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,url TEXT NOT NULL,mime TEXT,length INTEGER);");
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
throw new IllegalStateException("Should not be called. There is no any migration");
|
||||
}
|
||||
}
|
15
sources/com/baidu/cloud/videocache/sourcestorage/b.java
Normal file
15
sources/com/baidu/cloud/videocache/sourcestorage/b.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.baidu.cloud.videocache.sourcestorage;
|
||||
|
||||
import com.baidu.cloud.videocache.aa;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class b implements SourceInfoStorage {
|
||||
@Override // com.baidu.cloud.videocache.sourcestorage.SourceInfoStorage
|
||||
public void a(String str, aa aaVar) {
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.videocache.sourcestorage.SourceInfoStorage
|
||||
public aa get(String str) {
|
||||
return null;
|
||||
}
|
||||
}
|
14
sources/com/baidu/cloud/videocache/sourcestorage/c.java
Normal file
14
sources/com/baidu/cloud/videocache/sourcestorage/c.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.baidu.cloud.videocache.sourcestorage;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class c {
|
||||
public static SourceInfoStorage a() {
|
||||
return new b();
|
||||
}
|
||||
|
||||
public static SourceInfoStorage a(Context context) {
|
||||
return new a(context);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user