summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY6
-rw-r--r--config.c51
-rw-r--r--config.h6
-rw-r--r--displaymenu.c58
-rw-r--r--displaymenu.h1
5 files changed, 115 insertions, 7 deletions
diff --git a/HISTORY b/HISTORY
index 4c93840a..7acfefb9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -26,7 +26,11 @@ VDR Plugin 'skinflatplus' Revision History
- [add] option MenuItemRecordingSeenTreshold to set the treshold when a recording will be marked as seen
- [add] plex-plugin icon (thanks MegaV0lt)
- [add] mpv-plugin icon (thanks MegaV0lt)
-
+- [add] menu recordings - add exclamation mark icon for folders if last recording is older than XX days.
+ Create a "recordings_old.cfg" file under PLUGINCONFIGPATH (for example: /etc/vdr/plugins/skinflatplus/recordings_old.cfg)
+ Each line has the format:
+ FOLDERNAME=DAYS
+ If last recording in the folder is older than DAYS than the exclamation mark icon will be shown.
2015-02-14: Version 0.5.1
- [fix] topbar number recordings
diff --git a/config.c b/config.c
index f197614c..5ae06d64 100644
--- a/config.c
+++ b/config.c
@@ -5,6 +5,7 @@
cFlatConfig::cFlatConfig(void) {
logoPath = "";
iconPath = "";
+ RecordingOldConfigFile = "";
DecorCurrent = -1;
DecorIndex = 0;
@@ -629,7 +630,12 @@ void cFlatConfig::Init(void) {
iconPath = cString::sprintf("%s/icons/", PLUGINRESOURCEPATH);
dsyslog("skinflatplus: iconPath: %s", *iconPath);
}
-
+ if( !strcmp(RecordingOldConfigFile, "") ) {
+ dsyslog("skinflatplus: PLUGINCONFIGPATH: %s", PLUGINCONFIGPATH);
+ RecordingOldConfigFile = cString::sprintf("%s/recordings_old.cfg", PLUGINCONFIGPATH);
+ dsyslog("skinflatplus: RecordingOldConfigFile: %s", *RecordingOldConfigFile);
+ RecordingOldLoadConfig();
+ }
ThemeInit();
DecorCheckAndInit();
}
@@ -828,6 +834,49 @@ void cFlatConfig::DecorLoadFile(cString File) {
}
}
+
+void cFlatConfig::RecordingOldLoadConfig(void) {
+ dsyslog("skinflatplus: load recording old config file: %s", *RecordingOldConfigFile);
+ RecordingOldFolder.clear();
+ RecordingOldValue.clear();
+
+ FILE *f = fopen(RecordingOldConfigFile, "r");
+ if( f ) {
+ int line = 0;
+ char *s;
+ cReadLine ReadLine;
+ while( (s = ReadLine.Read(f)) != NULL ) {
+ line++;
+ char *p = strchr(s, '#');
+ if (p)
+ *p = 0;
+ s = stripspace(skipspace(s));
+ if (!isempty(s)) {
+ char *n = s;
+ char *v = strchr(s, '=');
+ if (v) {
+ *v++ = 0;
+ n = stripspace(skipspace(n));
+ v = stripspace(skipspace(v));
+ int value = atoi( v );
+ dsyslog("skinflatplus: recording old config - folder: %s value: %d", n, value);
+ RecordingOldFolder.push_back( n );
+ RecordingOldValue.push_back( value );
+ }
+ }
+ }
+ }
+}
+
+int cFlatConfig::GetRecordingOldValue(std::string folder) {
+ std::vector<std::string>::size_type sz = RecordingOldFolder.size();
+ for( unsigned i = 0; i < sz; i++) {
+ if( RecordingOldFolder[i] == folder )
+ return RecordingOldValue[i];
+ }
+ return -1;
+}
+
void cFlatConfig::SetLogoPath(cString path) {
logoPath = checkSlashAtEnd(*path);
}
diff --git a/config.h b/config.h
index 8ae2b157..0dd57fd7 100644
--- a/config.h
+++ b/config.h
@@ -39,12 +39,18 @@ class cFlatConfig
void DecorCheckAndInit(void);
void GetConfigFiles(cStringList &Files);
+
+ void RecordingOldLoadConfig(void);
+ int GetRecordingOldValue(std::string folder);
public:
cString ThemeCurrent;
cString logoPath;
cString iconPath;
+ cString RecordingOldConfigFile;
+ std::vector<std::string> RecordingOldFolder;
+ std::vector<int> RecordingOldValue;
// BORDER TYPES
// 0 = none
// 1 = rect
diff --git a/displaymenu.c b/displaymenu.c
index af6a3aa6..20727230 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -2117,8 +2117,19 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index,
menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, font, menuItemWidth - Left - marginItem);
Left += font->Width(" 999 ");
if( Config.MenuItemRecordingShowFolderDate != 0 ) {
- buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level)));
- menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, font, menuItemWidth - Left - marginItem);
+ buffer = cString::sprintf("(%s) ", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level)));
+ menuPixmap->DrawText(cPoint(LeftWidth - font->Width(buffer) - fontHeight*2 - marginItem*2, Top), buffer, ColorExtraTextFg, ColorBg, font);
+ if( isRecordingOld( Recording, Level ) ) {
+ Left = LeftWidth - fontHeight*2 - marginItem*2;
+ if( Current )
+ img = imgLoader.LoadIcon("recording_old_cur", fontHeight, fontHeight);
+ else
+ img = imgLoader.LoadIcon("recording_old", fontHeight, fontHeight);
+ if( img ) {
+ menuIconsPixmap->DrawImage( cPoint(Left, Top), *img );
+ Left += img->Width() + marginItem;
+ }
+ }
}
if( Current && font->Width(RecName) > (menuItemWidth - LeftWidth - marginItem) && Config.ScrollerEnable ) {
@@ -2257,8 +2268,19 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index,
Left += fontSml->Width(" 999 ");
if( Config.MenuItemRecordingShowFolderDate != 0 ) {
- buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level)));
- menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
+ buffer = cString::sprintf(" (%s) ", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level)));
+ menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, fontSml);
+ if( isRecordingOld( Recording, Level ) ) {
+ Left += fontSml->Width(buffer);
+ if( Current )
+ img = imgLoader.LoadIcon("recording_old_cur", fontSmlHeight, fontSmlHeight);
+ else
+ img = imgLoader.LoadIcon("recording_old", fontSmlHeight, fontSmlHeight);
+ if( img ) {
+ menuIconsPixmap->DrawImage( cPoint(Left, Top), *img );
+ }
+ }
+
}
} else if( Total == -1 ) {
if( Current )
@@ -3941,6 +3963,28 @@ void cFlatDisplayMenu::ItemBorderClear(void) {
ItemsBorder.clear();
}
+bool cFlatDisplayMenu::isRecordingOld( const cRecording *Recording, int Level ) {
+ std::string RecFolder = GetRecordingName(Recording, Level, true).c_str();
+
+ int value = Config.GetRecordingOldValue( RecFolder );
+ if( value < 0 )
+ return false;
+
+ int LastRecTimeFromFolder = GetLastRecTimeFromFolder(Recording, Level);
+ time_t now;
+ time(&now);
+
+ int diffSecs = now - LastRecTimeFromFolder;
+ int days = diffSecs / (60 * 60 * 24);
+
+ //dsyslog("RecFolder: %s LastRecTimeFromFolder: %d time: %d value: %d diff: %d days: %d", RecFolder.c_str(), LastRecTimeFromFolder, now, value, diffSecs, days);
+ if( days > value )
+ return true;
+
+ return false;
+}
+
+
time_t cFlatDisplayMenu::GetLastRecTimeFromFolder(const cRecording *Recording, int Level) {
std::string RecFolder = GetRecordingName(Recording, Level, true).c_str();
time_t RecStart = Recording->Start();
@@ -5324,12 +5368,16 @@ void cFlatDisplayMenu::PreLoadImages(void) {
imgLoader.LoadIcon("recording_new", fontHeight, fontHeight);
imgLoader.LoadIcon("recording_new", fontSmlHeight, fontSmlHeight);
- imgLoader.LoadIcon("recording_cutted", fontHeight, fontHeight);
imgLoader.LoadIcon("recording_new_cur", fontHeight, fontHeight);
imgLoader.LoadIcon("recording_new_cur", fontSmlHeight, fontSmlHeight);
+ imgLoader.LoadIcon("recording_cutted", fontHeight, fontHeight);
imgLoader.LoadIcon("recording_cutted_cur", fontHeight, fontHeight);
imgLoader.LoadIcon("recording", fontHeight, fontHeight);
imgLoader.LoadIcon("folder", fontHeight, fontHeight);
+ imgLoader.LoadIcon("recording_old", fontHeight, fontHeight);
+ imgLoader.LoadIcon("recording_old_cur", fontHeight, fontHeight);
+ imgLoader.LoadIcon("recording_old", fontSmlHeight, fontSmlHeight);
+ imgLoader.LoadIcon("recording_old_cur", fontSmlHeight, fontSmlHeight);
}
diff --git a/displaymenu.h b/displaymenu.h
index ac53510e..28fd791e 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -89,6 +89,7 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
std::string GetRecordingName(const cRecording *Recording, int Level, bool isFolder);
string xml_substring(string source, const char* str_start, const char* str_end);
+ bool isRecordingOld( const cRecording *Recording, int Level );
const char* GetGenreIcon(uchar genre);
time_t GetLastRecTimeFromFolder(const cRecording *Recording, int Level);