jimu-decompiled/sources/com/bottle/hp/album/media/HPVideo.java
2025-05-13 19:24:51 +02:00

214 lines
8.4 KiB
Java

package com.bottle.hp.album.media;
import android.content.Context;
import android.database.Cursor;
import android.media.MediaMetadataRetriever;
import android.provider.MediaStore;
import com.bottle.hp.album.Utils;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class HPVideo extends HPMedia implements Serializable {
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"};
private static String[] thumbColumns = {FileDownloadModel.ID, "video_id", "_data"};
private String album;
private String artist;
private long duration;
public HPVideo() {
super(0, "title", "displayName", "mimeType", "", 0L, "", "");
this.mediaType = 1;
}
public static long getVideoDuration(String str) {
try {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(str);
return Long.parseLong(mediaMetadataRetriever.extractMetadata(9));
} catch (IllegalArgumentException e) {
e.printStackTrace();
return 0L;
}
}
public static HPMedia getVideoThumnail(Context context, HPMedia hPMedia) {
Cursor query = context.getContentResolver().query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, thumbColumns, "video_id=?", new String[]{hPMedia.getId() + ""}, null);
if (query == null || !query.moveToFirst()) {
Utils.a(context.getContentResolver(), hPMedia.getPath(), 3);
} else {
hPMedia.setPreview(query.getString(query.getColumnIndex("_data")));
}
if (query != null) {
query.close();
}
return hPMedia;
}
public static List<HPMedia> getVideos(Context context) {
Cursor query;
ArrayList arrayList = new ArrayList();
if (context == null || (query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) == null) {
return arrayList;
}
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("album");
int columnIndex8 = query.getColumnIndex("artist");
int columnIndex9 = query.getColumnIndex("duration");
int columnIndex10 = query.getColumnIndex("date_modified");
if (query.moveToFirst()) {
while (true) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
String string3 = query.getString(columnIndex4);
String string4 = query.getString(columnIndex5);
long j = query.getLong(columnIndex6);
String string5 = query.getString(columnIndex7);
String string6 = query.getString(columnIndex8);
int i2 = columnIndex;
int i3 = columnIndex2;
long j2 = query.getInt(columnIndex9);
int i4 = columnIndex3;
int i5 = columnIndex4;
HPVideo hPVideo = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
hPVideo.setAlbum(string5);
hPVideo.setArtist(string6);
hPVideo.setDuration(j2);
arrayList.add(hPVideo);
if (!query.moveToNext()) {
break;
}
columnIndex = i2;
columnIndex2 = i3;
columnIndex3 = i4;
columnIndex4 = i5;
}
}
query.close();
return arrayList;
}
public static HPVideo searchVideoByName(Context context, String str) {
Cursor query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
HPVideo hPVideo = null;
if (query == null) {
return null;
}
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
int columnIndex2 = query.getColumnIndex("title");
int columnIndex3 = query.getColumnIndex("_data");
int columnIndex4 = query.getColumnIndex("_display_name");
int columnIndex5 = query.getColumnIndex("mime_type");
int columnIndex6 = query.getColumnIndex("_size");
int columnIndex7 = query.getColumnIndex("album");
int columnIndex8 = query.getColumnIndex("artist");
int columnIndex9 = query.getColumnIndex("duration");
int columnIndex10 = query.getColumnIndex("date_modified");
if (query.moveToFirst()) {
int i = query.getInt(columnIndex);
String string = query.getString(columnIndex2);
String string2 = query.getString(columnIndex3);
String string3 = query.getString(columnIndex4);
String string4 = query.getString(columnIndex5);
long j = query.getLong(columnIndex6);
String string5 = query.getString(columnIndex7);
String string6 = query.getString(columnIndex8);
long j2 = query.getInt(columnIndex9);
HPVideo hPVideo2 = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
hPVideo2.setAlbum(string5);
hPVideo2.setArtist(string6);
hPVideo2.setDuration(j2);
hPVideo = hPVideo2;
}
query.close();
return hPVideo;
}
public String getAlbum() {
return this.album;
}
public String getArtist() {
return this.artist;
}
public long getDuration() {
return this.duration;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x001f, code lost:
if (r1 == null) goto L15;
*/
/* JADX WARN: Removed duplicated region for block: B:17:0x0026 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public android.graphics.Bitmap getFirstFrame() {
/*
r4 = this;
r0 = 0
android.media.MediaMetadataRetriever r1 = new android.media.MediaMetadataRetriever // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
r1.<init>() // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
java.lang.String r2 = r4.path // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
r1.setDataSource(r2) // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
android.graphics.Bitmap r0 = r1.getFrameAtTime() // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
Lf:
r1.release()
goto L22
L13:
r2 = move-exception
goto L1c
L15:
r1 = move-exception
r3 = r1
r1 = r0
r0 = r3
goto L24
L1a:
r2 = move-exception
r1 = r0
L1c:
r2.printStackTrace() // Catch: java.lang.Throwable -> L23
if (r1 == 0) goto L22
goto Lf
L22:
return r0
L23:
r0 = move-exception
L24:
if (r1 == 0) goto L29
r1.release()
L29:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.bottle.hp.album.media.HPVideo.getFirstFrame():android.graphics.Bitmap");
}
public void setAlbum(String str) {
this.album = str;
}
public void setArtist(String str) {
this.artist = str;
}
public void setDuration(long j) {
this.duration = j;
}
public HPVideo(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
super(i, str, str2, str3, str4, j, str5, str6);
this.mediaType = 1;
}
}