package xyz.netfly.mobile.player;

import android.os.Build;
import java.io.File;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import xyz.stream.api.entity.SeriesEntity;
import xyz.stream.download.DownloadHelper;
import xyz.stream.download.DownloadManager;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class d implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f34958a = 2;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ String f34959b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f34960c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f34961d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f34962e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ Object f34963f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final /* synthetic */ Object f34964g;

    public /* synthetic */ d(int i10, String str, String str2, String str3, String str4, String str5) {
        this.f34959b = str;
        this.f34963f = str2;
        this.f34964g = str3;
        this.f34961d = str4;
        this.f34962e = str5;
        this.f34960c = i10;
    }

    @Override // java.lang.Runnable
    public final void run() {
        String str = this.f34959b;
        Object obj = this.f34964g;
        Object obj2 = this.f34963f;
        int i10 = this.f34958a;
        int iIntValue = this.f34960c;
        Object obj3 = this.f34962e;
        Object obj4 = this.f34961d;
        switch (i10) {
            case 0:
                t tVar = (t) obj4;
                SeriesEntity seriesEntity = (SeriesEntity) obj3;
                String str2 = (String) obj2;
                String str3 = (String) obj;
                if (Build.VERSION.SDK_INT >= 33 && g0.d.a(tVar.f35007a, "android.permission.POST_NOTIFICATIONS") != 0) {
                    androidx.core.app.f.c(tVar.f35007a, new String[]{"android.permission.POST_NOTIFICATIONS"}, 1001);
                }
                tVar.f35016j.startDownload(tVar.f35030x.getId().intValue(), tVar.f35030x.getSourceType().intValue(), tVar.f35030x.getTitle(), tVar.f35030x.getBackdropPath(), Integer.valueOf(iIntValue), seriesEntity.getCover(), Integer.valueOf(seriesEntity.getRuntime()), String.valueOf(seriesEntity.getRuntime()), str, tVar.f35030x.getTitle(), str2, str3);
                break;
            case 1:
                DownloadManager downloadManager = (DownloadManager) obj4;
                Integer num = (Integer) obj;
                downloadManager.getClass();
                DownloadHelper.getInstance().addTask(str, (File) obj3, "download_movie_helper_first_action").submit(downloadManager.f36044a);
                String absolutePath = ((File) obj2).getAbsolutePath();
                if (num != null) {
                    iIntValue = num.intValue();
                }
                downloadManager.downloadSubtitles(absolutePath, iIntValue);
                downloadManager.f36053j.post(new xyz.stream.download.e(downloadManager, downloadManager.f36051h, 0));
                break;
            default:
                String str4 = (String) obj2;
                String str5 = (String) obj;
                String str6 = (String) obj4;
                String str7 = (String) obj3;
                ExecutorService executorService = xyz.stream.utils.l.f36161a;
                try {
                    String str8 = str + ", " + str4;
                    HashMap map = new HashMap();
                    map.put("duration", kotlinx.coroutines.flow.h.r(str5, str6) + ", " + str7 + ", " + xyz.stream.utils.e.d().b() + ", " + str8);
                    map.put("video_id", String.valueOf(iIntValue));
                    map.put("imdb_id", str8);
                    kotlinx.coroutines.y.R("first_screen_time", map);
                    if (kotlinx.coroutines.flow.h.z(str5, str6) > 5) {
                        HashMap map2 = new HashMap();
                        map2.put("duration", kotlinx.coroutines.flow.h.r(str5, str6));
                        map2.put("time", kotlinx.coroutines.flow.h.C());
                        map2.put("video_id", iIntValue + ", " + xyz.stream.utils.e.d().b());
                        map2.put("imdb_id", str8);
                        kotlinx.coroutines.y.R("play_time_out", map2);
                    }
                } catch (Exception e10) {
                    xyz.stream.utils.h.c(e10.getMessage());
                }
                break;
        }
    }

    public /* synthetic */ d(t tVar, int i10, SeriesEntity seriesEntity, String str, String str2, String str3) {
        this.f34961d = tVar;
        this.f34960c = i10;
        this.f34962e = seriesEntity;
        this.f34959b = str;
        this.f34963f = str2;
        this.f34964g = str3;
    }

    public /* synthetic */ d(DownloadManager downloadManager, String str, File file, File file2, Integer num, int i10) {
        this.f34961d = downloadManager;
        this.f34959b = str;
        this.f34962e = file;
        this.f34963f = file2;
        this.f34964g = num;
        this.f34960c = i10;
    }
}
