aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarnova <arnova@void.org>2013-10-15 13:24:35 +0200
committerarnova <arnova@void.org>2014-02-04 20:00:07 +0100
commit322bd18c0e4344760924d916cf4cf664be33fb85 (patch)
treeab6d2c7dfb05d1eb4e4b48bb560dff1574b7b41a
parentff6c59c8780ce2ff23f4e100fd8e5791dc343d95 (diff)
changed: Add logic to properly handle subtitles for stacked files
-rw-r--r--xbmc/Application.cpp8
-rw-r--r--xbmc/Application.h1
-rw-r--r--xbmc/video/dialogs/GUIDialogSubtitles.cpp15
3 files changed, 20 insertions, 4 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 08bfba0deb..c3797f7e8e 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -5214,6 +5214,14 @@ CFileItem& CApplication::CurrentFileItem()
return *m_itemCurrentFile;
}
+CFileItem& CApplication::CurrentUnstackedItem()
+{
+ if (m_itemCurrentFile->IsStack() && m_currentStack->Size() > 0)
+ return *(*m_currentStack)[m_currentStackPosition];
+ else
+ return *m_itemCurrentFile;
+}
+
void CApplication::ShowVolumeBar(const CAction *action)
{
CGUIDialog *volumeBar = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VOLUME_BAR);
diff --git a/xbmc/Application.h b/xbmc/Application.h
index a0e20b4253..e3a26c5e7c 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -156,6 +156,7 @@ public:
void ReloadSkin(bool confirm = false);
const CStdString& CurrentFile();
CFileItem& CurrentFileItem();
+ CFileItem& CurrentUnstackedItem();
virtual bool OnMessage(CGUIMessage& message);
PLAYERCOREID GetCurrentPlayer();
virtual void OnPlayBackEnded();
diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp
index 7d6f7aa215..d4748b3d9e 100644
--- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp
+++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp
@@ -222,7 +222,7 @@ void CGUIDialogSubtitles::FillServices()
}
std::string defaultService;
- const CFileItem &item = g_application.CurrentFileItem();
+ const CFileItem &item = g_application.CurrentUnstackedItem();
if (item.GetVideoContentType() == VIDEODB_CONTENT_TVSHOWS ||
item.GetVideoContentType() == VIDEODB_CONTENT_EPISODES)
// Set default service for tv shows
@@ -386,6 +386,8 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
CStdString strFileName;
CStdString strDestPath;
+#if 0
+ // TODO: Code to download all subtitles for all stack items in one run
if (g_application.CurrentFileItem().IsStack())
{
for (int i = 0; i < items->Size(); i++)
@@ -394,17 +396,22 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
// CLog::Log(LOGDEBUG, "Stack Subs [%s} Found", vecItems[i]->GetLabel().c_str());
}
}
- else if (StringUtils::StartsWith(g_application.CurrentFile(), "http://"))
+#endif
+
+ // Get (unstacked) path
+ const CStdString &strCurrentFile = g_application.CurrentUnstackedItem().GetPath();
+
+ if (StringUtils::StartsWith(strCurrentFile, "http://"))
{
strFileName = "TemporarySubs";
strDestPath = "special://temp/";
}
else
{
- strFileName = URIUtils::GetFileName(g_application.CurrentFile());
+ strFileName = URIUtils::GetFileName(strCurrentFile);
if (CSettings::Get().GetBool("subtitles.savetomoviefolder"))
{
- strDestPath = URIUtils::GetDirectory(g_application.CurrentFile());
+ strDestPath = URIUtils::GetDirectory(strCurrentFile);
if (!CUtil::SupportsWriteFileOperations(strDestPath))
strDestPath.clear();
}