changed video directory choosage behaviour

This commit is contained in:
louis 2014-02-06 17:38:55 +01:00
parent 9f127fbbb5
commit 567769ee87
16 changed files with 224 additions and 118 deletions

View File

@ -118,3 +118,6 @@ Version 1.1.0
- set blue key favorite mode as new default
Version 1.2.0
- changed video directory choosage behaviour: added possibility to use
a fixed recording dir which also supports epgsearch variables

View File

@ -45,6 +45,8 @@ cTvguideConfig::cTvguideConfig() {
epgImageWidthLarge = 525;
epgImageHeightLarge = 400;
recMenuAskFolder = 0;
instRecFolderMode = eFolderRoot;
instRecFixedFolder = "";
favWhatsOnNow = 1;
favWhatsOnNext = 1;
favUseTime1 = 0;
@ -278,6 +280,8 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value);
else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value);
else if (strcmp(Name, "instRecFolderMode") == 0) instRecFolderMode = atoi(Value);
else if (strcmp(Name, "instRecFixedFolder") == 0) instRecFixedFolder = Value;
else if (strcmp(Name, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value);
else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value);
else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value);

View File

@ -37,6 +37,11 @@ enum eBlueKeyMode {
eBlueKeyFavorites
};
enum eInstRecFolderMode {
eFolderRoot = 0,
eFolderSelect,
eFolderFixed
};
class cTvguideConfig {
private:
@ -94,6 +99,8 @@ class cTvguideConfig {
cString iconPathDefault;
cString epgImagePathDefault;
int recMenuAskFolder;
int instRecFolderMode;
std::string instRecFixedFolder;
int favWhatsOnNow;
int favWhatsOnNext;
int favUseTime1;

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"POT-Creation-Date: 2014-02-06 17:17+0100\n"
"PO-Revision-Date: 2013-09-21 17:49+0200\n"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n"
@ -234,7 +234,10 @@ msgstr "Inici temporitzador"
msgid "Timer stop time"
msgstr "Final temporitzador"
msgid "Folder"
msgid "Timer File"
msgstr ""
msgid "New Folder"
msgstr ""
msgid "Save"
@ -339,6 +342,9 @@ msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Use VPS"
msgstr ""
@ -759,8 +765,17 @@ msgstr "Mida de la Font petita - Menú Cerca & Enregistra"
msgid "Search & Recording Menu Header Font Size"
msgstr ""
msgid "Use folders for instant records"
msgstr "Utilitza carpetes per gravacions a l'instant"
msgid "Always use root video folder"
msgstr ""
msgid "Select from folder list"
msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Use Remotetimers"
msgstr "Utilitza temporitzadors remots"
@ -822,6 +837,9 @@ msgstr ""
msgid "Recording Menus Icon Cache"
msgstr ""
#~ msgid "Use folders for instant records"
#~ msgstr "Utilitza carpetes per gravacions a l'instant"
#~ msgid "Height of status header (Perc. of osd height)"
#~ msgstr "Alçada capçalera d'estat (% alçada OSD)"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"POT-Creation-Date: 2014-02-06 17:17+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -231,8 +231,11 @@ msgstr "Timer Start Zeit"
msgid "Timer stop time"
msgstr "Timer Stop Zeit"
msgid "Folder"
msgstr "Verzeichnis"
msgid "Timer File"
msgstr "Timer Datei"
msgid "New Folder"
msgstr "Neues Verzeichnis"
msgid "Save"
msgstr "Speichern"
@ -336,6 +339,9 @@ msgstr "Zeit nach Ende in Minuten"
msgid "Series Recording"
msgstr "Serienaufnahme"
msgid "Folder"
msgstr "Verzeichnis"
msgid "Use VPS"
msgstr "VPS benutzen"
@ -756,8 +762,17 @@ msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße"
msgid "Search & Recording Menu Header Font Size"
msgstr "Suchen & Aufnehmen Menu Header Schriftgröße"
msgid "Use folders for instant records"
msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen"
msgid "Always use root video folder"
msgstr "Immer root video Verzeichnis benutzen"
msgid "Select from folder list"
msgstr "Verzeichnis aus Liste auswählen"
msgid "Use fixed folder"
msgstr "Festes Verzeichnis benutzen"
msgid "Folder for instant Recordings"
msgstr "Verzeichnis für Sofortaufnahmen"
msgid "Use Remotetimers"
msgstr "RemoteTimers benutzen"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"POT-Creation-Date: 2014-02-06 17:17+0100\n"
"PO-Revision-Date: 2013-09-25 17:49+0400\n"
"Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@ -231,7 +231,10 @@ msgstr "Время c"
msgid "Timer stop time"
msgstr "Время до"
msgid "Folder"
msgid "Timer File"
msgstr ""
msgid "New Folder"
msgstr ""
msgid "Save"
@ -336,6 +339,9 @@ msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Use VPS"
msgstr ""
@ -756,8 +762,17 @@ msgstr "Размер маленького шрифта меню Поиск & З
msgid "Search & Recording Menu Header Font Size"
msgstr ""
msgid "Use folders for instant records"
msgstr "Использовать директории для быстрой записи"
msgid "Always use root video folder"
msgstr ""
msgid "Select from folder list"
msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Use Remotetimers"
msgstr "RemoteTimers benutzen"
@ -819,6 +834,9 @@ msgstr ""
msgid "Recording Menus Icon Cache"
msgstr ""
#~ msgid "Use folders for instant records"
#~ msgstr "Использовать директории для быстрой записи"
#~ msgid "Height of status header (Perc. of osd height)"
#~ msgstr "Высота верхней панели (% от высоты OSD)"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"POT-Creation-Date: 2014-02-06 17:17+0100\n"
"PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@ -231,7 +231,10 @@ msgstr "Pl
msgid "Timer stop time"
msgstr "Plán konèí"
msgid "Folder"
msgid "Timer File"
msgstr ""
msgid "New Folder"
msgstr ""
msgid "Save"
@ -336,6 +339,9 @@ msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Use VPS"
msgstr ""
@ -756,8 +762,17 @@ msgstr "H
msgid "Search & Recording Menu Header Font Size"
msgstr ""
msgid "Use folders for instant records"
msgstr "Pou¾i» adresáre pre okam¾ité nahrávky"
msgid "Always use root video folder"
msgstr ""
msgid "Select from folder list"
msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Use Remotetimers"
msgstr "Pou¾i» vzdialený plánovaè"
@ -819,6 +834,9 @@ msgstr ""
msgid "Recording Menus Icon Cache"
msgstr ""
#~ msgid "Use folders for instant records"
#~ msgstr "Pou¾i» adresáre pre okam¾ité nahrávky"
#~ msgid "Height of status header (Perc. of osd height)"
#~ msgstr "Vý¹ka stavovej hlavièky (% z OSD vý¹ky)"

View File

@ -114,6 +114,28 @@ cTimer *cRecManager::createRemoteTimer(const cEvent *event, std::string path) {
}
void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string path) {
if (tvguideConfig.instRecFolderMode == eFolderFixed) {
Epgsearch_services_v1_2 *epgSearch = new Epgsearch_services_v1_2;
std::string recDir = tvguideConfig.instRecFixedFolder;
std::replace(recDir.begin(), recDir.end(), '/', '~');
if (strchr(recDir.c_str(), '%') != NULL) {
if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) {
std::string newFileName = epgSearch->handler->Evaluate(recDir, event);
if (strchr(newFileName.c_str(), '%') == NULL) // only set directory to new value if all categories could have been replaced
timer->SetFile(newFileName.c_str());
else
esyslog("tvguide: timer path not set because replacing variable was not successfull: %s", newFileName.c_str());
}
} else {
cString newFileName;
if (recDir.size() > 0) {
newFileName = cString::sprintf("%s~%s", recDir.c_str(), timer->File());
timer->SetFile(*newFileName);
}
}
return;
}
//Set choosen path
cString newFileName;
if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~');
@ -121,10 +143,6 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
} else {
newFileName = event->Title();
}
if ( !isempty(event->ShortText()) && ((event->Duration() / 60 ) < 70) ) //Add Dir only for Series
newFileName = cString::sprintf("%s~%s", *newFileName, event->ShortText());
timer->SetFile(*newFileName);
}

View File

@ -593,18 +593,20 @@ cRecMenuItemSelectDirectory::cRecMenuItemSelectDirectory(cString text,
std::string originalFolder,
bool active,
char *callback,
eRecMenuState action) {
eRecMenuState action,
bool isSearchTimer) {
selectable = true;
this->text = text;
this->originalFolder = originalFolder;
seriesFolder = "";
this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2;
pixmapVal = NULL;
folders.push_back(tr("root video folder"));
ReadFolders(NULL, "");
if (isSearchTimer && tvguideConfig.instRecFixedFolder.size() > 0)
folders.push_back(tvguideConfig.instRecFixedFolder);
ReadRecordingDirectories(&folders, NULL, "");
numValues = folders.size();
this->currentVal = GetInitial();
}
@ -694,33 +696,9 @@ void cRecMenuItemSelectDirectory::SetCallback(void) {
std::string newFolder = folders[currentVal];
if (!newFolder.compare(tr("root video folder")))
newFolder = "";
if (seriesFolder.size() > 0) {
if (newFolder.size() > 0)
newFolder = *cString::sprintf("%s/%s", folders[currentVal].c_str(), seriesFolder.c_str());
else
newFolder = seriesFolder;
}
strncpy(callback, newFolder.c_str(), TEXTINPUTLENGTH);
}
void cRecMenuItemSelectDirectory::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);
}
}
}
int cRecMenuItemSelectDirectory::GetInitial(void) {
if (originalFolder.size() == 0)
return 0;
@ -729,18 +707,6 @@ int cRecMenuItemSelectDirectory::GetInitial(void) {
return i;
}
}
size_t found = originalFolder.find_last_of('/');
if (found != std::string::npos) {
std::string folderSet = originalFolder.substr(0, found);
seriesFolder = originalFolder.substr(found + 1);
for (int i=0; i < numValues; i++) {
if (!folders[i].compare(folderSet)) {
return i;
}
}
} else {
seriesFolder = originalFolder;
}
return 0;
}

View File

@ -272,14 +272,12 @@ class cRecMenuItemSelectDirectory : public cRecMenuItem {
private:
cString text;
std::string originalFolder;
std::string seriesFolder;
std::vector<std::string> folders;
int currentVal;
char *callback;
int numValues;
cPixmap *pixmapVal;
void DrawValue(void);
void ReadFolders(cList<cNestedItem> *rootFolders, cString path);
int GetInitial(void);
void SetCallback(void);
public:
@ -287,7 +285,8 @@ public:
std::string originalFolder,
bool active = false,
char *callback = NULL,
eRecMenuState action = rmsNotConsumed);
eRecMenuState action = rmsNotConsumed,
bool isSearchTimer = false);
virtual ~cRecMenuItemSelectDirectory(void);
void SetPixmaps(void);
void Hide(void);

View File

@ -5,11 +5,10 @@
// --- cRecMenuMain ---------------------------------------------------------
cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) {
eRecMenuState action;
eRecMenuState action = rmsInstantRecord;
if (!timerActive) {
action = (tvguideConfig.recMenuAskFolder)
?rmsInstantRecordFolder
:rmsInstantRecord;
if (tvguideConfig.instRecFolderMode == eFolderSelect)
action = rmsInstantRecordFolder;
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true, false, false, true));
} else {
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true, false, false, true));
@ -23,9 +22,10 @@ cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switc
AddMenuItem(new cRecMenuItemButton(tr("Manage Search Timers"), rmsSearchTimers, false, false, false, true));
}
action = (tvguideConfig.recMenuAskFolder)
?rmsSeriesTimerFolder
:rmsSeriesTimer;
if (tvguideConfig.instRecFolderMode == eFolderSelect)
action = rmsSeriesTimerFolder;
else
action = rmsSeriesTimer;
AddMenuItem(new cRecMenuItemButton(tr("Create Series Timer"), action, false, false, false, true));
if (epgSearchAvailable) {
@ -67,10 +67,10 @@ cRecMenuAskFolder::cRecMenuAskFolder(const cEvent *event, eRecMenuState nextActi
AddMenuItemInitial(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true));
readFolders(NULL, "");
ReadRecordingDirectories(&folders, NULL, "");
int numFolders = folders.size();
for (int i=0; i < numFolders; i++) {
if (!AddMenuItemInitial(new cRecMenuItemButton(*folders[i], nextAction, false, false, true)))
if (!AddMenuItemInitial(new cRecMenuItemButton(folders[i].c_str(), nextAction, false, false, true)))
break;
}
@ -79,30 +79,12 @@ cRecMenuAskFolder::cRecMenuAskFolder(const cEvent *event, eRecMenuState nextActi
Arrange();
}
void cRecMenuAskFolder::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);
}
}
}
cRecMenuItem *cRecMenuAskFolder::GetMenuItem(int number) {
if (number == 0) {
cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false, true);
return result;
} else if ((number > 0) && (number < folders.size()+1)) {
cRecMenuItem *result = new cRecMenuItemButton(*folders[number-1], rmsInstantRecord, false, false, true);
cRecMenuItem *result = new cRecMenuItemButton(folders[number-1].c_str(), rmsInstantRecord, false, false, true);
return result;
}
return NULL;
@ -116,7 +98,7 @@ std::string cRecMenuAskFolder::GetFolder(void) {
std::string folder = "";
int folderActive = GetActive();
if (folderActive > 0 && folderActive < folders.size() + 1)
folder = *folders[folderActive - 1];
folder = folders[folderActive - 1];
return folder;
}
@ -410,7 +392,7 @@ cRecMenuEditTimer::cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState) {
cString infoText = cString::sprintf("%s:\n %s, %s", tr("Edit Timer"), *title, *channelName);
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText, true);
infoItem->CalculateHeight(width - 2 * border);
AddMenuItem(infoItem);
AddMenuItemInitial(infoItem);
timerActive = false;
if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
@ -431,18 +413,22 @@ cRecMenuEditTimer::cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState) {
lifetime = timer->Lifetime();
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), timerActive, false, true, &timerActive));
AddMenuItem(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false, &prio));
AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false, &lifetime));
AddMenuItem(new cRecMenuItemDay(tr("Day"), day, false, &day));
AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), start, false, &start));
AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), stop, false, &stop));
AddMenuItem(new cRecMenuItemSelectDirectory(tr("Folder"), std::string(folder), false, folder));
AddMenuItemInitial(new cRecMenuItemBool(tr("Timer Active"), timerActive, false, true, &timerActive));
AddMenuItemInitial(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false, &prio));
AddMenuItemInitial(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false, &lifetime));
AddMenuItemInitial(new cRecMenuItemDay(tr("Day"), day, false, &day));
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer start time"), start, false, &start));
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer stop time"), stop, false, &stop));
cString fileInfo = cString::sprintf("%s:\n%s", tr("Timer File"), timer->File());
cRecMenuItemInfo *fileInfoItem = new cRecMenuItemInfo(*fileInfo, false);
fileInfoItem->CalculateHeight(width - 2 * border);
AddMenuItemInitial(fileInfoItem);
AddMenuItemInitial(new cRecMenuItemSelectDirectory(tr("New Folder"), std::string(folder), false, folder));
if (nextState == rmsTimelineTimerSave) {
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false, false));
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsTimeline, false));
AddMenuItemInitial(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false, false));
AddMenuItemInitial(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsTimeline, false));
} else {
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsClose, false));
AddMenuItemInitial(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsClose, false));
}
CalculateHeight();
CreatePixmap();
@ -466,14 +452,16 @@ cTimer cRecMenuEditTimer::GetTimer(void) {
t.SetLifetime(lifetime);
std::string newFolder(folder);
std::string newFile = originalTimer->File();
if (newFolder.size() > 0) {
size_t found = newFile.find_last_of('~');
if (found != std::string::npos) {
std::string fileName = newFile.substr(found+1);
newFile = *cString::sprintf("%s/%s", newFolder.c_str(), fileName.c_str());
if (newFolder.size() > 0)
newFile = *cString::sprintf("%s~%s", newFolder.c_str(), fileName.c_str());
else
newFile = fileName;
} else {
newFile = *cString::sprintf("%s/%s", newFolder.c_str(), newFile.c_str());
}
if (newFolder.size() > 0)
newFile = *cString::sprintf("%s~%s", newFolder.c_str(), newFile.c_str());
}
std::replace(newFile.begin(), newFile.end(), '/', '~');
t.SetFile(newFile.c_str());
@ -712,7 +700,6 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
lifetime = searchTimer.Lifetime();
useEpisode = searchTimer.UseEpisode();
std::string dir = searchTimer.Directory();
std::replace(dir.begin(), dir.end(), '~', '/');
strncpy(directory, dir.c_str(), TEXTINPUTLENGTH);
marginStart = searchTimer.MarginStart();
marginStop = searchTimer.MarginStop();
@ -790,7 +777,7 @@ void cRecMenuSearchTimerEdit::InitMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemInt(tr("Time margin for start in minutes"), marginStart, 0, 30, false, &marginStart, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(tr("Time margin for stop in minutes"), marginStop, 0, 30, false, &marginStop, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Series Recording"), useEpisode, false, false, &useEpisode, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelectDirectory(tr("Folder"), std::string(directory), false, directory, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelectDirectory(tr("Folder"), std::string(directory), false, directory, rmsSearchTimerSave, true));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use VPS"), useVPS, false, false, &useVPS, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Avoid Repeats"), avoidRepeats, true, false, &avoidRepeats, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use in Favorites"), useInFavorites, false, false, &useInFavorites, rmsSearchTimerSave));

View File

@ -25,9 +25,8 @@ public:
// --- cRecMenuAskFolder ---------------------------------------------------------
class cRecMenuAskFolder: public cRecMenu {
private:
std::vector<cString> folders;
std::vector<std::string> folders;
eRecMenuState NextAction;
void readFolders(cList<cNestedItem> *rootFolders, cString path);
public:
cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction);
cRecMenuItem *GetMenuItem(int number);

16
setup.c
View File

@ -102,6 +102,8 @@ void cTvguideSetup::Store(void) {
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeightPercent", tvguideConfig.footerHeightPercent);
SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder);
SetupStore("instRecFolderMode", tvguideConfig.instRecFolderMode);
SetupStore("instRecFixedFolder", tvguideConfig.instRecFixedFolder.c_str());
SetupStore("favWhatsOnNow", tvguideConfig.favWhatsOnNow);
SetupStore("favWhatsOnNext", tvguideConfig.favWhatsOnNext);
SetupStore("favUseTime1", tvguideConfig.favUseTime1);
@ -371,6 +373,10 @@ cMenuSetupFavorites::cMenuSetupFavorites(cTvguideConfig* data) : cMenuSetupSubM
strn0cpy(description2, data->descUser2.c_str(), sizeof(description2));
strn0cpy(description3, data->descUser3.c_str(), sizeof(description3));
strn0cpy(description4, data->descUser4.c_str(), sizeof(description4));
recFolderMode[0] = tr("Always use root video folder");
recFolderMode[1] = tr("Select from folder list");
recFolderMode[2] = tr("Use fixed folder");
strn0cpy(fixedFolder, data->instRecFixedFolder.c_str(), sizeof(fixedFolder));
Set();
}
@ -378,7 +384,10 @@ void cMenuSetupFavorites::Set(void) {
int currentItem = Current();
Clear();
Add(new cMenuEditBoolItem(tr("Use folders for instant records"), &tmpTvguideConfig->recMenuAskFolder));
Add(new cMenuEditStraItem(tr("Folder for instant Recordings"), &tmpTvguideConfig->instRecFolderMode, 3, recFolderMode));
if (tmpTvguideConfig->instRecFolderMode == eFolderFixed) {
Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Folder")), fixedFolder, sizeof(fixedFolder), trVDR(FileNameChars)));
}
if (pRemoteTimers)
Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers));
@ -421,18 +430,21 @@ eOSState cMenuSetupFavorites::ProcessKey(eKeys Key) {
int tmpFavUseTime3 = tmpTvguideConfig->favUseTime3;
int tmpFavUseTime4 = tmpTvguideConfig->favUseTime4;
int tmpFavLimitChannels = tmpTvguideConfig->favLimitChannels;
int tmpFolderMode = tmpTvguideConfig->instRecFolderMode;
eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) {
tmpTvguideConfig->descUser1 = description1;
tmpTvguideConfig->descUser2 = description2;
tmpTvguideConfig->descUser3 = description3;
tmpTvguideConfig->descUser4 = description4;
tmpTvguideConfig->instRecFixedFolder = fixedFolder;
} else if ((Key == kLeft)||(Key == kRight)) {
if ((tmpFavUseTime1 != tmpTvguideConfig->favUseTime1) ||
(tmpFavUseTime2 != tmpTvguideConfig->favUseTime2) ||
(tmpFavUseTime3 != tmpTvguideConfig->favUseTime3) ||
(tmpFavUseTime4 != tmpTvguideConfig->favUseTime4) ||
(tmpFavLimitChannels != tmpTvguideConfig->favLimitChannels) )
(tmpFavLimitChannels != tmpTvguideConfig->favLimitChannels) ||
(tmpFolderMode != tmpTvguideConfig->instRecFolderMode) )
Set();
}
return state;

View File

@ -67,6 +67,8 @@ class cMenuSetupFavorites : public cMenuSetupSubMenu {
char description2[256];
char description3[256];
char description4[256];
const char * recFolderMode[3];
char fixedFolder[256];
void Set(void);
virtual eOSState ProcessKey(eKeys Key);
public:

41
tools.c
View File

@ -7,6 +7,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <vdr/osd.h>
#include <vdr/plugin.h>
#include "services/epgsearch.h"
#include "tools.h"
@ -61,11 +63,48 @@ std::string GetDirectoryFromTimer(std::string file) {
size_t found = file.find_last_of('~');
if (found != std::string::npos) {
dir = file.substr(0, found);
std::replace(dir.begin(), dir.end(), '~', '/');
}
return dir;
}
/****************************************************************************************
* GetDirectoryFromTimer
****************************************************************************************/
void ReadRecordingDirectories(std::vector<std::string> *folders, cList<cNestedItem> *rootFolders, cString path) {
cPlugin *epgSearchPlugin = NULL;
epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
if (epgSearchPlugin) {
Epgsearch_services_v1_0 *epgSearch = new Epgsearch_services_v1_0;
if (epgSearchPlugin->Service("Epgsearch-services-v1.0", epgSearch)) {
std::set<std::string> epgSearchDirs = epgSearch->handler->DirectoryList();
std::set<std::string>::iterator it;
for (it = epgSearchDirs.begin(); it != epgSearchDirs.end(); it++) {
std::string newFolder = *it;
std::replace(newFolder.begin(), newFolder.end(), '/', '~');
folders->push_back(newFolder);
}
}
} else {
cList<cNestedItem> *foldersLevel = NULL;
if (rootFolders) {
foldersLevel = rootFolders;
} else {
foldersLevel = &Folders;
}
for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) {
std::string strFolder = *cString::sprintf("%s%s", *path, folder->Text());
std::replace(strFolder.begin(), strFolder.end(), '/', '~');
folders->push_back(strFolder);
cList<cNestedItem> *subItems = folder->SubItems();
if (subItems) {
std::string strFolder2 = *cString::sprintf("%s%s", *path, folder->Text());
std::replace(strFolder2.begin(), strFolder2.end(), '/', '~');
ReadRecordingDirectories(folders, subItems, strFolder2.c_str());
}
}
}
}
/****************************************************************************************
* DrawRoundedCorners

View File

@ -9,6 +9,7 @@
std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str);
std::string GetDirectoryFromTimer(std::string file);
void ReadRecordingDirectories(std::vector<std::string> *folders, cList<cNestedItem> *rootFolders, cString path);
void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor);
class splitstring : public std::string {