From 00a2d7bd9ae6e46cae134d45823290c7ea6fec7f Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 19 Jul 2013 15:30:41 +0200 Subject: [PATCH] recording folder also choosable for series timers --- HISTORY | 1 + recmanager.c | 10 ++++++++-- recmanager.h | 2 +- recmenuitem.h | 1 + recmenumanager.c | 19 +++++++++++++++++-- recmenumanager.h | 1 + recmenus.c | 20 +++++++++++++------- 7 files changed, 42 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index 3da6bd0..9656a96 100644 --- a/HISTORY +++ b/HISTORY @@ -54,3 +54,4 @@ VDR Plugin 'tvguide' Revision History - 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 +- recording folder also choosable for series timers diff --git a/recmanager.c b/recmanager.c index f744520..b1f21fb 100644 --- a/recmanager.c +++ b/recmanager.c @@ -196,7 +196,7 @@ std::vector cRecManager::CheckTimerConflict(void) { return results; } -cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu) { +cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu, std::string path) { bool active = menu->GetBoolValue(1); int channelNumber = menu->GetIntValue(2); int start = menu->GetIntValue(3); @@ -209,13 +209,19 @@ cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu) { cChannel *channel = Channels.GetByNumber(channelNumber); cTimer *seriesTimer = new cTimer(false, false, channel); + cString fileName = "TITLE EPISODE"; + if (path.size() > 0) { + std::replace(path.begin(), path.end(), '/', '~'); + fileName = cString::sprintf("%s~%s", path.c_str(), *fileName); + } + seriesTimer->SetDay(tday); seriesTimer->SetStart(start); seriesTimer->SetStop(stop); seriesTimer->SetPriority(prio); seriesTimer->SetLifetime(lifetime); seriesTimer->SetWeekDays(weekdays); - seriesTimer->SetFile("TITLE EPISODE"); + seriesTimer->SetFile(*fileName); if (active) seriesTimer->SetFlags(tfActive); else diff --git a/recmanager.h b/recmanager.h index 36eb0db..648d4c2 100644 --- a/recmanager.h +++ b/recmanager.h @@ -36,7 +36,7 @@ public: void SaveTimer(cTimer *timer, cRecMenu *menu); bool IsRecorded(const cEvent *event); std::vector CheckTimerConflict(void); - cTimer *CreateSeriesTimer(cRecMenu *menu); + cTimer *CreateSeriesTimer(cRecMenu *menu, std::string path); std::string BuildEPGSearchString(cString searchString, cRecMenu *menu); std::string BuildEPGSearchString(cString searchString, std::string templValue); const cEvent **PerformSearchTimerSearch(std::string epgSearchString, int &numResults); diff --git a/recmenuitem.h b/recmenuitem.h index 1091a6b..7162f70 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -28,6 +28,7 @@ enum eRecMenuState { rmsSearchRecordConfirm, rmsSearchNothingFoundConfirm, rmsSeriesTimer, + rmsSeriesTimerFolder, rmsSeriesTimerCreate, rmsSearchTimer, rmsSearchTimerOptions, diff --git a/recmenumanager.c b/recmenumanager.c index 3d4f089..17d89ec 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -11,6 +11,7 @@ cRecMenuManager::cRecMenuManager(void) { currentConflict = -1; templateID = -1; timer = NULL; + recFolder = ""; searchWithOptions = false; detailViewActive = false; } @@ -32,6 +33,7 @@ void cRecMenuManager::Start(const cEvent *event) { currentConflict = -1; templateID = -1; timer = NULL; + recFolder = ""; searchWithOptions = false; detailViewActive = false; SetBackground(); @@ -95,7 +97,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { //Asking for Folder folderChoosen = true; delete activeMenu; - activeMenu = new cRecMenuAskFolder(event); + activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord); activeMenu->Display(); break; case rmsIgnoreTimerConflict: @@ -195,13 +197,26 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { * --------- SERIES TIMER --------------------------------- */ case rmsSeriesTimer: { + recFolder = ""; + if (folderChoosen) { + int activeItem = activeMenu->GetActive(false); + if (activeItem > 0) + recFolder = activeMenu->GetStringValue(activeItem); + } delete activeMenu; cChannel *channel = Channels.GetByChannelID(event->ChannelID()); activeMenu = new cRecMenuSeriesTimer(channel, event); activeMenu->Display(); break; } + case rmsSeriesTimerFolder: + //Asking for Folder + folderChoosen = true; + delete activeMenu; + activeMenu = new cRecMenuAskFolder(event, rmsSeriesTimer); + activeMenu->Display(); + break; case rmsSeriesTimerCreate: { - cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu); + cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu, *recFolder); delete activeMenu; activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer); activeMenu->Display(); diff --git a/recmenumanager.h b/recmenumanager.h index 6dce22e..71d6f49 100644 --- a/recmenumanager.h +++ b/recmenumanager.h @@ -17,6 +17,7 @@ private: int templateID; bool searchWithOptions; cTimer *timer; + cString recFolder; cString searchString; cDetailView *detailView; cPixmap *pixmapBackground; diff --git a/recmenus.c b/recmenus.c index ef3279a..62cf238 100644 --- a/recmenus.c +++ b/recmenus.c @@ -4,16 +4,20 @@ class cRecMenuMain : public cRecMenu { public: cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { + eRecMenuState action; if (!timerActive) { - eRecMenuState action = (tvguideConfig.recMenuAskFolder) - ?rmsInstantRecordFolder - :rmsInstantRecord; + action = (tvguideConfig.recMenuAskFolder) + ?rmsInstantRecordFolder + :rmsInstantRecord; AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true)); } else { AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true)); AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false)); } - AddMenuItem(new cRecMenuItemButton(tr("Create Series Timer"), rmsSeriesTimer, false)); + action = (tvguideConfig.recMenuAskFolder) + ?rmsSeriesTimerFolder + :rmsSeriesTimer; + AddMenuItem(new cRecMenuItemButton(tr("Create Series Timer"), action, false)); if (epgSearchAvailable) { AddMenuItem(new cRecMenuItemButton(tr("Create Search Timer"), rmsSearchTimer, false)); if (!switchTimerActive) { @@ -44,6 +48,7 @@ public: class cRecMenuAskFolder: public cRecMenu { private: std::vector folders; + eRecMenuState NextAction; void readFolders(cList *rootFolders, cString path) { cList *foldersLevel = NULL; if (rootFolders) { @@ -62,20 +67,21 @@ private: } } public: - cRecMenuAskFolder(const cEvent *event) { + cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) { SetWidthPercent(80); + NextAction = nextAction; 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)); + AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false)); readFolders(NULL, ""); int numFolders = folders.size(); for (int i=0; i < numFolders; i++) { - AddMenuItemScroll(new cRecMenuItemButton(*folders[i], rmsInstantRecord, false, false)); + AddMenuItemScroll(new cRecMenuItemButton(*folders[i], nextAction, false, false)); if (!CheckHeight()) break; }