Use Kodi's version stored on the DB instead of calling Kodi in the download subtitles option

This commit is contained in:
Synced Synapse 2016-11-15 19:18:16 +00:00
parent a4945c8534
commit 4a8b2b4d43
1 changed files with 6 additions and 22 deletions

View File

@ -471,28 +471,12 @@ public class NowPlayingFragment extends Fragment
switch (which) { switch (which) {
case 0: case 0:
// Download subtitles. First check host version to see which method to call // Download subtitles. First check host version to see which method to call
Application.GetProperties getProperties = new Application.GetProperties(Application.GetProperties.VERSION); HostInfo hostInfo = hostManager.getHostInfo();
getProperties.execute(hostManager.getConnection(), new ApiCallback<ApplicationType.PropertyValue>() { if (hostInfo.getKodiVersionMajor() < 13) {
@Override showDownloadSubtitlesPreGotham();
public void onSuccess(ApplicationType.PropertyValue result) { } else {
if (!isAdded()) return; showDownloadSubtitlesPostGotham();
// Ok, we've got a version, decide which method to call }
if (result.version.major < 13) {
showDownloadSubtitlesPreGotham();
} else {
showDownloadSubtitlesPostGotham();
}
}
@Override
public void onError(int errorCode, String description) {
if (!isAdded()) return;
// Something went wrong
Toast.makeText(getActivity(),
String.format(getString(R.string.error_getting_properties), description),
Toast.LENGTH_SHORT).show();
}
}, callbackHandler);
break; break;
case 1: case 1:
Input.ExecuteAction syncSubtitleAction = new Input.ExecuteAction(Input.ExecuteAction.SUBTITLEDELAY); Input.ExecuteAction syncSubtitleAction = new Input.ExecuteAction(Input.ExecuteAction.SUBTITLEDELAY);