diff --git a/base/src/main/java/butter/droid/base/content/preferences/DefaultPlayer.java b/base/src/main/java/butter/droid/base/content/preferences/DefaultPlayer.java index 6cf7605..fff60aa 100644 --- a/base/src/main/java/butter/droid/base/content/preferences/DefaultPlayer.java +++ b/base/src/main/java/butter/droid/base/content/preferences/DefaultPlayer.java @@ -28,12 +28,14 @@ import java.io.File; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import butter.droid.base.ButterApplication; import butter.droid.base.providers.media.models.Episode; import butter.droid.base.providers.media.models.Media; import butter.droid.base.providers.subs.SubsProvider; +import butter.droid.base.torrent.StreamInfo; import butter.droid.base.utils.LocaleUtils; import butter.droid.base.utils.PrefUtils; @@ -93,13 +95,23 @@ public static void set(String playerName, String playerData) { * @param location Video location * @return {@code true} if activity started, {@code false} otherwise */ - public static boolean start(Media media, String subLanguage, String location) { + public static boolean start(StreamInfo streamInfo, String location) { Context context = ButterApplication.getAppContext(); + + Media media = streamInfo.getMedia(); + + String subLanguage = streamInfo.getSubtitleLanguage(); + + String[] playerData = PrefUtils.get(context, Prefs.DEFAULT_PLAYER, "").split(DELIMITER); if (playerData.length > 1) { Intent intent = new Intent(); if (null != media && media.subtitles != null && media.subtitles.size() > 0 && subLanguage != null && !subLanguage.equals("no-subs")) { - File subsLocation = new File(SubsProvider.getStorageLocation(context), media.videoId + "-" + subLanguage + ".srt"); + + File subsLocation = new File(SubsProvider.getStorageLocation(context), String.format(Locale.US, "%s (%s) [%s] [WEBRip] [YTS.MX].srt", + media.title, + media.year, + streamInfo.getQuality())); TorrentStreamServer.getInstance().setStreamSrtSubtitle(subsLocation); intent.putExtra("subs", new Uri[]{Uri.parse(location.substring(0, location.lastIndexOf('.')) + ".srt")}); intent.putExtra("subs.name", new String[]{LocaleUtils.toLocale(subLanguage).getDisplayLanguage()}); diff --git a/mobile/src/main/java/butter/droid/fragments/StreamLoadingFragment.java b/mobile/src/main/java/butter/droid/fragments/StreamLoadingFragment.java index 80ec957..63a5b3f 100644 --- a/mobile/src/main/java/butter/droid/fragments/StreamLoadingFragment.java +++ b/mobile/src/main/java/butter/droid/fragments/StreamLoadingFragment.java @@ -236,7 +236,7 @@ protected void startPlayerActivity(String location, int resumePosition) { if (BeamManager.getInstance(mContext).isConnected()) { BeamPlayerActivity.startActivity(mContext, mStreamInfo, resumePosition); } else { - mPlayingExternal = DefaultPlayer.start(mStreamInfo.getMedia(), mStreamInfo.getSubtitleLanguage(), location); + mPlayingExternal = DefaultPlayer.start(mStreamInfo, location); if (!mPlayingExternal) { VideoPlayerActivity.startActivity(mContext, mStreamInfo, resumePosition); } @@ -252,6 +252,6 @@ protected void startPlayerActivity(String location, int resumePosition) { @OnClick(R.id.startexternal_button) public void externalClick(View v) { - DefaultPlayer.start(mStreamInfo.getMedia(), mStreamInfo.getSubtitleLanguage(), mStreamInfo.getVideoLocation()); + DefaultPlayer.start(mStreamInfo, mStreamInfo.getVideoLocation()); } }