Search in sources :

Example 1 with SubsProvider

use of butter.droid.provider.subs.SubsProvider in project butter-android by butterproject.

the class StreamPlayerPresenterImpl method loadSubtitle.

private void loadSubtitle() {
    SubtitleWrapper subtitle = streamInfo.getSubtitle();
    MediaWrapper media = streamInfo.getMedia();
    SubsProvider provider = providerManager.getSubsProvider(media.getProviderId());
    subtitleManager.downloadSubtitle(provider, media.getMedia(), subtitle).observeOn(AndroidSchedulers.mainThread()).subscribe(new MaybeObserver<SubtitleWrapper>() {

        @Override
        public void onSubscribe(final Disposable d) {
            disposeSubs();
            subsDisposable = d;
        }

        @Override
        public void onSuccess(final SubtitleWrapper subs) {
            loadSubs(subs.getFileUri());
        }

        @Override
        public void onError(final Throwable e) {
            // TODO show error loading subs
            Timber.d("Error loading subs");
        }

        @Override
        public void onComplete() {
            Timber.d("Maybe empty");
        }
    });
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Disposable(io.reactivex.disposables.Disposable) SubsProvider(butter.droid.provider.subs.SubsProvider) SubtitleWrapper(butter.droid.base.providers.subs.model.SubtitleWrapper)

Example 2 with SubsProvider

use of butter.droid.provider.subs.SubsProvider in project butter-android by butterproject.

the class BaseStreamLoadingFragmentPresenterImpl method loadSubtitles.

/**
 * Downloads the subs file
 */
private void loadSubtitles() {
    MediaWrapper media = streamInfo.getMedia();
    SubsProvider subsProvider = providerManager.getSubsProvider(media.getProviderId());
    SubtitleWrapper subtitle = streamInfo.getSubtitle();
    // TODO dispose
    subtitleManager.downloadSubtitle(subsProvider, media.getMedia(), subtitle).observeOn(AndroidSchedulers.mainThread()).subscribe(new MaybeObserver<SubtitleWrapper>() {

        @Override
        public void onSubscribe(final Disposable d) {
            subtitleDisposable = d;
        }

        @Override
        public void onSuccess(final SubtitleWrapper wrapper) {
            subtitleDisposable = null;
            startPlayer();
        }

        @Override
        public void onError(final Throwable e) {
            subtitleDisposable = null;
            startPlayer();
        }

        @Override
        public void onComplete() {
            subtitleDisposable = null;
            startPlayer();
        }
    });
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Disposable(io.reactivex.disposables.Disposable) SubsProvider(butter.droid.provider.subs.SubsProvider) SubtitleWrapper(butter.droid.base.providers.subs.model.SubtitleWrapper)

Aggregations

MediaWrapper (butter.droid.base.providers.media.model.MediaWrapper)2 SubtitleWrapper (butter.droid.base.providers.subs.model.SubtitleWrapper)2 SubsProvider (butter.droid.provider.subs.SubsProvider)2 Disposable (io.reactivex.disposables.Disposable)2