导航菜单

页面标题

页面副标题

24Six v66.1.24 - TfsMediaSource.java 源代码

正在查看: 24Six v66.1.24 应用的 TfsMediaSource.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package app.tfs.media;

import R.f;
import Y.M;
import Y.Z;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.media3.common.MediaItem;
import androidx.media3.common.MediaMetadata;
import app.tfs.db.DbMain;
import app.tfs.model.TfsPhoto;
import app.tfs.model.TfsProfile;
import app.tfs.model.TfsTile;
import app.tfs.model.TfsTilePosition;
import g.C0458a;
import h1.n;
import java.io.File;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.m;

@Keep
public final class TfsMediaSource implements M {
    private File audioFile;
    private final TfsTile content;
    private boolean fromReccomended;
    private File imageFile;

    public TfsMediaSource(Context context, TfsTile tfsTile, boolean z2) {
        TfsProfile tfsProfile;
        m.e(context, "context");
        m.e(tfsTile, TfsTile.TILE_TYPE_CONTENT);
        this.content = tfsTile;
        this.fromReccomended = z2;
        if (!tfsTile.fileInfoChecked) {
            new app.tfs.db.a(context, null, 2, null).c(tfsTile);
        }
        this.audioFile = tfsTile.audioFile;
        this.imageFile = tfsTile.imageFile;
        if ((m.a("podcast", tfsTile.content_type) || m.a("video", tfsTile.content_type)) && (tfsProfile = (TfsProfile) C0458a.f992h.a()) != null) {
            tfsTile.mergeHistoryRecord((TfsTilePosition) DbMain.b.f529j.c().e(TfsTilePosition.class, context, new f().J("content_id = ? AND profile_id = ?", new Long[]{tfsTile.id, tfsProfile.id})));
        }
    }

    public File getAlbumArtFile(Context context) {
        File file = this.imageFile;
        if (file == null || !file.exists()) {
            return null;
        }
        return this.imageFile;
    }

    public int getAlbumArtResource(Context context) {
        return M.a.a(this, context);
    }

    public String getAlbumArtUrl(Context context) {
        TfsPhoto image = this.content.getImage();
        if (image != null) {
            return image.getLarge();
        }
        return null;
    }

    public String getArtist(Context context) {
        return this.content.getSubtitle();
    }

    public final TfsTile getContent() {
        return this.content;
    }

    public Long getDurationMs() {
        Long l2 = this.content.length;
        if (l2 == null) {
            return null;
        }
        TimeUnit timeUnit = TimeUnit.SECONDS;
        m.d(l2, "length");
        return Long.valueOf(timeUnit.toMillis(l2.longValue()));
    }

    public File getFile(Context context) {
        File file = this.audioFile;
        if (file == null || !file.exists()) {
            return null;
        }
        return this.audioFile;
    }

    public final boolean getFromReccomended() {
        return this.fromReccomended;
    }

    public String getIdentifier() {
        String identifier = this.content.getIdentifier();
        m.d(identifier, "getIdentifier(...)");
        return identifier;
    }

    public Long getStartPositionMs() {
        if (m.a("podcast", this.content.content_type) || m.a("video", this.content.content_type)) {
            return Long.valueOf(TimeUnit.SECONDS.toMillis(this.content.getCurrentSeconds()));
        }
        return null;
    }

    public String getStreamUrl(Context context) {
        if (m.a(TfsTile.TILE_TYPE_CLIP, this.content.getType())) {
            return "https://24six.app/api/v3/clip/" + this.content.getId() + "/play?format=m3u8";
        }
        if (m.a(TfsTile.TILE_TYPE_STORY, this.content.getType())) {
            return "https://24six.app/api/v3/story/" + this.content.getId() + "/play?format=m3u8";
        }
        String audioStreamingFormat = this.content.getAudioStreamingFormat();
        m.d(audioStreamingFormat, "getAudioStreamingFormat(...)");
        return "https://24six.app/api/v3/content/" + this.content.getId() + "/play?format=" + audioStreamingFormat;
    }

    public String getTitle(Context context) {
        return this.content.getTitle();
    }

    public boolean isIdentifier(M m2) {
        return M.a.b(this, m2);
    }

    public boolean isLocalFile(Context context) {
        File file = this.audioFile;
        return file != null && file.exists();
    }

    public final void setFromReccomended(boolean z2) {
        this.fromReccomended = z2;
    }

    public MediaItem toMediaItem(Context context, Bundle bundle) {
        Uri parse;
        MediaItem.Builder builder = new MediaItem.Builder();
        if (isLocalFile(context)) {
            parse = Z.e(context, getFile(context));
            m.b((n.O(String.valueOf(parse), ".m4a", false, 2, (Object) null) || m.a("m4a", this.content.download_format)) ? builder.setMimeType("application/mp4") : (n.O(String.valueOf(parse), ".ogg", false, 2, (Object) null) || m.a("ogg", this.content.download_format)) ? builder.setMimeType("audio/ogg") : builder.setMimeType("application/mp4"));
        } else {
            parse = Uri.parse(getStreamUrl(context));
            String audioStreamingFormat = this.content.getAudioStreamingFormat();
            m.d(audioStreamingFormat, "getAudioStreamingFormat(...)");
            if (m.a("m3u8", audioStreamingFormat)) {
                builder.setMimeType("application/x-mpegURL");
            }
        }
        int i2 = m.a("podcast", this.content.getContentType()) ? 3 : 1;
        if (m.a("video", this.content.getContentType())) {
            i2 = 6;
        }
        MediaMetadata.Builder isPlayable = new MediaMetadata.Builder().setArtist(getArtist(context)).setTitle(getTitle(context)).setMediaType(Integer.valueOf(i2)).setIsBrowsable(Boolean.FALSE).setIsPlayable(Boolean.TRUE);
        m.d(isPlayable, "setIsPlayable(...)");
        TfsTile collection = this.content.getCollection();
        if (collection != null && !TextUtils.isEmpty(collection.getTitle())) {
            isPlayable.setAlbumTitle(collection.getTitle());
        }
        File albumArtFile = getAlbumArtFile(context);
        if (albumArtFile == null || !albumArtFile.exists()) {
            String albumArtUrl = getAlbumArtUrl(context);
            if (albumArtUrl != null) {
                isPlayable.setArtworkUri(Uri.parse(albumArtUrl));
            }
        } else {
            m.b(isPlayable.setArtworkUri(Z.e(context, albumArtFile)));
        }
        MediaItem build = builder.setMediaId(getIdentifier()).setMediaMetadata(isPlayable.build()).setRequestMetadata(new MediaItem.RequestMetadata.Builder().setExtras(bundle).build()).setUri(parse).build();
        m.d(build, "build(...)");
        return build;
    }

    public boolean isIdentifier(MediaItem mediaItem) {
        return M.a.c(this, mediaItem);
    }

    public boolean isIdentifier(String str) {
        return M.a.d(this, str);
    }
}