diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-05-05 23:57:05 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-05-05 23:57:05 +0000 |
commit | aba821e79cdcf657f84fd1be7c574e29f7835d12 (patch) | |
tree | 073688a2c98896e8b2a3499d4aa51306848b68b3 /recordings.cpp | |
parent | 36a0bb39d832bef433ee81c4f156411df521b358 (diff) | |
download | vdr-plugin-live-aba821e79cdcf657f84fd1be7c574e29f7835d12.tar.gz vdr-plugin-live-aba821e79cdcf657f84fd1be7c574e29f7835d12.tar.bz2 |
- General cleanup of recordings. Made design more like other pages
- Bugfix for #289, #291
- Adapted styles and helper classes.
- recordings should be now strict XHTML.
Diffstat (limited to 'recordings.cpp')
-rw-r--r-- | recordings.cpp | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/recordings.cpp b/recordings.cpp index 4c8aba8..72178c1 100644 --- a/recordings.cpp +++ b/recordings.cpp @@ -1,10 +1,13 @@ +#include <unistd.h> #include <cstring> #include <openssl/md5.h> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <string> #include <sstream> +#include <fstream> #include "tools.h" +#include "epg_events.h" #include "recordings.h" @@ -25,7 +28,7 @@ namespace vdrlive { MD5(reinterpret_cast<const unsigned char*>(fileName), strlen(fileName), md5); ostringstream hashStr; - hashStr << hex; + hashStr << "MD5" << hex; for (size_t i = 0; i < MD5_DIGEST_LENGTH; i++) hashStr << (0 + md5[i]); return hashStr.str(); @@ -190,6 +193,69 @@ namespace vdrlive { return m_recording->start; } + bool RecordingsTree::RecordingsItemRec::IsArchived() const + { + string filename = m_recording->FileName(); + + string vdrFile = filename + "/001.vdr"; + if (0 == access(vdrFile.c_str(), R_OK)) + return false; + + filename += "/dvd.vdr"; + return (0 == access(filename.c_str(), R_OK)); + } + + const std::string RecordingsTree::RecordingsItemRec::ArchiveId() const + { + string filename = m_recording->FileName(); + + filename += "/dvd.vdr"; + ifstream dvd(filename.c_str()); + + if (dvd) { + string archiveDisc; + string videoDisc; + dvd >> archiveDisc; + if ("0000" == archiveDisc) { + dvd >> videoDisc; + return videoDisc; + } + return archiveDisc; + } + return ""; + } + + EpgEventPtr RecordingsTree::CreateEpgEvent(const RecordingsItemPtr recItem) + { + const cRecordingInfo* info = recItem->RecInfo(); + if (info) { + std::string archived; + if (recItem->IsArchived()) { + archived += " ["; + archived += tr("On archive DVD No."); + archived += ": "; + archived += recItem->ArchiveId(); + archived += "]"; + } + EpgEventPtr epgEvent( + new EpgEvent( + recItem->Id(), + recItem->Name(), + info->Title() ? info->Title() : recItem->Name(), + info->ShortText() ? info->ShortText() : "", + info->Description() ? info->Description() : "", + archived, + recItem->StartTime(), + recItem->StartTime() + ) + ); + return epgEvent; + } + else { + return EpgEventPtr(); + } + } + RecordingsManagerPtr LiveRecordingsManager() { static weak_ptr<RecordingsManager> livingRecMan; |