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
- added possibility to choose folder for instant recording, possible
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;
}
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

View File

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

View File

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

View File

@ -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();

View File

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

View File

@ -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<cString> folders;
eRecMenuState NextAction;
void readFolders(cList<cNestedItem> *rootFolders, cString path) {
cList<cNestedItem> *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;
}