added possibility to choose folder for instant recording

This commit is contained in:
louis 2013-07-18 17:59:59 +02:00
parent 780e17395f
commit 706cf4d8e5
11 changed files with 112 additions and 8 deletions

View File

@ -52,3 +52,5 @@ VDR Plugin 'tvguide' Revision History
- changed channel jump logic - changed channel jump logic
- red button also available in detail view - red button also available in detail view
- page scrolling with keys left and right in detail view - page scrolling with keys left and right in detail view
- added possibility to choose folder for instant recording, possible
folders are read from VDRs folders list

View File

@ -60,6 +60,7 @@ cTvguideConfig::cTvguideConfig() {
numAdditionalEPGPictures = 9; numAdditionalEPGPictures = 9;
epgImageWidthLarge = 525; epgImageWidthLarge = 525;
epgImageHeightLarge = 400; epgImageHeightLarge = 400;
recMenuAskFolder = 0;
fontIndex = 0; fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book"; fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0; FontButtonDelta = 0;
@ -288,6 +289,7 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value); else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value);
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value); else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value); else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value);
else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value);
else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value); else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value);
else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value); else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value);

View File

@ -64,6 +64,7 @@ class cTvguideConfig {
int epgImageHeightLarge; int epgImageHeightLarge;
cString epgImagePath; cString epgImagePath;
cString iconPath; cString iconPath;
int recMenuAskFolder;
int fontIndex; int fontIndex;
const char *fontNameDefault; const char *fontNameDefault;
int FontButtonDelta; int FontButtonDelta;

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-07-12 16:08+0200\n" "POT-Creation-Date: 2013-07-18 17:18+0200\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -90,6 +90,12 @@ msgstr "In Aufnahmen suchen"
msgid "Check for Timer Conflicts" msgid "Check for Timer Conflicts"
msgstr "Auf Timerkoflikte prüfen" msgstr "Auf Timerkoflikte prüfen"
msgid "Set Folder for"
msgstr "Verzeichnis festlegen für"
msgid "root video folder"
msgstr "Video Hauptverzeichnis"
msgid "Timer created" msgid "Timer created"
msgstr "Timer angelegt" msgstr "Timer angelegt"
@ -429,6 +435,9 @@ msgstr "Sehr großer Sprung (Tasten 4 / 6) in Stunden"
msgid "Time Format (12h/24h)" msgid "Time Format (12h/24h)"
msgstr "Zeitformat (12h/24h)" msgstr "Zeitformat (12h/24h)"
msgid "Use folders for instant records"
msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen"
msgid "Display Reruns in detailed EPG View" msgid "Display Reruns in detailed EPG View"
msgstr "Wiederholungen in der detailierten EPG Ansicht anzeigen" msgstr "Wiederholungen in der detailierten EPG Ansicht anzeigen"

View File

@ -30,10 +30,15 @@ void cRecManager::SetEPGSearchPlugin(void) {
} }
} }
cTimer *cRecManager::createTimer(const cEvent *event) { cTimer *cRecManager::createTimer(const cEvent *event, std::string path) {
cTimer *timer = new cTimer(event); cTimer *timer = new cTimer(event);
Timers.Add(timer); Timers.Add(timer);
Timers.SetModified(); Timers.SetModified();
if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~');
cString newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File());
timer->SetFile(*newFileName);
}
isyslog("timer %s added (active)", *timer->ToDescr()); isyslog("timer %s added (active)", *timer->ToDescr());
return timer; return timer;
} }

View File

@ -30,7 +30,7 @@ public:
cRecManager (void); cRecManager (void);
void SetEPGSearchPlugin(void); void SetEPGSearchPlugin(void);
bool EpgSearchAvailable(void) {return epgSearchAvailable;}; bool EpgSearchAvailable(void) {return epgSearchAvailable;};
cTimer *createTimer(const cEvent *event); cTimer *createTimer(const cEvent *event, std::string path);
void DeleteTimer(const cEvent *event); void DeleteTimer(const cEvent *event);
void DeleteTimer(int timerID); void DeleteTimer(int timerID);
void SaveTimer(cTimer *timer, cRecMenu *menu); void SaveTimer(cTimer *timer, cRecMenu *menu);

View File

@ -10,6 +10,7 @@ enum eRecMenuState {
rmsContinue, rmsContinue,
rmsClose, rmsClose,
rmsInstantRecord, rmsInstantRecord,
rmsInstantRecordFolder,
rmsIgnoreTimerConflict, rmsIgnoreTimerConflict,
rmsDeleteTimerConflictMenu, rmsDeleteTimerConflictMenu,
rmsEditTimerConflictMenu, rmsEditTimerConflictMenu,
@ -101,6 +102,7 @@ public:
int GetWidth(void); int GetWidth(void);
void SetPixmaps(void); void SetPixmaps(void);
void Draw(void); void Draw(void);
cString GetStringValue(void) { return text; };
eRecMenuState ProcessKey(eKeys Key); eRecMenuState ProcessKey(eKeys Key);
}; };

View File

@ -7,6 +7,7 @@ cRecMenuManager::cRecMenuManager(void) {
recManager = new cRecManager(); recManager = new cRecManager();
recManager->SetEPGSearchPlugin(); recManager->SetEPGSearchPlugin();
instantRecord = false; instantRecord = false;
folderChoosen = false;
currentConflict = -1; currentConflict = -1;
templateID = -1; templateID = -1;
timer = NULL; timer = NULL;
@ -27,6 +28,7 @@ void cRecMenuManager::Start(const cEvent *event) {
active = true; active = true;
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
instantRecord = false; instantRecord = false;
folderChoosen = false;
currentConflict = -1; currentConflict = -1;
templateID = -1; templateID = -1;
timer = NULL; timer = NULL;
@ -76,13 +78,26 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
//Creating timer for active Event //Creating timer for active Event
//if no conflict, confirm and exit //if no conflict, confirm and exit
instantRecord = true; instantRecord = true;
cString folder = "";
if (folderChoosen) {
int activeItem = activeMenu->GetActive(false);
if (activeItem > 0)
folder = activeMenu->GetStringValue(activeItem);
}
delete activeMenu; delete activeMenu;
cTimer *timer = recManager->createTimer(event); cTimer *timer = recManager->createTimer(event, *folder);
if (!displayTimerConflict(timer)) { if (!displayTimerConflict(timer)) {
activeMenu = new cRecMenuConfirmTimer(event); activeMenu = new cRecMenuConfirmTimer(event);
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsInstantRecordFolder:
//Asking for Folder
folderChoosen = true;
delete activeMenu;
activeMenu = new cRecMenuAskFolder(event);
activeMenu->Display();
break;
case rmsIgnoreTimerConflict: case rmsIgnoreTimerConflict:
//Confirming created Timer //Confirming created Timer
if (instantRecord) { if (instantRecord) {
@ -385,7 +400,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
break;} break;}
case rmsSearchRecord: { case rmsSearchRecord: {
const cEvent *ev = activeMenu->GetEventValue(activeMenu->GetActive(false)); const cEvent *ev = activeMenu->GetEventValue(activeMenu->GetActive(false));
cTimer *timer = recManager->createTimer(ev); cTimer *timer = recManager->createTimer(ev, "");
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchConfirmTimer(ev); activeMenu = new cRecMenuSearchConfirmTimer(ev);

View File

@ -12,6 +12,7 @@ private:
std::vector<TVGuideTimerConflict> conflictList; std::vector<TVGuideTimerConflict> conflictList;
std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates; std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates;
bool instantRecord; bool instantRecord;
bool folderChoosen;
int currentConflict; int currentConflict;
int templateID; int templateID;
bool searchWithOptions; bool searchWithOptions;

View File

@ -5,7 +5,10 @@ class cRecMenuMain : public cRecMenu {
public: public:
cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) {
if (!timerActive) { if (!timerActive) {
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), rmsInstantRecord, true)); eRecMenuState action = (tvguideConfig.recMenuAskFolder)
?rmsInstantRecordFolder
:rmsInstantRecord;
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true));
} else { } else {
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true)); AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true));
AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false)); AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false));
@ -37,6 +40,69 @@ public:
virtual ~cRecMenuMain(void) {}; virtual ~cRecMenuMain(void) {};
}; };
// --- cRecMenuAskFolder ---------------------------------------------------------
class cRecMenuAskFolder: public cRecMenu {
private:
std::vector<cString> folders;
void readFolders(cList<cNestedItem> *rootFolders, cString path) {
cList<cNestedItem> *foldersLevel = NULL;
if (rootFolders) {
foldersLevel = rootFolders;
} else {
foldersLevel = &Folders;
}
for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) {
cString strFolder = cString::sprintf("%s%s", *path, folder->Text());
folders.push_back(strFolder);
cList<cNestedItem> *subItems = folder->SubItems();
if (subItems) {
cString newPath = cString::sprintf("%s%s/", *path, folder->Text());
readFolders(subItems, newPath);
}
}
}
public:
cRecMenuAskFolder(const cEvent *event) {
SetWidthPercent(80);
cString message = tr("Set Folder for");
cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title());
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText);
infoItem->CalculateHeight(width - 2 * border);
SetHeader(infoItem);
AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, true, false));
readFolders(NULL, "");
int numFolders = folders.size();
for (int i=0; i < numFolders; i++) {
AddMenuItemScroll(new cRecMenuItemButton(*folders[i], rmsInstantRecord, false, false));
if (!CheckHeight())
break;
}
CalculateHeight();
CreatePixmap();
Arrange();
};
cRecMenuItem *GetMenuItem(int number) {
if (number == 0) {
cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false);
return result;
} else if ((number > 0) && (number < folders.size()+1)) {
cRecMenuItem *result = new cRecMenuItemButton(*folders[number-1], rmsInstantRecord, false, false);
return result;
}
return NULL;
};
int GetTotalNumMenuItems(void) {
return folders.size()+1;
};
virtual ~cRecMenuAskFolder(void) {};
};
// --- cRecMenuConfirmTimer --------------------------------------------------------- // --- cRecMenuConfirmTimer ---------------------------------------------------------
class cRecMenuConfirmTimer: public cRecMenu { class cRecMenuConfirmTimer: public cRecMenu {
public: public:

View File

@ -82,6 +82,7 @@ void cTvguideSetup::Store(void) {
SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent); SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent);
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent); SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeight", tvguideConfig.footerHeight); SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder);
SetupStore("fontIndex", tvguideConfig.fontIndex); SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta); SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta);
SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta); SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta);
@ -167,7 +168,7 @@ void cMenuSetupGeneral::Set(void) {
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12)); Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48)); Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems)); Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
Add(new cMenuEditBoolItem(tr("Use folders for instant records"), &tmpTvguideConfig->recMenuAskFolder));
Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView)); Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView));
if (tmpTvguideConfig->displayRerunsDetailEPGView) { if (tmpTvguideConfig->displayRerunsDetailEPGView) {
Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10)); Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10));