Permalink
Browse files

Merge pull request xbmc#1747 from axmhari/pvr-file-path-reviewed

 [pvr] Update internal naming of PVR items for better library integration (updated)
  • Loading branch information...
Arne Morten Kvarving
Arne Morten Kvarving committed Nov 12, 2012
2 parents 2bb3252 + 119cae6 commit f023c025495859ad09f6b76e389d92189e176138
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
@@ -2808,6 +2808,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))
@@ -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;
}
@@ -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 f023c02

Please sign in to comment.