Skip to content
Browse files

[pvr] Update internal naming of PVR items for better library integrat…

…ion.

It changes the internal path of PVR recordings to "pvr://recordings/<path>/<title>, TV (<channel>), <date>_<time>.pvr". This way XBMC has the same directory structure as the PVR server and some problems resulting from the previously used virtual date/time subdirectory are solved (e.g. availability of thumbnails and fanarts in "Files" view). To ensure proper scraping CFileItem::GetMovieName is changed to return the actual title instead of the filename for PVR recordings.
  • Loading branch information...
1 parent 5132cf8 commit 119cae6346d622050d81e8c2f39f8d214787fc5d @axmhari committed Nov 8, 2012
Showing with 38 additions and 6 deletions.
  1. +9 −0 xbmc/FileItem.cpp
  2. +22 −6 xbmc/pvr/recordings/PVRRecording.cpp
  3. +7 −0 xbmc/pvr/recordings/PVRRecording.h
View
9 xbmc/FileItem.cpp
@@ -2919,6 +2919,15 @@ CStdString CFileItem::GetMovieName(bool bUseFolderNames /* = false */) const
if (IsLabelPreformated())
return GetLabel();
+ if (m_pvrRecordingInfoTag)
+ return m_pvrRecordingInfoTag->m_strTitle;
+ else if (CUtil::IsTVRecording(m_strPath))
+ {
+ CStdString title = CPVRRecording::GetTitleFromURL(m_strPath);
+ if (!title.IsEmpty())
+ return title;
+ }
+
CStdString strMovieName = GetBaseMoviePath(bUseFolderNames);
if (URIUtils::IsStack(strMovieName))
View
28 xbmc/pvr/recordings/PVRRecording.cpp
@@ -24,6 +24,8 @@
#include "PVRRecordings.h"
#include "pvr/addons/PVRClients.h"
#include "utils/StringUtils.h"
+#include "utils/RegExp.h"
+#include "utils/StringUtils.h"
#include "epg/Epg.h"
@@ -241,13 +243,15 @@ void CPVRRecording::UpdatePath(void)
{
CStdString strTitle(m_strTitle);
CStdString strDatetime(m_recordingTime.GetAsSaveString());
- strTitle.Replace('/','-');
- strTitle.Remove('?');
+ CStdString strDirectory;
+ CStdString strChannel;
+ strTitle.Replace('/',' ');
- if (m_strDirectory != StringUtils::EmptyString)
- m_strFileNameAndPath.Format("pvr://recordings/%s/%s/%s.pvr", m_strDirectory.c_str(), strDatetime.c_str(), strTitle.c_str());
- else
- m_strFileNameAndPath.Format("pvr://recordings/%s/%s.pvr", strDatetime.c_str(), strTitle.c_str());
+ if (!m_strDirectory.IsEmpty())
+ strDirectory.Format("%s/", m_strDirectory.c_str());
+ if (!m_strChannelName.IsEmpty())
+ strChannel.Format(" (%s)", m_strChannelName.c_str());
+ m_strFileNameAndPath.Format("pvr://recordings/%s%s, TV%s, %s.pvr", strDirectory.c_str(), strTitle.c_str(), strChannel.c_str(), strDatetime.c_str());
}
}
@@ -258,3 +262,15 @@ const CDateTime &CPVRRecording::RecordingTimeAsLocalTime(void) const
return tmp;
}
+
+CStdString CPVRRecording::GetTitleFromURL(const CStdString &url)
+{
+ CRegExp reg(true);
+ if (reg.RegComp("pvr://recordings/(.*/)*(.*), TV( \\(.*\\))?, "
+ "(19[0-9][0-9]|20[0-9][0-9])[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9][0-9][0-9].pvr"))
+ {
+ if (reg.RegFind(url.c_str()) >= 0)
+ return reg.GetReplaceString("\\2");
+ }
+ return StringUtils::EmptyString;
+}
View
7 xbmc/pvr/recordings/PVRRecording.h
@@ -125,6 +125,13 @@ namespace PVR
void SetRecordingTimeFromUTC(CDateTime &recordingTime) { m_recordingTime = recordingTime; }
void SetRecordingTimeFromLocalTime(CDateTime &recordingTime) { m_recordingTime = recordingTime.GetAsUTCDateTime(); }
+ /*!
+ * @brief Retrieve the recording title from the URL path
+ * @param url the URL for the recording
+ * @return Title of the recording
+ */
+ static CStdString GetTitleFromURL(const CStdString &url);
+
private:
CDateTime m_recordingTime; /*!< start time of the recording */

0 comments on commit 119cae6

Please sign in to comment.
Something went wrong with that request. Please try again.