PrimeIPTV Plus v2.1.0版本的 MD5 值为:44f247a9048d0121c6011174ea55496e

以下内容为反编译后的 ApiManager.java 源代码,内容仅作参考


package com.lck.lxtream.Net;

import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.lck.lxtream.DB.Auth;
import com.lck.lxtream.DB.AuthX;
import com.lck.lxtream.DB.Authentification;
import com.lck.lxtream.DB.Cat;
import com.lck.lxtream.DB.CatIUD;
import com.lck.lxtream.DB.CatList;
import com.lck.lxtream.DB.CatListIUD;
import com.lck.lxtream.DB.ChanSUBs;
import com.lck.lxtream.DB.ChanX;
import com.lck.lxtream.DB.Channels;
import com.lck.lxtream.DB.Chans;
import com.lck.lxtream.DB.DBManager;
import com.lck.lxtream.DB.Epg;
import com.lck.lxtream.DB.EpgResult;
import com.lck.lxtream.DB.IPEntry;
import com.lck.lxtream.DB.Listings;
import com.lck.lxtream.DB.MovieInfo;
import com.lck.lxtream.DB.MovieInfoIUD;
import com.lck.lxtream.DB.NewCodeEntry;
import com.lck.lxtream.DB.Package;
import com.lck.lxtream.DB.PackageList;
import com.lck.lxtream.DB.PackageListFilms;
import com.lck.lxtream.DB.PackageListSeries;
import com.lck.lxtream.DB.PackageUtil;
import com.lck.lxtream.DB.PublicKeyEntry;
import com.lck.lxtream.DB.PwdInfo;
import com.lck.lxtream.DB.RenewInfoQHD;
import com.lck.lxtream.DB.RenewProducts;
import com.lck.lxtream.DB.RenewResult;
import com.lck.lxtream.DB.SeriesChanX;
import com.lck.lxtream.DB.SeriesEpisodes;
import com.lck.lxtream.DB.UserInfo;
import com.lck.lxtream.DB.VersionInfo;
import com.lck.lxtream.DB.VersionUpdateInfo;
import com.lck.lxtream.DB.VodChanX;
import com.lck.lxtream.DB.VodChannels;
import com.lck.lxtream.DB.VodChans;
import com.lck.lxtream.DB.VodChansIUD;
import com.lck.lxtream.Utils.AesUtils;
import com.lck.lxtream.Utils.Config;
import com.lck.lxtream.Utils.Constant;
import com.lck.lxtream.Utils.DeviceUtil;
import com.lck.lxtream.Utils.L;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.logging.HttpLoggingInterceptor;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;
public class ApiManager {
    private static final long TIMEOUT = 10000;
    private static final long TIMEOUT_PAYMENT = 20000;
    private static AllService allService = null;
    private static IPService ipService = null;
    private static IUDService iudService = null;
    private static QHDLiveService qhdLiveService = null;
    private static QHDLiveService qhdLiveService1536 = null;
    private static QHDLiveService qhdLiveServiceSecond = null;
    private static QHDVodService qhdVodService = null;
    private static RenewService renewPaymentn = null;
    private static RenewService renewProduct = null;
    private static RenewService renewService = null;
    private static OkHttpClient sOkHttpClient = null;
    private static OkHttpClient sOkHttpClientPayment = null;
    private static final String series = "MydalAle798024V";
    private static SUBService subService;
    private static UpdateService updateService;
    private static XtreamAllEpgService xtreamAllEpgService;
    private static SUBService xtreamSUBService;
    private static XtreamService xtreamService;
    private static XtreamService xtreamServiceXML;

    public interface ProgressListener {
        void onComplete();

        void onError(Exception exc);

        void update(long j, long j2);
    }

    private static class ProgressResponseBody extends ResponseBody {
        private static Handler sHandler = new Handler(Looper.getMainLooper());
        private BufferedSource bufferedSource;
        private final ProgressListener progressListener;
        private final ResponseBody responseBody;

        public class AnonymousClass1 extends ForwardingSource {
            long a;

            AnonymousClass1(Source source) {
                super(source);
                this.a = 0L;
            }

            @Override
            public long read(Buffer buffer, long j) throws IOException {
                long read = super.read(buffer, j);
                this.a += read != -1 ? read : 0L;
                if (ProgressResponseBody.this.progressListener != null) {
                    ProgressResponseBody.sHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            ProgressResponseBody.this.progressListener.update(AnonymousClass1.this.a, ProgressResponseBody.this.responseBody.contentLength());
                        }
                    });
                }
                return read;
            }
        }

        public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
            this.responseBody = responseBody;
            this.progressListener = progressListener;
        }

        private Source source(Source source) {
            return new AnonymousClass1(source);
        }

        @Override
        public long contentLength() {
            return this.responseBody.contentLength();
        }

        @Override
        public MediaType contentType() {
            return this.responseBody.contentType();
        }

        @Override
        public BufferedSource source() {
            if (this.bufferedSource == null) {
                this.bufferedSource = Okio.buffer(source(this.responseBody.source()));
            }
            return this.bufferedSource;
        }
    }

    static {
        HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
            @Override
            public void log(String str) {
                try {
                    Log.d("Log-okhttp", str);
                } catch (RuntimeException unused) {
                    System.out.println(str);
                }
            }
        });
        httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
        sOkHttpClient = new OkHttpClient.Builder().connectTimeout(TIMEOUT, TimeUnit.MILLISECONDS).readTimeout(TIMEOUT, TimeUnit.MILLISECONDS).cookieJar(new CookieJar() {
            private final HashMap<String, List<Cookie>> cookieStore = new HashMap<>();

            @Override
            public List<Cookie> loadForRequest(HttpUrl httpUrl) {
                List<Cookie> list = this.cookieStore.get(httpUrl.host());
                return list != null ? list : new ArrayList();
            }

            @Override
            public void saveFromResponse(HttpUrl httpUrl, List<Cookie> list) {
                this.cookieStore.put(httpUrl.host(), list);
            }
        }).addInterceptor(httpLoggingInterceptor).build();
        sOkHttpClientPayment = new OkHttpClient.Builder().connectTimeout(TIMEOUT_PAYMENT, TimeUnit.MILLISECONDS).readTimeout(TIMEOUT_PAYMENT, TimeUnit.MILLISECONDS).cookieJar(new CookieJar() {
            private final HashMap<String, List<Cookie>> cookieStore = new HashMap<>();

            @Override
            public List<Cookie> loadForRequest(HttpUrl httpUrl) {
                List<Cookie> list = this.cookieStore.get(httpUrl.host());
                return list != null ? list : new ArrayList();
            }

            @Override
            public void saveFromResponse(HttpUrl httpUrl, List<Cookie> list) {
                this.cookieStore.put(httpUrl.host(), list);
            }
        }).addInterceptor(httpLoggingInterceptor).build();
        String DecryptString = AesUtils.DecryptString(Config.All_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString2 = AesUtils.DecryptString(Config.QHD_LIVE_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString3 = AesUtils.DecryptString(Config.QHD_LIVE_SECOND_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString4 = AesUtils.DecryptString(Config.QHD_LIVE_HOST_1536, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString5 = AesUtils.DecryptString(Config.QHD_VOD_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString6 = AesUtils.DecryptString(Config.IUD_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString7 = AesUtils.DecryptString(Config.SUB_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString8 = AesUtils.DecryptString(Config.SUB_HOST_Xtream, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString9 = AesUtils.DecryptString(Config.UPDATE_AD_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString10 = AesUtils.DecryptString(Config.IP_HOST3, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString11 = AesUtils.DecryptString(Config.RENEW_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString12 = AesUtils.DecryptString(Config.RENEW_PRODUCT_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        String DecryptString13 = AesUtils.DecryptString(Config.RENEW_PRODUCT_HOST, Constant.URL_KEY_NED, Constant.URL_KEY_NED);
        ipService = (IPService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString10).build().create(IPService.class);
        allService = (AllService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString).build().create(AllService.class);
        qhdLiveService = (QHDLiveService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString2).build().create(QHDLiveService.class);
        qhdLiveServiceSecond = (QHDLiveService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString3).build().create(QHDLiveService.class);
        qhdLiveService1536 = (QHDLiveService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString4).build().create(QHDLiveService.class);
        qhdVodService = (QHDVodService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString5).build().create(QHDVodService.class);
        iudService = (IUDService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString6).build().create(IUDService.class);
        subService = (SUBService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString7).build().create(SUBService.class);
        xtreamSUBService = (SUBService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString8).build().create(SUBService.class);
        xtreamAllEpgService = (XtreamAllEpgService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(SimpleXmlConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString8).build().create(XtreamAllEpgService.class);
        updateService = (UpdateService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString9).build().create(UpdateService.class);
        renewService = (RenewService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString11).build().create(RenewService.class);
        renewProduct = (RenewService) new Retrofit.Builder().client(sOkHttpClientPayment).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString12).build().create(RenewService.class);
        renewPaymentn = (RenewService) new Retrofit.Builder().client(sOkHttpClientPayment).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(DecryptString13).build().create(RenewService.class);
    }

    public static String creatCacheUpUrl(Epg epg, String str, String str2, String str3, long j) {
        if (!str.substring(0, 7).equals("http://") && !str.substring(0, 8).equals("https://")) {
            str = "http://" + str;
        }
        if (!str.substring(str.length() - 1).equals("/")) {
            str = str + "/";
        }
        StringBuffer stringBuffer = new StringBuffer(str);
        String str4 = epg.getStart().substring(0, 10) + ":" + epg.getStart().substring(11);
        L.i("current start:" + str4, new Object[0]);
        stringBuffer.append("streaming/");
        stringBuffer.append("timeshift.php?username=");
        stringBuffer.append(str2);
        stringBuffer.append("&password=");
        stringBuffer.append(str3);
        stringBuffer.append("&stream=");
        stringBuffer.append(String.valueOf(j));
        stringBuffer.append("&start=");
        stringBuffer.append(str4);
        stringBuffer.append("&duration=");
        stringBuffer.append((Long.decode(epg.getStop_timestamp()).longValue() - Long.decode(epg.getStart_timestamp()).longValue()) / 60);
        return stringBuffer.toString();
    }

    private static void createXtreamService(String str) {
        Retrofit.Builder builder;
        if (!str.substring(0, 7).equals("http://") && !str.substring(0, 8).equals("https://")) {
            str = "http://" + str;
        }
        if (!str.substring(str.length() - 1).equals("/")) {
            str = str + "/";
        }
        if (str.split("//").length == 2) {
            try {
                xtreamService = (XtreamService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(str).build().create(XtreamService.class);
                return;
            } catch (Exception unused) {
                builder = new Retrofit.Builder();
            }
        } else {
            builder = new Retrofit.Builder();
        }
        xtreamService = (XtreamService) builder.client(sOkHttpClient).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl("http://ipsatprodh.com:8000/").build().create(XtreamService.class);
    }

    private static void createXtreamXMLService(String str) {
        Retrofit.Builder builder;
        if (!str.substring(0, 7).equals("http://") && !str.substring(0, 8).equals("https://")) {
            str = "http://" + str;
        }
        if (!str.substring(str.length() - 1).equals("/")) {
            str = str + "/";
        }
        if (str.split("//").length == 2) {
            try {
                xtreamServiceXML = (XtreamService) new Retrofit.Builder().client(sOkHttpClient).addConverterFactory(SimpleXmlConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl(str).build().create(XtreamService.class);
                return;
            } catch (Exception unused) {
                builder = new Retrofit.Builder();
            }
        } else {
            builder = new Retrofit.Builder();
        }
        xtreamServiceXML = (XtreamService) builder.client(sOkHttpClient).addConverterFactory(SimpleXmlConverterFactory.create()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).baseUrl("http://ipsatprodh.com:8000/").build().create(XtreamService.class);
    }

    public static void download(String str, final String str2, final ProgressListener progressListener) {
        sOkHttpClient.newBuilder().addNetworkInterceptor(new Interceptor() {
            @Override
            public Response intercept(Interceptor.Chain chain) throws IOException {
                Response proceed = chain.proceed(chain.request());
                return proceed.newBuilder().body(new ProgressResponseBody(proceed.body(), ProgressListener.this)).build();
            }
        }).build().newCall(new Request.Builder().url(str).build()).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, final IOException iOException) {
                if (ProgressListener.this != null) {
                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        @Override
                        public void run() {
                            ProgressListener.this.onError(iOException);
                        }
                    });
                }
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                byte[] bArr = new byte[2048];
                InputStream byteStream = response.body().byteStream();
                FileOutputStream fileOutputStream = new FileOutputStream(new File(str2));
                while (true) {
                    int read = byteStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    fileOutputStream.write(bArr, 0, read);
                }
                fileOutputStream.flush();
                fileOutputStream.close();
                byteStream.close();
                if (ProgressListener.this != null) {
                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        @Override
                        public void run() {
                            ProgressListener.this.onComplete();
                        }
                    });
                }
            }
        });
    }

    public static Observable<VersionInfo> getADVersionInfo() {
        return updateService.getVersionInfo().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<EpgResult> getAllEpgData(String str, String str2, String str3) {
        createXtreamXMLService(str);
        return xtreamServiceXML.getAllEpg(str2, str3).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<EpgResult> getAllEpgXtream(String str, String str2) {
        return xtreamAllEpgService.getAllEpg(str, str2).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListFilms> getAllFilmPackagePRO(String str) {
        return allService.getAllFilmPackagePro(str, Config.VOD_FILM).doOnNext(new Consumer<PackageListFilms>() {
            @Override
            public void accept(PackageListFilms packageListFilms) throws Exception {
                DBManager.syncPackageFilms(packageListFilms.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListFilms> getAllFilmPackageQHD(String str) {
        return allService.getAllFilmPackage(str, Config.VOD_FILM).doOnNext(new Consumer<PackageListFilms>() {
            @Override
            public void accept(PackageListFilms packageListFilms) throws Exception {
                DBManager.syncPackageFilms(packageListFilms.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getAllListChannelsQHD(final Long l, UserInfo userInfo) {
        return qhdLiveService.getPackageList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) throws Exception {
                List<Package> list = packageList.bouquets;
                Long l2 = l;
                DBManager.syncPackage(list, l2 == null ? -1L : l2.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Chans> getAllLiveChanIUD(String str) {
        return iudService.getAllLievChanList(str).doOnNext(new Consumer<Chans>() {
            @Override
            public void accept(Chans chans) throws Exception {
                DBManager.syncChansAll(chans.channels);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<ChanSUBs> getAllLiveChanList(String str) {
        return subService.getAllLievChanList(str).doOnNext(new Consumer<ChanSUBs>() {
            @Override
            public void accept(ChanSUBs chanSUBs) throws Exception {
                L.i("all chan size :" + chanSUBs.channels.size(), new Object[0]);
                DBManager.syncChansAllSUB(chanSUBs.channels);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Channels> getAllLiveChannelsPRO(String str) {
        return allService.getAllLiveChannelPro(str, Config.LIVE_CHANNEL).doOnNext(new Consumer<Channels>() {
            @Override
            public void accept(Channels channels) throws Exception {
                DBManager.syncChannels(channels.channels, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Channels> getAllLiveChannelsQHD(String str) {
        return allService.getAllLiveChannel(str, Config.LIVE_CHANNEL).doOnNext(new Consumer<Channels>() {
            @Override
            public void accept(Channels channels) throws Exception {
                DBManager.syncChannels(channels.channels, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getAllLiveChansIUD(final String str) {
        return iudService.getAllLievChanList(str).doOnNext(new Consumer<Chans>() {
            @Override
            public void accept(Chans chans) throws Exception {
                DBManager.syncChansAll(chans.channels);
            }
        }).flatMap(new Function<Chans, Observable<String>>() {
            @Override
            public Observable<String> apply(Chans chans) throws Exception {
                return ApiManager.getLiveAllCatListIUD(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getAllLiveChansSUB(final String str) {
        return subService.getAllLievChanList(str).doOnNext(new Consumer<ChanSUBs>() {
            @Override
            public void accept(ChanSUBs chanSUBs) throws Exception {
                L.i("all chan size :" + chanSUBs.channels.size(), new Object[0]);
                DBManager.syncChansAllSUB(chanSUBs.channels);
            }
        }).flatMap(new Function<ChanSUBs, Observable<String>>() {
            @Override
            public Observable<String> apply(ChanSUBs chanSUBs) throws Exception {
                return ApiManager.getLiveAllCatListSUB(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getAllLivePackagePRO(String str) {
        return allService.getAllLivePackagePro(str, Config.LIVE_PACKAGE).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) throws Exception {
                DBManager.syncPackage(packageList.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getAllLivePackageQHD(String str) {
        return allService.getAllLivePackage(str, Config.LIVE_PACKAGE).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) throws Exception {
                DBManager.syncPackage(packageList.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListSeries> getAllSeriesPackagePRO(String str) {
        return allService.getAllSeriesPackagePro(str, Config.VOD_SERIES).doOnNext(new Consumer<PackageListSeries>() {
            @Override
            public void accept(PackageListSeries packageListSeries) throws Exception {
                DBManager.syncPackageSeries(packageListSeries.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListSeries> getAllSeriesPackageQHD(String str) {
        return allService.getAllSeriesPackage(str, Config.VOD_SERIES).doOnNext(new Consumer<PackageListSeries>() {
            @Override
            public void accept(PackageListSeries packageListSeries) throws Exception {
                DBManager.syncPackageSeries(packageListSeries.bouquets, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VodChannels> getAllVodChannelsPRO(String str) {
        return allService.getAllVodChannelPro(str, Config.VOD_CHANNEL).doOnNext(new Consumer<VodChannels>() {
            @Override
            public void accept(VodChannels vodChannels) throws Exception {
                DBManager.syncVodChannels(vodChannels.channels, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VodChannels> getAllVodChannelsQHD(String str) {
        return allService.getAllVodChannel(str, Config.VOD_CHANNEL).doOnNext(new Consumer<VodChannels>() {
            @Override
            public void accept(VodChannels vodChannels) throws Exception {
                DBManager.syncVodChannels(vodChannels.channels, 0L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getAllVodChansIUD(final String str) {
        return iudService.getAllVodChanList(str).doOnNext(new Consumer<VodChansIUD>() {
            @Override
            public void accept(VodChansIUD vodChansIUD) throws Exception {
                DBManager.syncVodChansIUDAll(vodChansIUD.channels);
            }
        }).flatMap(new Function<VodChansIUD, Observable<String>>() {
            @Override
            public Observable<String> apply(VodChansIUD vodChansIUD) throws Exception {
                return Observable.just(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getAllVodChansSUB(final String str) {
        return subService.getAllVodChanList(str).doOnNext(new Consumer<VodChans>() {
            @Override
            public void accept(VodChans vodChans) throws Exception {
                DBManager.syncVodChansAll(vodChans.channels);
            }
        }).flatMap(new Function<VodChans, Observable<String>>() {
            @Override
            public Observable<String> apply(VodChans vodChans) throws Exception {
                return Observable.just(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Listings> getEgpInfoIUD(String str, int i) {
        return iudService.getEpgInfo(str, Integer.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Listings> getEgpInfoSUB(String str, int i) {
        return subService.getEpgInfo(str, Integer.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Listings> getEpgInfoSUBXtream(String str, String str2, String str3, String str4) {
        return xtreamSUBService.getLiveChanXEPG(str, str2, str3, str4).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PublicKeyEntry> getKey(String str) {
        return renewPaymentn.getPublic(str).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getLiveAllCatListIUD(final String str) {
        return iudService.getLiveCatList(str).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) {
                DBManager.syncCat(catList.category, 300L);
            }
        }).flatMap(new Function<CatList, Observable<String>>() {
            @Override
            public Observable<String> apply(CatList catList) throws Exception {
                return Observable.just(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getLiveAllCatListSUB(final String str) {
        return subService.getLiveCatList(str).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) {
                DBManager.syncCat(catList.category, 200L);
            }
        }).flatMap(new Function<CatList, Observable<String>>() {
            @Override
            public Observable<String> apply(CatList catList) throws Exception {
                return Observable.just(str);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<CatList> getLiveAllCatListsIUD(String str) {
        return iudService.getLiveCatList(str).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) {
                DBManager.syncCat(catList.category, 300L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<CatList> getLiveCatListIUD(String str) {
        return null;
    }

    public static Observable<CatList> getLiveCatListSUB(String str) {
        return subService.getLiveCatList(str).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) {
                DBManager.syncCat(catList.category, 200L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<CatList> getLiveCatListsSUB(String str) {
        return subService.getLiveCatList(str).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) {
                DBManager.syncCat(catList.category, 200L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<Cat>> getLiveCateagesX(String str, String str2, String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getLiveCategorysX(str2, str3, str4).doOnNext(new Consumer<List<Cat>>() {
            @Override
            public void accept(List<Cat> list) throws Exception {
                DBManager.syncCat(list, 600L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<ChanX>> getLiveChanX(final String str, final String str2, final String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getAllLiveChanX(str2, str3, str4).doOnNext(new Consumer<List<ChanX>>() {
            @Override
            public void accept(List<ChanX> list) throws Exception {
                DBManager.syncChansAll(PackageUtil.ChanXList2ChanList(list, str, str2, str3));
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<ChanX>> getLiveChanXByCategoryId(String str, String str2, String str3, String str4, String str5) {
        createXtreamService(str);
        return xtreamService.getLiveChanX(str2, str3, str4, str5).doOnNext(new Consumer<List<ChanX>>() {
            @Override
            public void accept(List<ChanX> list) throws Exception {
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Channels> getLiveChannelsQHD(Long l, UserInfo userInfo) {
        return qhdLiveService.getChannelList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<Channels>() {
            @Override
            public void accept(Channels channels) {
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Chans> getLiveChansIUD(final Long l, UserInfo userInfo) {
        return iudService.getLiveChanList(userInfo.activeCode, l).doOnNext(new Consumer<Chans>() {
            @Override
            public void accept(Chans chans) {
                DBManager.syncChansSim(chans.channels, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<ChanSUBs> getLiveChansSUB(final Long l, UserInfo userInfo) {
        return subService.getLiveChanList(userInfo.activeCode, l).doOnNext(new Consumer<ChanSUBs>() {
            @Override
            public void accept(ChanSUBs chanSUBs) {
                DBManager.syncChanSUBsSim(chanSUBs.channels, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getLivePackageListQHD(Long l, UserInfo userInfo) {
        return qhdLiveService.getPackageList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) {
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getLivePackageListSUB(final Long l, UserInfo userInfo) {
        return subService.getPackageList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) {
                List<Package> list = packageList.bouquets;
                Long l2 = l;
                DBManager.syncPackage(list, l2 == null ? -1L : l2.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<MovieInfoIUD> getMovieInfoIUD(String str, String str2) {
        return iudService.getMovieInfo(str, str2).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<MovieInfo> getMovieInfoSUB(String str, String str2) {
        return subService.getMovieInfo(str, str2).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<IPEntry> getNetIp3(String str) {
        return ipService.getNetIp3(str).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<NewCodeEntry> getNewCode(String str) {
        return renewProduct.syncCode(str).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<Cat>> getOnLiveCateagesX(String str, String str2, String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getLiveCategorysX(str2, str3, str4).doOnNext(new Consumer<List<Cat>>() {
            @Override
            public void accept(List<Cat> list) throws Exception {
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PwdInfo> getPwdFromCode(String str) {
        return subService.getPwd(str).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<RenewInfoQHD> getRenewInfo(String str, String str2, String str3) {
        return renewService.getRenewInfo(str, str2, str3).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<RenewInfoQHD> getRenewInfoNew(String str, String str2) {
        return renewService.getRenewInfoNew(str, str2, "ah3&234N314V%$MW1").subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<RenewProducts> getRenewProducts(int i, String str) {
        return renewProduct.getRenewProducts(Integer.valueOf(i), str).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<String> getSeriesCatListSUB(final UserInfo userInfo, Long l, final Long l2) {
        return subService.getCatList(userInfo.activeCode, l).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) throws Exception {
                DBManager.syncCat(catList.category, l2.longValue());
            }
        }).flatMap(new Function<CatList, Observable<String>>() {
            @Override
            public Observable<String> apply(CatList catList) throws Exception {
                return Observable.just(UserInfo.this.activeCode);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<CatIUD>> getSeriesCateagesX(String str, String str2, String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getSeriesCategorysX(str2, str3, str4).doOnNext(new Consumer<List<CatIUD>>() {
            @Override
            public void accept(List<CatIUD> list) throws Exception {
                DBManager.syncCatIUD(list, 601L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<SeriesChanX>> getSeriesChanX(final String str, final String str2, final String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getAllSeriesChanX(str2, str3, str4).doOnNext(new Consumer<List<SeriesChanX>>() {
            @Override
            public void accept(List<SeriesChanX> list) throws Exception {
                DBManager.syncVodChansIUDAll(PackageUtil.SeriesChanXList2VodChanIUDList(list, str, str2, str3), Constant.Series);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<SeriesEpisodes> getSeriesInfoX(String str, String str2, String str3, String str4, int i) {
        createXtreamService(str);
        return xtreamService.getAllSeriesInfoX(str2, str3, str4, i).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VersionUpdateInfo> getVersionUpdateInfo() {
        return updateService.getVersionUpdateInfo().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<CatListIUD> getVodCatListIUD(String str, Long l, final Long l2) {
        return iudService.getCatList(str, l).doOnNext(new Consumer<CatListIUD>() {
            @Override
            public void accept(CatListIUD catListIUD) throws Exception {
                DBManager.syncCatIUD(catListIUD.category, l2.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<CatList> getVodCatListSUB(String str, Long l, final Long l2) {
        return subService.getCatList(str, l).doOnNext(new Consumer<CatList>() {
            @Override
            public void accept(CatList catList) throws Exception {
                DBManager.syncCat(catList.category, l2.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<CatIUD>> getVodCateagesX(String str, String str2, String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getFilmCategorysX(str2, str3, str4).doOnNext(new Consumer<List<CatIUD>>() {
            @Override
            public void accept(List<CatIUD> list) throws Exception {
                DBManager.syncCatIUD(list, 602L);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<List<VodChanX>> getVodChanX(final String str, final String str2, final String str3, String str4) {
        createXtreamService(str);
        return xtreamService.getAllVodChanX(str2, str3, str4).doOnNext(new Consumer<List<VodChanX>>() {
            @Override
            public void accept(List<VodChanX> list) throws Exception {
                DBManager.syncVodChansIUDAll(PackageUtil.VodChanXList2VodChanIUDList(list, str, str2, str3), Constant.Movie);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VodChannels> getVodChannelsQHD(final Long l, UserInfo userInfo) {
        return qhdVodService.getChannelList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<VodChannels>() {
            @Override
            public void accept(VodChannels vodChannels) {
                DBManager.syncVodChannels(vodChannels.channels, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VodChans> getVodChansIUD(final Long l, UserInfo userInfo) {
        return iudService.getVodChan(userInfo.activeCode, l).doOnNext(new Consumer<VodChans>() {
            @Override
            public void accept(VodChans vodChans) throws Exception {
                DBManager.sycnVodChans(vodChans.channels, l);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<VodChans> getVodChansSUB(Long l, UserInfo userInfo) {
        return subService.getVodChan(userInfo.activeCode, l).doOnNext(new Consumer<VodChans>() {
            @Override
            public void accept(VodChans vodChans) throws Exception {
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListFilms> getVodPackageListFilmQHD(final Long l, UserInfo userInfo) {
        return qhdVodService.getPackageListFilms(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageListFilms>() {
            @Override
            public void accept(PackageListFilms packageListFilms) {
                DBManager.syncPackageFilms(packageListFilms.bouquets, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageList> getVodPackageListQHD(final Long l, UserInfo userInfo) {
        return qhdVodService.getPackageList(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageList>() {
            @Override
            public void accept(PackageList packageList) {
                DBManager.syncPackage(packageList.bouquets, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<PackageListSeries> getVodPackageListSeriesQHD(final Long l, UserInfo userInfo) {
        return qhdVodService.getPackageListSeries(userInfo.activeCode, userInfo.mac, l, userInfo.serial, userInfo.model).doOnNext(new Consumer<PackageListSeries>() {
            @Override
            public void accept(PackageListSeries packageListSeries) {
                DBManager.syncPackageSeries(packageListSeries.bouquets, l.longValue());
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Listings> getXtreamEgpInfo(String str, String str2, String str3, String str4, int i) {
        createXtreamService(str);
        return xtreamService.getLiveChanXEPG(str2, str3, str4, String.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Listings> getXtreamEgpInfoSUB(String str, String str2, String str3, int i) {
        return xtreamSUBService.getLiveChanXEPG(str, str2, str3, String.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<MovieInfo> getXtreamMovieInfo(String str, String str2, String str3, String str4, int i) {
        createXtreamService(str);
        return xtreamService.getVodChanXMovieInfo(str2, str3, str4, String.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<MovieInfo> getXtreamSUBMovieInfo(String str, String str2, String str3, int i) {
        return xtreamSUBService.getVodChanXMovieInfo(str, str2, str3, String.valueOf(i)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<SeriesEpisodes> getXtreamSUBSeriesInfo(String str, String str2, String str3, int i) {
        return xtreamSUBService.getAllSeriesInfoX(str, str2, str3, i).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Auth> loginIUD(UserInfo userInfo) {
        return iudService.login(userInfo.activeCode, series, DeviceUtil.getSystemLanguage()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Authentification> loginQHD(UserInfo userInfo) {
        return qhdLiveService.login(userInfo.activeCode, userInfo.mac, userInfo.serial, userInfo.model).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Authentification> loginQHD1536(UserInfo userInfo) {
        return qhdLiveService1536.login(userInfo.activeCode, userInfo.mac, userInfo.serial, userInfo.model).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Authentification> loginQHDSecond(UserInfo userInfo) {
        return qhdLiveServiceSecond.login(userInfo.activeCode, userInfo.mac, userInfo.serial, userInfo.model).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Auth> loginSUB(UserInfo userInfo) {
        return subService.login(userInfo.activeCode, DeviceUtil.getSystemLanguage()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<AuthX> loginX(String str, String str2, String str3) {
        createXtreamService(str);
        return xtreamService.loginX(str2, str3).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<RenewResult> sendPaymentData(String str, String str2, String str3, float f, String str4, String str5, String str6, String str7, String str8, String str9) {
        return renewPaymentn.sendCreditInfo(str, str2, str3, Float.valueOf(f), str4, str5, str6, str7, str8, str9).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
}