package xyz.netfly.ui.live.epg;

import androidx.room.RoomDatabase;
import java.util.List;
import xyz.stream.api.database.entity.EpgEntity;
import xyz.stream.api.entity.LiveEpgEntity;

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

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

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

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

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

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

    public /* synthetic */ j(q qVar, int i10, String str, List list) {
        this.f35356b = qVar;
        this.f35358d = i10;
        this.f35359e = str;
        this.f35357c = list;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f35355a;
        int i11 = this.f35358d;
        List<LiveEpgEntity> list = this.f35357c;
        q qVar = this.f35356b;
        switch (i10) {
            case 0:
                String str = this.f35359e;
                qVar.getClass();
                if (list != null) {
                    try {
                        if (!list.isEmpty()) {
                            qVar.f35391o.runInTransaction(new j(qVar, list, i11, str));
                        }
                    } catch (Exception e10) {
                        u.a.g(e10, new StringBuilder("saveEpgToDb error: "));
                        return;
                    }
                }
                break;
            default:
                String str2 = this.f35359e;
                qVar.getClass();
                for (LiveEpgEntity liveEpgEntity : list) {
                    if (liveEpgEntity.getEndTime() != null && liveEpgEntity.getEndTime().length() >= 10) {
                        String strI = kotlinx.coroutines.flow.h.i(liveEpgEntity.getEndTime(), "yyyy-MM-dd");
                        String strP = kotlinx.coroutines.flow.h.p(-3);
                        if (!strI.isEmpty() && strI.compareTo(strP) >= 0) {
                            vf.a aVarEpgDao = qVar.f35391o.epgDao();
                            String str3 = i11 + "_" + liveEpgEntity.getStartTime() + "_" + liveEpgEntity.getEndTime();
                            Integer id2 = liveEpgEntity.getId();
                            String title = liveEpgEntity.getTitle();
                            String description = liveEpgEntity.getDescription();
                            String startTime = liveEpgEntity.getStartTime();
                            String endTime = liveEpgEntity.getEndTime();
                            Integer numValueOf = Integer.valueOf(i11);
                            xyz.stream.utils.e.d().getClass();
                            v6.j jVar = (v6.j) aVarEpgDao;
                            androidx.room.util.b.b((RoomDatabase) jVar.f33700a, false, true, new h3.c(jVar, new EpgEntity(str3, id2, title, description, startTime, endTime, numValueOf, str2, xyz.stream.utils.e.f()), 2));
                            str2 = str2;
                        }
                    }
                }
                break;
        }
    }

    public /* synthetic */ j(q qVar, List list, int i10, String str) {
        this.f35356b = qVar;
        this.f35357c = list;
        this.f35358d = i10;
        this.f35359e = str;
    }
}
