From 8e429f9e6a31f93eb5557acf9d958b9a0c454a71 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 2 Jun 2016 21:37:33 +0200 Subject: [PATCH] record_setup: add check existing recordings before set new timers Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6dddaff0d2b4338964ccd291a67afbff98675a97 Author: vanhofen Date: 2016-06-02 (Thu, 02 Jun 2016) Origin message was: ------------------ - record_setup: add check existing recordings before set new timers ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 4 ++++ data/locale/english.locale | 4 ++++ src/gui/epgplus.cpp | 35 +++++++++++++++++++++++++++++------ src/gui/epgview.cpp | 17 +++++++++++++++++ src/gui/eventlist.cpp | 20 +++++++++++++++++++- src/gui/moviebrowser.cpp | 20 ++++++++++++++++++++ src/gui/moviebrowser.h | 1 + src/gui/record_setup.cpp | 5 +++++ src/neutrino.cpp | 2 ++ src/system/locals.h | 4 ++++ src/system/locals_intern.h | 4 ++++ src/system/settings.h | 1 + 12 files changed, 110 insertions(+), 7 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 42fb6169a..cae2476ef 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1257,6 +1257,7 @@ menu.hint_progressbar_timescale_yellow Hier können Sie den gelben Farbanteil bu menu.hint_protection Schützen Sie Inhalte per PIN-Code\nStandard-PIN ist 0000 menu.hint_radiomode Schaltet zum Radio-Modus menu.hint_reboot Startet die Box neu\nDer Neustart erfolgt ohne Bestätigung! +menu.hint_record_already_found_check Prüft vor dem Setzen eines neues Aufnahmetimers, ob ein gleichnamiger Titel bereits vorhanden ist menu.hint_record_apid_ac3 Schließt bei einer Aufnahme die durch den Sender definierte Tonspur 'Dolby Digital' in die Aufnahme ein, sofern diese vorhanden ist menu.hint_record_apid_alt Sind weitere Tonspuren verfügbar, dann können diese hiermit bei einer Aufnahme entsprechend ein- bzw. ausgeschlossen werden menu.hint_record_apid_std Schließt bei einer Aufnahme die durch den Sender definierte Tonspur 'Standard' in die Aufnahme ein bzw. aus @@ -2027,6 +2028,8 @@ rclock.locked Gesperrt rclock.lockmsg Die Fernbedienung wird gesperrt.\nUm die Sperre aufzuheben, bitte\n[rot] gefolgt von [%s]\nauf der Fernbedienung drücken. rclock.title Fernbedienung sperren rclock.unlockmsg Fernbedienung reaktiviert +recording.already_found %s\nwurde bereits gefunden. Trotzdem aufnehmen? +recording.already_found_check Prüfe Aufnahmen recording.is_running Folgende Aufnahme läuft bereits! Neue Aufnahme starten? recording.start Starte Aufnahme, bitte warten...! recording.startstop_msg Meldung bei Aufnahme Start/Ende @@ -2034,6 +2037,7 @@ recording.stop Beende Aufnahme, bitte warten...! recording.time_hour Stunde recording.time_hours Stunden recording.time_min Min +recordingmenu.already_found_check Prüfe, ob Titel bereits vorhanden recordingmenu.apids Tonspuren recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen recordingmenu.apids_alt Alternative Tonspuren aufn. diff --git a/data/locale/english.locale b/data/locale/english.locale index 77a3b7a87..c675c25b5 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1257,6 +1257,7 @@ menu.hint_progressbar_timescale_yellow Choose the yellow portion of colored prog menu.hint_protection Protect content by PIN code\nDefault PIN 0000 menu.hint_radiomode Switch box to radio mode menu.hint_reboot Reboot box\nNo confirmation +menu.hint_record_already_found_check Checks before setting a new record timer if an eponymous title already exists menu.hint_record_apid_ac3 Record AC3 audio pids menu.hint_record_apid_alt Record alternative non-AC3 audio pids menu.hint_record_apid_std Record first audio pid @@ -2027,6 +2028,8 @@ rclock.locked Locked rclock.lockmsg Remote control will be locked.\nTo unlock, press\n[red] followed by [%s]\non your remote control. rclock.title Lock remote control rclock.unlockmsg Remote control unlocked +recording.already_found %s\nwas already found. Nevertheless start record? +recording.already_found_check Check recordings recording.is_running This channel already recording. Start new record? recording.start Start recording, please wait...! recording.startstop_msg Message when recording is start/stop @@ -2034,6 +2037,7 @@ recording.stop Stop recording, please wait...! recording.time_hour hour recording.time_hours hours recording.time_min min +recordingmenu.already_found_check Check, if title is already present recordingmenu.apids Audio streams recordingmenu.apids_ac3 record AC3 streams recordingmenu.apids_alt record alternative streams diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 0114f9096..c48af512c 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -34,12 +34,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include "bouquetlist.h" @@ -1308,12 +1310,33 @@ int EpgPlus::MenuTargetAddRecordTimer::exec (CMenuTarget * /*parent*/, const std if ((It != this->epgPlus->selectedChannelEntry->channelEventEntries.end()) && (!(*It)->channelEvent.description.empty()) ) { - if (g_Timerd->isTimerdAvailable()) { - - g_Timerd->addRecordTimerEvent (this->epgPlus->selectedChannelEntry->channel->getChannelID(), (*It)->channelEvent.startTime, (*It)->channelEvent.startTime + (*It)->channelEvent.duration, (*It)->channelEvent.eventID, (*It)->channelEvent.startTime, (*It)->channelEvent.startTime - (ANNOUNCETIME + 120) - , TIMERD_APIDS_CONF, true); - ShowMsg (LOCALE_TIMER_EVENTRECORD_TITLE, g_Locale->getText (LOCALE_TIMER_EVENTRECORD_MSG) - , CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8 + bool doRecord = true; + if (g_settings.recording_already_found_check) + { + CHintBox loadBox(LOCALE_RECORDING_ALREADY_FOUND_CHECK, LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES); + loadBox.paint(); + CMovieBrowser moviebrowser; + const char *rec_title = (*It)->channelEvent.description.c_str(); + bool already_found = moviebrowser.gotMovie(rec_title); + loadBox.hide(); + if (already_found) + { + printf("already found in moviebrowser: %s\n", rec_title); + char message[1024]; + snprintf(message, sizeof(message)-1, g_Locale->getText(LOCALE_RECORDING_ALREADY_FOUND), rec_title); + doRecord = (ShowMsg(LOCALE_RECORDING_ALREADY_FOUND_CHECK, message, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes); + } + } + if (g_Timerd->isTimerdAvailable() && doRecord) + { + g_Timerd->addRecordTimerEvent (this->epgPlus->selectedChannelEntry->channel->getChannelID(), + (*It)->channelEvent.startTime, + (*It)->channelEvent.startTime + (*It)->channelEvent.duration, + (*It)->channelEvent.eventID, + (*It)->channelEvent.startTime, + (*It)->channelEvent.startTime - (ANNOUNCETIME + 120), + TIMERD_APIDS_CONF, true); + ShowMsg (LOCALE_TIMER_EVENTRECORD_TITLE, g_Locale->getText (LOCALE_TIMER_EVENTRECORD_MSG), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); } else printf ("timerd not available\n"); } diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index e3e35faf8..5d687ed04 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -898,6 +899,22 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (lid != -1) recDir = g_settings.network_nfs[lid].local_dir; } + if (doRecord && g_settings.recording_already_found_check) + { + CHintBox loadBox(LOCALE_RECORDING_ALREADY_FOUND_CHECK, LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES); + loadBox.paint(); + CMovieBrowser moviebrowser; + const char *rec_title = epgData.title.c_str(); + bool already_found = moviebrowser.gotMovie(rec_title); + loadBox.hide(); + if (already_found) + { + printf("already found in moviebrowser: %s\n", rec_title); + char message[1024]; + snprintf(message, sizeof(message)-1, g_Locale->getText(LOCALE_RECORDING_ALREADY_FOUND), rec_title); + doRecord = (ShowMsg(LOCALE_RECORDING_ALREADY_FOUND_CHECK, message, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes); + } + } if (doRecord) { if (g_Timerd->addRecordTimerEvent(channel_id, diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 7956d7870..90acdf162 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -466,8 +467,25 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna else recDir = ""; } + bool doRecord = true; + if (g_settings.recording_already_found_check) + { + CHintBox loadBox(LOCALE_RECORDING_ALREADY_FOUND_CHECK, LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES); + loadBox.paint(); + CMovieBrowser moviebrowser; + const char *rec_title = evtlist[selected].description.c_str(); + bool already_found = moviebrowser.gotMovie(rec_title); + loadBox.hide(); + if (already_found) + { + printf("already found in moviebrowser: %s\n", rec_title); + char message[1024]; + snprintf(message, sizeof(message)-1, g_Locale->getText(LOCALE_RECORDING_ALREADY_FOUND), rec_title); + doRecord = (ShowMsg(LOCALE_RECORDING_ALREADY_FOUND_CHECK, message, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes); + } + } t_channel_id used_id = IS_WEBTV(channel_id) ? channel_id : evtlist[selected].channelID; - if (!recDir.empty()) //add/remove recording timer events and check/warn for conflicts + if (!recDir.empty() && doRecord) //add/remove recording timer events and check/warn for conflicts { if (g_Timerd->addRecordTimerEvent(used_id, evtlist[selected].startTime, diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index ae4c5b550..7ca2f5d0a 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2609,6 +2609,26 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) TRACE("[mb] Dir%d, Files:%d\n", (int)m_dirNames.size(), (int)m_vMovieInfo.size()); } +bool CMovieBrowser::gotMovie(const char *rec_title) +{ + //TRACE("[mb]->gotMovie\n"); + + m_doRefresh = false; + loadAllTsFileNamesFromStorage(); + + bool found = false; + for (unsigned int i = 0; i < m_vMovieInfo.size(); i++) + { + //printf("[mb] search for %s in %s\n", rec_title, m_vMovieInfo[i].epgTitle.c_str()); + if (strcmp(rec_title, m_vMovieInfo[i].epgTitle.c_str()) == 0) + { + found = true; + break; + } + } + return found; +} + static const char * const ext_list[] = { "avi", "mkv", "mp4", "flv", "mov", "mpg", "mpeg", "m2ts", "iso" diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index cf0bf36a0..2f662334f 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -387,6 +387,7 @@ class CMovieBrowser : public CMenuTarget m_file_info_stale = true; show_mode = mode; } + bool gotMovie(const char *rec_title); private: //Functions ///// MovieBrowser init /////////////// diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 3388937b3..70e1d3f8b 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -234,6 +234,11 @@ int CRecordSetup::showRecordSetup() end_of_recording->setHint("", LOCALE_MENU_HINT_RECORD_END); recordingSettings->addItem(end_of_recording); + // already_found + CMenuOptionChooser* already_found = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ALREADY_FOUND_CHECK, &g_settings.recording_already_found_check, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + already_found->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_RECORD_ALREADY_FOUND_CHECK); + recordingSettings->addItem(already_found); + if (!g_settings.easymenu) { CMenuOptionChooser* slow_warn = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SLOW_WARN, &g_settings.recording_slow_warning, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); slow_warn->setHint("", LOCALE_MENU_HINT_RECORD_SLOW_WARN); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d0377ab1f..0d0268c3d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -641,6 +641,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_save_in_channeldir = configfile.getBool("recording_save_in_channeldir" , false); g_settings.recording_slow_warning = configfile.getBool("recording_slow_warning" , true); g_settings.recording_startstop_msg = configfile.getBool("recording_startstop_msg" , true); + g_settings.recording_already_found_check = configfile.getBool("recording_already_found_check", false); // default plugin for movieplayer g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "---" ); @@ -1172,6 +1173,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ("recording_save_in_channeldir" , g_settings.recording_save_in_channeldir ); configfile.setBool ("recording_slow_warning" , g_settings.recording_slow_warning ); configfile.setBool ("recording_startstop_msg" , g_settings.recording_startstop_msg ); + configfile.setBool ("recording_already_found_check" , g_settings.recording_already_found_check ); // default plugin for movieplayer configfile.setString ( "movieplayer_plugin", g_settings.movieplayer_plugin ); diff --git a/src/system/locals.h b/src/system/locals.h index cac322dd7..218e1ac98 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1284,6 +1284,7 @@ typedef enum LOCALE_MENU_HINT_PROTECTION, LOCALE_MENU_HINT_RADIOMODE, LOCALE_MENU_HINT_REBOOT, + LOCALE_MENU_HINT_RECORD_ALREADY_FOUND_CHECK, LOCALE_MENU_HINT_RECORD_APID_AC3, LOCALE_MENU_HINT_RECORD_APID_ALT, LOCALE_MENU_HINT_RECORD_APID_STD, @@ -2054,6 +2055,8 @@ typedef enum LOCALE_RCLOCK_LOCKMSG, LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, + LOCALE_RECORDING_ALREADY_FOUND, + LOCALE_RECORDING_ALREADY_FOUND_CHECK, LOCALE_RECORDING_IS_RUNNING, LOCALE_RECORDING_START, LOCALE_RECORDING_STARTSTOP_MSG, @@ -2061,6 +2064,7 @@ typedef enum LOCALE_RECORDING_TIME_HOUR, LOCALE_RECORDING_TIME_HOURS, LOCALE_RECORDING_TIME_MIN, + LOCALE_RECORDINGMENU_ALREADY_FOUND_CHECK, LOCALE_RECORDINGMENU_APIDS, LOCALE_RECORDINGMENU_APIDS_AC3, LOCALE_RECORDINGMENU_APIDS_ALT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 105344a05..d68ecba46 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1284,6 +1284,7 @@ const char * locale_real_names[] = "menu.hint_protection", "menu.hint_radiomode", "menu.hint_reboot", + "menu.hint_record_already_found_check", "menu.hint_record_apid_ac3", "menu.hint_record_apid_alt", "menu.hint_record_apid_std", @@ -2054,6 +2055,8 @@ const char * locale_real_names[] = "rclock.lockmsg", "rclock.title", "rclock.unlockmsg", + "recording.already_found", + "recording.already_found_check", "recording.is_running", "recording.start", "recording.startstop_msg", @@ -2061,6 +2064,7 @@ const char * locale_real_names[] = "recording.time_hour", "recording.time_hours", "recording.time_min", + "recordingmenu.already_found_check", "recordingmenu.apids", "recordingmenu.apids_ac3", "recordingmenu.apids_alt", diff --git a/src/system/settings.h b/src/system/settings.h index f31688213..c3e7e2f98 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -441,6 +441,7 @@ struct SNeutrinoSettings int recording_startstop_msg; int shutdown_timer_record_type; std::string recording_filename_template; + int recording_already_found_check; int filesystem_is_utf8; // default plugin for ts-movieplayer (red button)