mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CRecordInstance::GetRecordString(): Fix calculation of duration
- Use locales for time string - Show recording duration right aligned in stop menu
This commit is contained in:
@@ -1578,6 +1578,9 @@ rclock.unlockmsg Fernbedienung reaktiviert...
|
||||
recording.is_running Folgende Aufnahme läuft bereits! Neue Aufnahme starten?
|
||||
recording.start Starte Aufnahme, bitte warten...!
|
||||
recording.stop Beende Aufnahme, bitte warten...!
|
||||
recording.time_hour Stunde
|
||||
recording.time_hours Stunden
|
||||
recording.time_min Min
|
||||
recordingmenu.apids Tonspuren
|
||||
recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen
|
||||
recordingmenu.apids_alt Alternative Tonspuren aufn.
|
||||
|
@@ -1578,6 +1578,9 @@ rclock.unlockmsg Remote control reactivated.
|
||||
recording.is_running This channel already recording. Start new record?
|
||||
recording.start Start recording, please wait...!
|
||||
recording.stop Stop recording, please wait...!
|
||||
recording.time_hour hour
|
||||
recording.time_hours hours
|
||||
recording.time_min min
|
||||
recordingmenu.apids Audio streams
|
||||
recordingmenu.apids_ac3 record AC3 streams
|
||||
recordingmenu.apids_alt record alternative streams
|
||||
|
@@ -665,7 +665,7 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel)
|
||||
return RECORD_OK;
|
||||
}
|
||||
|
||||
void CRecordInstance::GetRecordString(std::string &str)
|
||||
void CRecordInstance::GetRecordString(std::string &str, std::string &dur)
|
||||
{
|
||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
|
||||
if(channel == NULL) {
|
||||
@@ -676,12 +676,14 @@ void CRecordInstance::GetRecordString(std::string &str)
|
||||
char stime[15];
|
||||
int err = GetStatus();
|
||||
strftime(stime, sizeof(stime), "%H:%M:%S ", localtime(&start_time));
|
||||
time_t duration = time(0) - start_time;
|
||||
time_t duration = (time(0) - start_time) / 60;
|
||||
char dtime[20];
|
||||
int h = duration/3600;
|
||||
int m = duration/60;
|
||||
snprintf(dtime, sizeof(dtime), " (%02d %s %02d min)", h, h == 1 ? "hour" : "hours", m);
|
||||
str = stime + channel->getName() + ": " + GetEpgTitle() + ((err & REC_STATUS_OVERFLOW) ? " [!]" : "") + dtime;
|
||||
int h = duration / 60;
|
||||
int m = duration - (h * 60);
|
||||
snprintf(dtime, sizeof(dtime), "(%d %s %02d %s)", h, h == 1 ? g_Locale->getText(LOCALE_RECORDING_TIME_HOUR) : g_Locale->getText(LOCALE_RECORDING_TIME_HOURS),
|
||||
m, g_Locale->getText(LOCALE_RECORDING_TIME_MIN));
|
||||
str = stime + channel->getName() + ": " + GetEpgTitle() + ((err & REC_STATUS_OVERFLOW) ? " [!] " : " ");
|
||||
dur = dtime;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -1372,8 +1374,9 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
||||
bool tostart = true;
|
||||
CRecordInstance * inst = FindInstance(live_channel_id);
|
||||
if (inst) {
|
||||
std::string title;
|
||||
inst->GetRecordString(title);
|
||||
std::string title, duration;
|
||||
inst->GetRecordString(title, duration);
|
||||
title += duration;
|
||||
tostart = (ShowMsgUTF(LOCALE_RECORDING_IS_RUNNING, title.c_str(),
|
||||
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes);
|
||||
}
|
||||
@@ -1449,8 +1452,8 @@ bool CRecordManager::ShowMenu(void)
|
||||
channel_ids[i] = inst->GetChannelId();
|
||||
recording_ids[i] = inst->GetRecordingId();
|
||||
|
||||
std::string title;
|
||||
inst->GetRecordString(title);
|
||||
std::string title, duration;
|
||||
inst->GetRecordString(title, duration);
|
||||
|
||||
const char* mode_icon = NULL;
|
||||
//if (inst->tshift_mode)
|
||||
@@ -1465,7 +1468,7 @@ bool CRecordManager::ShowMenu(void)
|
||||
rc_key = CRCInput::RC_stop;
|
||||
btn_icon = NEUTRINO_ICON_BUTTON_STOP;
|
||||
}
|
||||
item = new CMenuForwarderNonLocalized(title.c_str(), true, NULL, selector, cnt, rc_key, NULL, mode_icon);
|
||||
item = new CMenuForwarderNonLocalized(title.c_str(), true, duration, selector, cnt, rc_key, NULL, mode_icon);
|
||||
item->setItemButton(btn_icon, true);
|
||||
|
||||
//if only one recording is running, set the focus to this menu item
|
||||
@@ -1508,7 +1511,7 @@ bool CRecordManager::ShowMenu(void)
|
||||
bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||
{
|
||||
//int recording_id = 0;
|
||||
std::string title;
|
||||
std::string title, duration;
|
||||
CRecordInstance * inst;
|
||||
|
||||
mutex.lock();
|
||||
@@ -1519,7 +1522,8 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||
|
||||
if(inst) {
|
||||
//recording_id = inst->GetRecordingId();
|
||||
inst->GetRecordString(title);
|
||||
inst->GetRecordString(title, duration);
|
||||
title += duration;
|
||||
}
|
||||
mutex.unlock();
|
||||
if(inst == NULL)
|
||||
|
@@ -120,7 +120,7 @@ class CRecordInstance
|
||||
t_channel_id GetChannelId(void) { return channel_id; };
|
||||
std::string GetEpgTitle(void) { return epgTitle; };
|
||||
MI_MOVIE_INFO * GetMovieInfo(void) { return recMovieInfo; };
|
||||
void GetRecordString(std::string& str);
|
||||
void GetRecordString(std::string& str, std::string &dur);
|
||||
const char * GetFileName() { return filename; };
|
||||
bool Timeshift() { return autoshift; };
|
||||
int tshift_mode;
|
||||
|
@@ -1605,6 +1605,9 @@ typedef enum
|
||||
LOCALE_RECORDING_IS_RUNNING,
|
||||
LOCALE_RECORDING_START,
|
||||
LOCALE_RECORDING_STOP,
|
||||
LOCALE_RECORDING_TIME_HOUR,
|
||||
LOCALE_RECORDING_TIME_HOURS,
|
||||
LOCALE_RECORDING_TIME_MIN,
|
||||
LOCALE_RECORDINGMENU_APIDS,
|
||||
LOCALE_RECORDINGMENU_APIDS_AC3,
|
||||
LOCALE_RECORDINGMENU_APIDS_ALT,
|
||||
|
@@ -1605,6 +1605,9 @@ const char * locale_real_names[] =
|
||||
"recording.is_running",
|
||||
"recording.start",
|
||||
"recording.stop",
|
||||
"recording.time_hour",
|
||||
"recording.time_hours",
|
||||
"recording.time_min",
|
||||
"recordingmenu.apids",
|
||||
"recordingmenu.apids_ac3",
|
||||
"recordingmenu.apids_alt",
|
||||
|
Reference in New Issue
Block a user