Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[coreSubs] set default services for Tv Shows and Movies

  • Loading branch information...
commit cf858805b123d1accb0843282203456f836ceaa5 1 parent 5894f16
@amet amet authored
View
22 language/English/strings.po
@@ -12046,7 +12046,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"
View
16 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>
View
17 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;
@@ -211,18 +212,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)
Please sign in to comment.
Something went wrong with that request. Please try again.