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 - set blue key favorite mode as new default
Version 1.2.0 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; epgImageWidthLarge = 525;
epgImageHeightLarge = 400; epgImageHeightLarge = 400;
recMenuAskFolder = 0; recMenuAskFolder = 0;
instRecFolderMode = eFolderRoot;
instRecFixedFolder = "";
favWhatsOnNow = 1; favWhatsOnNow = 1;
favWhatsOnNext = 1; favWhatsOnNext = 1;
favUseTime1 = 0; 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, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value); else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value);
else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = 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, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value);
else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value); else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value);
else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value); else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value);

View File

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

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

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: 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" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -231,8 +231,11 @@ msgstr "Timer Start Zeit"
msgid "Timer stop time" msgid "Timer stop time"
msgstr "Timer Stop Zeit" msgstr "Timer Stop Zeit"
msgid "Folder" msgid "Timer File"
msgstr "Verzeichnis" msgstr "Timer Datei"
msgid "New Folder"
msgstr "Neues Verzeichnis"
msgid "Save" msgid "Save"
msgstr "Speichern" msgstr "Speichern"
@ -336,6 +339,9 @@ msgstr "Zeit nach Ende in Minuten"
msgid "Series Recording" msgid "Series Recording"
msgstr "Serienaufnahme" msgstr "Serienaufnahme"
msgid "Folder"
msgstr "Verzeichnis"
msgid "Use VPS" msgid "Use VPS"
msgstr "VPS benutzen" msgstr "VPS benutzen"
@ -756,8 +762,17 @@ msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße"
msgid "Search & Recording Menu Header Font Size" msgid "Search & Recording Menu Header Font Size"
msgstr "Suchen & Aufnehmen Menu Header Schriftgröße" msgstr "Suchen & Aufnehmen Menu Header Schriftgröße"
msgid "Use folders for instant records" msgid "Always use root video folder"
msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen" 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" msgid "Use Remotetimers"
msgstr "RemoteTimers benutzen" msgstr "RemoteTimers benutzen"

View File

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

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n" "Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -231,7 +231,10 @@ msgstr "Pl
msgid "Timer stop time" msgid "Timer stop time"
msgstr "Plán konèí" msgstr "Plán konèí"
msgid "Folder" msgid "Timer File"
msgstr ""
msgid "New Folder"
msgstr "" msgstr ""
msgid "Save" msgid "Save"
@ -336,6 +339,9 @@ msgstr ""
msgid "Series Recording" msgid "Series Recording"
msgstr "" msgstr ""
msgid "Folder"
msgstr ""
msgid "Use VPS" msgid "Use VPS"
msgstr "" msgstr ""
@ -756,8 +762,17 @@ msgstr "H
msgid "Search & Recording Menu Header Font Size" msgid "Search & Recording Menu Header Font Size"
msgstr "" msgstr ""
msgid "Use folders for instant records" msgid "Always use root video folder"
msgstr "Pou¾i» adresáre pre okam¾ité nahrávky" msgstr ""
msgid "Select from folder list"
msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Use Remotetimers" msgid "Use Remotetimers"
msgstr "Pou¾i» vzdialený plánovaè" msgstr "Pou¾i» vzdialený plánovaè"
@ -819,6 +834,9 @@ msgstr ""
msgid "Recording Menus Icon Cache" msgid "Recording Menus Icon Cache"
msgstr "" 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)" #~ msgid "Height of status header (Perc. of osd height)"
#~ msgstr "Vý¹ka stavovej hlavièky (% z OSD vý¹ky)" #~ 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) { 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; cString newFileName;
if (path.size() > 0) { if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~'); std::replace(path.begin(), path.end(), '/', '~');
@ -121,10 +143,6 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
} else { } else {
newFileName = event->Title(); 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); timer->SetFile(*newFileName);
} }

View File

@ -593,18 +593,20 @@ cRecMenuItemSelectDirectory::cRecMenuItemSelectDirectory(cString text,
std::string originalFolder, std::string originalFolder,
bool active, bool active,
char *callback, char *callback,
eRecMenuState action) { eRecMenuState action,
bool isSearchTimer) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->originalFolder = originalFolder; this->originalFolder = originalFolder;
seriesFolder = "";
this->active = active; this->active = active;
this->callback = callback; this->callback = callback;
this->action = action; this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
folders.push_back(tr("root video folder")); 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(); numValues = folders.size();
this->currentVal = GetInitial(); this->currentVal = GetInitial();
} }
@ -694,33 +696,9 @@ void cRecMenuItemSelectDirectory::SetCallback(void) {
std::string newFolder = folders[currentVal]; std::string newFolder = folders[currentVal];
if (!newFolder.compare(tr("root video folder"))) if (!newFolder.compare(tr("root video folder")))
newFolder = ""; 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); 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) { int cRecMenuItemSelectDirectory::GetInitial(void) {
if (originalFolder.size() == 0) if (originalFolder.size() == 0)
return 0; return 0;
@ -729,18 +707,6 @@ int cRecMenuItemSelectDirectory::GetInitial(void) {
return i; 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; return 0;
} }

View File

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

View File

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

View File

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

16
setup.c
View File

@ -102,6 +102,8 @@ void cTvguideSetup::Store(void) {
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent); SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeightPercent", tvguideConfig.footerHeightPercent); SetupStore("footerHeightPercent", tvguideConfig.footerHeightPercent);
SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder); SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder);
SetupStore("instRecFolderMode", tvguideConfig.instRecFolderMode);
SetupStore("instRecFixedFolder", tvguideConfig.instRecFixedFolder.c_str());
SetupStore("favWhatsOnNow", tvguideConfig.favWhatsOnNow); SetupStore("favWhatsOnNow", tvguideConfig.favWhatsOnNow);
SetupStore("favWhatsOnNext", tvguideConfig.favWhatsOnNext); SetupStore("favWhatsOnNext", tvguideConfig.favWhatsOnNext);
SetupStore("favUseTime1", tvguideConfig.favUseTime1); SetupStore("favUseTime1", tvguideConfig.favUseTime1);
@ -371,6 +373,10 @@ cMenuSetupFavorites::cMenuSetupFavorites(cTvguideConfig* data) : cMenuSetupSubM
strn0cpy(description2, data->descUser2.c_str(), sizeof(description2)); strn0cpy(description2, data->descUser2.c_str(), sizeof(description2));
strn0cpy(description3, data->descUser3.c_str(), sizeof(description3)); strn0cpy(description3, data->descUser3.c_str(), sizeof(description3));
strn0cpy(description4, data->descUser4.c_str(), sizeof(description4)); 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(); Set();
} }
@ -378,7 +384,10 @@ void cMenuSetupFavorites::Set(void) {
int currentItem = Current(); int currentItem = Current();
Clear(); 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) if (pRemoteTimers)
Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers)); Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers));
@ -421,18 +430,21 @@ eOSState cMenuSetupFavorites::ProcessKey(eKeys Key) {
int tmpFavUseTime3 = tmpTvguideConfig->favUseTime3; int tmpFavUseTime3 = tmpTvguideConfig->favUseTime3;
int tmpFavUseTime4 = tmpTvguideConfig->favUseTime4; int tmpFavUseTime4 = tmpTvguideConfig->favUseTime4;
int tmpFavLimitChannels = tmpTvguideConfig->favLimitChannels; int tmpFavLimitChannels = tmpTvguideConfig->favLimitChannels;
int tmpFolderMode = tmpTvguideConfig->instRecFolderMode;
eOSState state = cOsdMenu::ProcessKey(Key); eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) { if (Key == kOk) {
tmpTvguideConfig->descUser1 = description1; tmpTvguideConfig->descUser1 = description1;
tmpTvguideConfig->descUser2 = description2; tmpTvguideConfig->descUser2 = description2;
tmpTvguideConfig->descUser3 = description3; tmpTvguideConfig->descUser3 = description3;
tmpTvguideConfig->descUser4 = description4; tmpTvguideConfig->descUser4 = description4;
tmpTvguideConfig->instRecFixedFolder = fixedFolder;
} else if ((Key == kLeft)||(Key == kRight)) { } else if ((Key == kLeft)||(Key == kRight)) {
if ((tmpFavUseTime1 != tmpTvguideConfig->favUseTime1) || if ((tmpFavUseTime1 != tmpTvguideConfig->favUseTime1) ||
(tmpFavUseTime2 != tmpTvguideConfig->favUseTime2) || (tmpFavUseTime2 != tmpTvguideConfig->favUseTime2) ||
(tmpFavUseTime3 != tmpTvguideConfig->favUseTime3) || (tmpFavUseTime3 != tmpTvguideConfig->favUseTime3) ||
(tmpFavUseTime4 != tmpTvguideConfig->favUseTime4) || (tmpFavUseTime4 != tmpTvguideConfig->favUseTime4) ||
(tmpFavLimitChannels != tmpTvguideConfig->favLimitChannels) ) (tmpFavLimitChannels != tmpTvguideConfig->favLimitChannels) ||
(tmpFolderMode != tmpTvguideConfig->instRecFolderMode) )
Set(); Set();
} }
return state; return state;

View File

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

41
tools.c
View File

@ -7,6 +7,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <vdr/osd.h> #include <vdr/osd.h>
#include <vdr/plugin.h>
#include "services/epgsearch.h"
#include "tools.h" #include "tools.h"
@ -61,11 +63,48 @@ std::string GetDirectoryFromTimer(std::string file) {
size_t found = file.find_last_of('~'); size_t found = file.find_last_of('~');
if (found != std::string::npos) { if (found != std::string::npos) {
dir = file.substr(0, found); dir = file.substr(0, found);
std::replace(dir.begin(), dir.end(), '~', '/');
} }
return dir; 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 * DrawRoundedCorners

View File

@ -9,6 +9,7 @@
std::string CutText(std::string text, int width, const cFont *font); std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str); std::string StrToLowerCase(std::string str);
std::string GetDirectoryFromTimer(std::string file); 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); void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor);
class splitstring : public std::string { class splitstring : public std::string {