Skip to content

Commit

Permalink
backend provides airdate as string
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Mar 17, 2020
1 parent 5d5f5b2 commit 20864dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/cppmyth/MythProgramInfo.cpp
Expand Up @@ -329,9 +329,9 @@ uint16_t MythProgramInfo::Episode() const
return (m_proginfo ? m_proginfo->episode : -1);
}

time_t MythProgramInfo::Airdate() const
std::string MythProgramInfo::Airdate() const
{
return (m_proginfo ? m_proginfo->airdate : 0);
return (m_proginfo ? m_proginfo->airdate : "");
}

bool MythProgramInfo::IsDamaged() const
Expand Down
2 changes: 1 addition & 1 deletion src/cppmyth/MythProgramInfo.h
Expand Up @@ -82,7 +82,7 @@ class MythProgramInfo
std::string Inetref() const;
uint16_t Season() const;
uint16_t Episode() const;
time_t Airdate() const;
std::string Airdate() const;
bool IsDamaged() const;

std::string GroupingTitle() const;
Expand Down
25 changes: 5 additions & 20 deletions src/pvrclient-mythtv.cpp
Expand Up @@ -548,20 +548,6 @@ void PVRClientMythTV::RunHouseKeeping()
}
}

namespace
{

std::string ParseAsW3CDateString(time_t time)
{
std::tm* tm = std::localtime(&time);
char buffer[16];
std::strftime(buffer, 16, "%Y-%m-%d", tm);

return buffer;
}

} // unnamed namespace

PVR_ERROR PVRClientMythTV::GetEPGForChannel(ADDON_HANDLE handle, int iChannelUid, time_t iStart, time_t iEnd)
{
if (!m_control)
Expand Down Expand Up @@ -596,8 +582,7 @@ PVR_ERROR PVRClientMythTV::GetEPGForChannel(ADDON_HANDLE handle, int iChannelUid
tag.strEpisodeName = it->second->subTitle.c_str();
tag.strIconPath = "";
tag.strPlotOutline = "";
std::string strFirstAired((it->second->airdate > 0) ? ParseAsW3CDateString(it->second->airdate) : "");
tag.strFirstAired = strFirstAired.c_str();
tag.strFirstAired = it->second->airdate.c_str();
tag.iEpisodeNumber = (int)it->second->episode;
tag.iEpisodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE;
tag.iParentalRating = 0;
Expand Down Expand Up @@ -921,8 +906,9 @@ PVR_ERROR PVRClientMythTV::GetRecordings(ADDON_HANDLE handle)
PVR_RECORDING tag;
memset(&tag, 0, sizeof(PVR_RECORDING));
tag.bIsDeleted = false;
time_t airTime = Myth::StringToTime(it->second.Airdate());

tag.recordingTime = GetRecordingTime(it->second.Airdate(), it->second.RecordingStartTime());
tag.recordingTime = GetRecordingTime(airTime, it->second.RecordingStartTime());
tag.iDuration = it->second.Duration();
tag.iPlayCount = it->second.IsWatched() ? 1 : 0;
tag.iLastPlayedPosition = it->second.HasBookmark() ? 1 : 0;
Expand Down Expand Up @@ -950,7 +936,6 @@ PVR_ERROR PVRClientMythTV::GetRecordings(ADDON_HANDLE handle)
tag.iSeriesNumber = it->second.Season();
tag.iEpisodeNumber = it->second.Episode();
}
time_t airTime(it->second.Airdate());
if (difftime(airTime, 0) > 0)
{
struct tm airTimeDate;
Expand Down Expand Up @@ -1058,8 +1043,9 @@ PVR_ERROR PVRClientMythTV::GetDeletedRecordings(ADDON_HANDLE handle)
PVR_RECORDING tag;
memset(&tag, 0, sizeof(PVR_RECORDING));
tag.bIsDeleted = true;
time_t airTime = Myth::StringToTime(it->second.Airdate());

tag.recordingTime = GetRecordingTime(it->second.Airdate(), it->second.RecordingStartTime());
tag.recordingTime = GetRecordingTime(airTime, it->second.RecordingStartTime());
tag.iDuration = it->second.Duration();
tag.iPlayCount = it->second.IsWatched() ? 1 : 0;
tag.iLastPlayedPosition = it->second.HasBookmark() ? 1 : 0;
Expand All @@ -1079,7 +1065,6 @@ PVR_ERROR PVRClientMythTV::GetDeletedRecordings(ADDON_HANDLE handle)
tag.iSeriesNumber = it->second.Season();
tag.iEpisodeNumber = it->second.Episode();
}
time_t airTime(it->second.Airdate());
if (difftime(airTime, 0) > 0)
{
struct tm airTimeDate;
Expand Down

0 comments on commit 20864dd

Please sign in to comment.