diff options
author | Zeljko Ametovic <amet@users.noreply.github.com> | 2013-12-02 22:12:58 -0800 |
---|---|---|
committer | Zeljko Ametovic <amet@users.noreply.github.com> | 2013-12-02 22:12:58 -0800 |
commit | d2e1b690c2c99ee51f1c4e539fac6b1f1abb833c (patch) | |
tree | 1a69221cabc13fd39f8f608ad6621329614a0cbc | |
parent | 25de65e9869ddf11d4612a77156f374c838061b7 (diff) | |
parent | cf858805b123d1accb0843282203456f836ceaa5 (diff) |
Merge pull request #3746 from amet/setDefaultSubServices
[coreSubs] set default services for Tv Shows and Movies
-rwxr-xr-x | language/English/strings.po | 22 | ||||
-rw-r--r-- | system/settings/settings.xml | 16 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogSubtitles.cpp | 17 |
3 files changed, 52 insertions, 3 deletions
diff --git a/language/English/strings.po b/language/English/strings.po index 530ee6dbfe..0cb5e05d0f 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -12062,7 +12062,27 @@ msgctxt "#24115" msgid "Save subtitles to movie folder" msgstr "" -#empty strings from id 24116 to 24999 +#: system/settings/settings.xml +msgctxt "#24116" +msgid "Default TV Service" +msgstr "" + +#: system/settings/settings.xml +msgctxt "#24117" +msgid "Select service that will be used as default to search for TV Show subtitles" +msgstr "" + +#: system/settings/settings.xml +msgctxt "#24118" +msgid "Default Movie Service" +msgstr "" + +#: system/settings/settings.xml +msgctxt "#24119" +msgid "Select service that will be used as default to search for Movie subtitles" +msgstr "" + +#empty strings from id 24120 to 24999 msgctxt "#25000" msgid "Notifications" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index cd97a31990..4b69b388a4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -759,6 +759,22 @@ <multiselect>true</multiselect> </control> </setting> + <setting id="subtitles.tv" type="addon" label="24116" help="24117"> + <level>1</level> + <default>-</default> + <constraints> + <addontype>xbmc.subtitle.module</addontype> + </constraints> + <control type="button" format="addon" /> + </setting> + <setting id="subtitles.movie" type="addon" label="24118" help="24119"> + <level>1</level> + <default>-</default> + <constraints> + <addontype>xbmc.subtitle.module</addontype> + </constraints> + <control type="button" format="addon" /> + </setting> <setting id="subtitles.custompath" type="path" label="21366" help="36191"> <level>1</level> <default></default> diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp index 5621bbfd41..c3e4bd333a 100644 --- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp +++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp @@ -41,6 +41,7 @@ #include "utils/URIUtils.h" #include "URL.h" #include "Util.h" +#include "video/VideoDatabase.h" using namespace ADDON; using namespace XFILE; @@ -216,18 +217,30 @@ void CGUIDialogSubtitles::FillServices() return; } + std::string defaultService; + const CFileItem &item = g_application.CurrentFileItem(); + if (item.GetVideoContentType() == VIDEODB_CONTENT_TVSHOWS || + item.GetVideoContentType() == VIDEODB_CONTENT_EPISODES) + // Set default service for tv shows + defaultService = CSettings::Get().GetString("subtitles.tv"); + else + // Set default service for filemode and movies + defaultService = CSettings::Get().GetString("subtitles.movie"); + + std::string service = addons.front()->ID(); for (VECADDONS::const_iterator addonIt = addons.begin(); addonIt != addons.end(); addonIt++) { CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*addonIt, "plugin://", false)); m_serviceItems->Add(item); + if ((*addonIt)->ID() == defaultService) + service = (*addonIt)->ID(); } // Bind our services to the UI CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_SERVICELIST, 0, 0, m_serviceItems); OnMessage(msg); - // TODO: Default service support will need to check through the items to find the CFileItem in the loop above. - SetService(m_serviceItems->Get(0)->GetProperty("Addon.ID").asString()); + SetService(service); } bool CGUIDialogSubtitles::SetService(const std::string &service) |