diff options
author | fape <fape88@gmail.com> | 2014-05-04 13:11:50 +0200 |
---|---|---|
committer | fape <fape88@gmail.com> | 2014-05-17 07:34:05 +0200 |
commit | 1d032ce9a2fe8671163b9ad35de6853230c4ba1a (patch) | |
tree | c262b7d043a89f7ff9bd64b9e989cdcf48a028b6 | |
parent | ae2bf55095bf47d62cc4f1a1ab6a7d979637c81c (diff) |
Automatically download first subtitle
-rwxr-xr-x | language/English/strings.po | 13 | ||||
-rw-r--r-- | system/settings/settings.xml | 5 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogSubtitles.cpp | 11 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogSubtitles.h | 1 |
4 files changed, 29 insertions, 1 deletions
diff --git a/language/English/strings.po b/language/English/strings.po index 58e811bc9e..03ad82061d 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -12292,7 +12292,18 @@ msgctxt "#24125" msgid "Custom location" msgstr "" -#empty strings from id 24126 to 24999 +#: system/settings/settings.xml +msgctxt "#24126" +msgid "Auto download first subtitle" +msgstr "" + +#. Description of setting "Videos -> Subtitles -> Auto download first subtitle" with label #24126 +#: system/settings/settings.xml +msgctxt "#24127" +msgid "Automatically download first subtitle from the search result list" +msgstr "" + +#empty strings from id 24128 to 24999 msgctxt "#25000" msgid "Notifications" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 0e4e952483..c69b476f06 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -949,6 +949,11 @@ <default>true</default> <control type="toggle" /> </setting> + <setting id="subtitles.downloadfirst" type="boolean" label="24126" help="24127"> + <level>2</level> + <default>false</default> + <control type="toggle" /> + </setting> <setting id="subtitles.tv" type="addon" label="24116" help="24117"> <level>1</level> <default>-</default> diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp index 6447575d2f..6eb3a1b326 100644 --- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp +++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp @@ -105,6 +105,7 @@ CGUIDialogSubtitles::CGUIDialogSubtitles(void) m_serviceItems = new CFileItemList; m_pausedOnRun = false; m_updateSubsList = false; + m_LastAutoDownloaded = ""; } CGUIDialogSubtitles::~CGUIDialogSubtitles(void) @@ -358,6 +359,16 @@ void CGUIDialogSubtitles::OnSearchComplete(const CFileItemList *items) m_subtitles->Assign(*items); UpdateStatus(SEARCH_COMPLETE); m_updateSubsList = true; + + if (!items->IsEmpty() && g_application.m_pPlayer->GetSubtitleCount() == 0 && + m_LastAutoDownloaded != g_application.CurrentFile() && CSettings::Get().GetBool("subtitles.downloadfirst")) + { + CFileItemPtr item = items->Get(0); + CLog::Log(LOGDEBUG, "%s - Automatically download first subtitle: %s", __FUNCTION__, item->GetLabel2().c_str()); + m_LastAutoDownloaded = g_application.CurrentFile(); + Download(*item); + } + SetInvalid(); } diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.h b/xbmc/video/dialogs/GUIDialogSubtitles.h index 614e31f5f6..dea4a66081 100644 --- a/xbmc/video/dialogs/GUIDialogSubtitles.h +++ b/xbmc/video/dialogs/GUIDialogSubtitles.h @@ -71,4 +71,5 @@ protected: CStdString m_strManualSearch; bool m_pausedOnRun; bool m_updateSubsList; ///< true if we need to update our subs list + CStdString m_LastAutoDownloaded; ///< Last video file path which automatically downloaded subtitle }; |