aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/FileSystem/UPnPDirectory.cpp22
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp6
2 files changed, 28 insertions, 0 deletions
diff --git a/xbmc/FileSystem/UPnPDirectory.cpp b/xbmc/FileSystem/UPnPDirectory.cpp
index acdeb42fb3..138968c3be 100644
--- a/xbmc/FileSystem/UPnPDirectory.cpp
+++ b/xbmc/FileSystem/UPnPDirectory.cpp
@@ -348,6 +348,28 @@ CUPnPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
//CPictureInfoTag* tag = pItem->GetPictureInfoTag();
}
}
+
+ // look for subtitles
+ unsigned subs = 0;
+ for(unsigned r = 0; r < (*entry)->m_Resources.GetItemCount(); r++)
+ {
+ PLT_MediaItemResource& res = (*entry)->m_Resources[r];
+ PLT_ProtocolInfo& info = res.m_ProtocolInfo;
+ static const char* allowed[] = { "text/srt"
+ , "text/ssa"
+ , "text/sub"
+ , "text/idx" };
+ for(int type = 0; type < sizeof(allowed)/sizeof(allowed[0]); type++)
+ {
+ if(info.Match(PLT_ProtocolInfo("*", "*", allowed[type], "*")))
+ {
+ CStdString prop;
+ prop.Format("upnp:subtitle:%d", ++subs);
+ pItem->SetProperty(prop, (const char*)res.m_Uri);
+ break;
+ }
+ }
+ }
}
// if there is a thumbnail available set it here
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index 736a4156cb..02d1cab245 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -451,6 +451,12 @@ bool CDVDPlayer::OpenInputStream()
// find any available external subtitles
std::vector<std::string> filenames;
CDVDFactorySubtitle::GetSubtitles(filenames, m_filename);
+
+ // find any upnp subtitles
+ CStdString key("upnp:subtitle:1");
+ for(unsigned s = 1; m_item.HasProperty(key); key.Format("upnp:subtitle:%u", ++s))
+ filenames.push_back(m_item.GetProperty(key));
+
for(unsigned int i=0;i<filenames.size();i++)
AddSubtitleFile(filenames[i]);