recording folder also choosable for series timers

This commit is contained in:
louis 2013-07-19 15:30:41 +02:00
parent 706cf4d8e5
commit 00a2d7bd9a
7 changed files with 42 additions and 12 deletions

View File

@ -54,3 +54,4 @@ VDR Plugin 'tvguide' Revision History
- 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 - added possibility to choose folder for instant recording, possible
folders are read from VDRs folders list folders are read from VDRs folders list
- recording folder also choosable for series timers

View File

@ -196,7 +196,7 @@ std::vector<TVGuideTimerConflict> cRecManager::CheckTimerConflict(void) {
return results; return results;
} }
cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu) { cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu, std::string path) {
bool active = menu->GetBoolValue(1); bool active = menu->GetBoolValue(1);
int channelNumber = menu->GetIntValue(2); int channelNumber = menu->GetIntValue(2);
int start = menu->GetIntValue(3); int start = menu->GetIntValue(3);
@ -209,13 +209,19 @@ cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu) {
cChannel *channel = Channels.GetByNumber(channelNumber); cChannel *channel = Channels.GetByNumber(channelNumber);
cTimer *seriesTimer = new cTimer(false, false, channel); 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->SetDay(tday);
seriesTimer->SetStart(start); seriesTimer->SetStart(start);
seriesTimer->SetStop(stop); seriesTimer->SetStop(stop);
seriesTimer->SetPriority(prio); seriesTimer->SetPriority(prio);
seriesTimer->SetLifetime(lifetime); seriesTimer->SetLifetime(lifetime);
seriesTimer->SetWeekDays(weekdays); seriesTimer->SetWeekDays(weekdays);
seriesTimer->SetFile("TITLE EPISODE"); seriesTimer->SetFile(*fileName);
if (active) if (active)
seriesTimer->SetFlags(tfActive); seriesTimer->SetFlags(tfActive);
else else

View File

@ -36,7 +36,7 @@ public:
void SaveTimer(cTimer *timer, cRecMenu *menu); void SaveTimer(cTimer *timer, cRecMenu *menu);
bool IsRecorded(const cEvent *event); bool IsRecorded(const cEvent *event);
std::vector<TVGuideTimerConflict> CheckTimerConflict(void); std::vector<TVGuideTimerConflict> 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, cRecMenu *menu);
std::string BuildEPGSearchString(cString searchString, std::string templValue); std::string BuildEPGSearchString(cString searchString, std::string templValue);
const cEvent **PerformSearchTimerSearch(std::string epgSearchString, int &numResults); const cEvent **PerformSearchTimerSearch(std::string epgSearchString, int &numResults);

View File

@ -28,6 +28,7 @@ enum eRecMenuState {
rmsSearchRecordConfirm, rmsSearchRecordConfirm,
rmsSearchNothingFoundConfirm, rmsSearchNothingFoundConfirm,
rmsSeriesTimer, rmsSeriesTimer,
rmsSeriesTimerFolder,
rmsSeriesTimerCreate, rmsSeriesTimerCreate,
rmsSearchTimer, rmsSearchTimer,
rmsSearchTimerOptions, rmsSearchTimerOptions,

View File

@ -11,6 +11,7 @@ cRecMenuManager::cRecMenuManager(void) {
currentConflict = -1; currentConflict = -1;
templateID = -1; templateID = -1;
timer = NULL; timer = NULL;
recFolder = "";
searchWithOptions = false; searchWithOptions = false;
detailViewActive = false; detailViewActive = false;
} }
@ -32,6 +33,7 @@ void cRecMenuManager::Start(const cEvent *event) {
currentConflict = -1; currentConflict = -1;
templateID = -1; templateID = -1;
timer = NULL; timer = NULL;
recFolder = "";
searchWithOptions = false; searchWithOptions = false;
detailViewActive = false; detailViewActive = false;
SetBackground(); SetBackground();
@ -95,7 +97,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
//Asking for Folder //Asking for Folder
folderChoosen = true; folderChoosen = true;
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuAskFolder(event); activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord);
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsIgnoreTimerConflict: case rmsIgnoreTimerConflict:
@ -195,13 +197,26 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
* --------- SERIES TIMER --------------------------------- * --------- SERIES TIMER ---------------------------------
*/ */
case rmsSeriesTimer: { case rmsSeriesTimer: {
recFolder = "";
if (folderChoosen) {
int activeItem = activeMenu->GetActive(false);
if (activeItem > 0)
recFolder = activeMenu->GetStringValue(activeItem);
}
delete activeMenu; delete activeMenu;
cChannel *channel = Channels.GetByChannelID(event->ChannelID()); cChannel *channel = Channels.GetByChannelID(event->ChannelID());
activeMenu = new cRecMenuSeriesTimer(channel, event); activeMenu = new cRecMenuSeriesTimer(channel, event);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSeriesTimerFolder:
//Asking for Folder
folderChoosen = true;
delete activeMenu;
activeMenu = new cRecMenuAskFolder(event, rmsSeriesTimer);
activeMenu->Display();
break;
case rmsSeriesTimerCreate: { case rmsSeriesTimerCreate: {
cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu); cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu, *recFolder);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer); activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer);
activeMenu->Display(); activeMenu->Display();

View File

@ -17,6 +17,7 @@ private:
int templateID; int templateID;
bool searchWithOptions; bool searchWithOptions;
cTimer *timer; cTimer *timer;
cString recFolder;
cString searchString; cString searchString;
cDetailView *detailView; cDetailView *detailView;
cPixmap *pixmapBackground; cPixmap *pixmapBackground;

View File

@ -4,8 +4,9 @@
class cRecMenuMain : public cRecMenu { class cRecMenuMain : public cRecMenu {
public: public:
cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) {
eRecMenuState action;
if (!timerActive) { if (!timerActive) {
eRecMenuState action = (tvguideConfig.recMenuAskFolder) action = (tvguideConfig.recMenuAskFolder)
?rmsInstantRecordFolder ?rmsInstantRecordFolder
:rmsInstantRecord; :rmsInstantRecord;
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true)); AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true));
@ -13,7 +14,10 @@ public:
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));
} }
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) { if (epgSearchAvailable) {
AddMenuItem(new cRecMenuItemButton(tr("Create Search Timer"), rmsSearchTimer, false)); AddMenuItem(new cRecMenuItemButton(tr("Create Search Timer"), rmsSearchTimer, false));
if (!switchTimerActive) { if (!switchTimerActive) {
@ -44,6 +48,7 @@ public:
class cRecMenuAskFolder: public cRecMenu { class cRecMenuAskFolder: public cRecMenu {
private: private:
std::vector<cString> folders; std::vector<cString> folders;
eRecMenuState NextAction;
void readFolders(cList<cNestedItem> *rootFolders, cString path) { void readFolders(cList<cNestedItem> *rootFolders, cString path) {
cList<cNestedItem> *foldersLevel = NULL; cList<cNestedItem> *foldersLevel = NULL;
if (rootFolders) { if (rootFolders) {
@ -62,20 +67,21 @@ private:
} }
} }
public: public:
cRecMenuAskFolder(const cEvent *event) { cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) {
SetWidthPercent(80); SetWidthPercent(80);
NextAction = nextAction;
cString message = tr("Set Folder for"); cString message = tr("Set Folder for");
cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title()); cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title());
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText); cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText);
infoItem->CalculateHeight(width - 2 * border); infoItem->CalculateHeight(width - 2 * border);
SetHeader(infoItem); SetHeader(infoItem);
AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, true, false)); AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false));
readFolders(NULL, ""); readFolders(NULL, "");
int numFolders = folders.size(); int numFolders = folders.size();
for (int i=0; i < numFolders; i++) { 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()) if (!CheckHeight())
break; break;
} }