mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
Merge remote-tracking branch 'check/next-cc'
build-tested only, needs fixing Conflicts: data/locale/deutsch.locale data/locale/english.locale src/Makefile.am src/driver/rcinput.cpp src/driver/streamts.cpp src/eitd/sectionsd.cpp src/gui/Makefile.am src/gui/bouquetlist.cpp src/gui/hdd_menu.cpp src/gui/luainstance.cpp src/gui/luainstance.h src/gui/moviebrowser.cpp src/gui/movieplayer.cpp src/gui/pluginlist.cpp src/gui/plugins.cpp src/gui/plugins.h src/gui/scan.cpp src/gui/scan_setup.cpp src/gui/user_menue.cpp src/gui/videosettings.cpp src/gui/widget/menue.cpp src/neutrino.cpp src/neutrinoMessages.h src/system/locals.h src/system/locals_intern.h src/zapit/include/zapit/scan.h src/zapit/src/femanager.cpp src/zapit/src/frontend.cpp src/zapit/src/getservices.cpp src/zapit/src/transponder.cpp
This commit is contained in:
@@ -97,7 +97,6 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo,
|
||||
cMovieInfo = new CMovieInfo();
|
||||
recMovieInfo = new MI_MOVIE_INFO();
|
||||
record = NULL;
|
||||
tshift_mode = TSHIFT_MODE_OFF;
|
||||
rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP);
|
||||
}
|
||||
|
||||
@@ -260,6 +259,7 @@ bool CRecordInstance::Stop(bool remove_event)
|
||||
hintBox.paint();
|
||||
|
||||
printf("%s: channel %" PRIx64 " recording_id %d\n", __func__, channel_id, recording_id);
|
||||
printf("%s: file %s.ts\n", __FUNCTION__, filename);
|
||||
SaveXml();
|
||||
/* Stop do close fd - if started */
|
||||
record->Stop();
|
||||
@@ -450,15 +450,19 @@ record_error_msg_t CRecordInstance::Record()
|
||||
//FIXME recording_id (timerd eventID) is 0 means its user recording, in this case timer always added ?
|
||||
if(ret == RECORD_OK && recording_id == 0) {
|
||||
time_t now = time(NULL);
|
||||
int record_end = now+g_settings.record_hours*60*60;
|
||||
if (g_settings.recording_epg_for_end)
|
||||
{
|
||||
int pre=0, post=0;
|
||||
CEPGData epgData;
|
||||
if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) {
|
||||
g_Timerd->getRecordingSafety(pre, post);
|
||||
if (epgData.epg_times.startzeit > 0)
|
||||
record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post;
|
||||
int record_end;
|
||||
if (autoshift) {
|
||||
record_end = now+g_settings.timeshift_hours*60*60;
|
||||
} else {
|
||||
record_end = now+g_settings.record_hours*60*60;
|
||||
if (g_settings.recording_epg_for_end) {
|
||||
int pre=0, post=0;
|
||||
CEPGData epgData;
|
||||
if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) {
|
||||
g_Timerd->getRecordingSafety(pre, post);
|
||||
if (epgData.epg_times.startzeit > 0)
|
||||
record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post;
|
||||
}
|
||||
}
|
||||
}
|
||||
recording_id = g_Timerd->addImmediateRecordTimerEvent(channel_id, now, record_end, epgid, epg_time, apidmode);
|
||||
@@ -676,25 +680,13 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel)
|
||||
strncat(filename, "_",FILENAMEBUFFERSIZE - strlen(filename)-1);
|
||||
}
|
||||
|
||||
pos = strlen(filename);
|
||||
if (g_settings.recording_epg_for_filename) {
|
||||
if(epgid != 0) {
|
||||
CShortEPGData epgdata;
|
||||
if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) {
|
||||
if (!(epgdata.title.empty())) {
|
||||
strcpy(&(filename[pos]), epgdata.title.c_str());
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
}
|
||||
}
|
||||
} else if (!epgTitle.empty()) {
|
||||
strcpy(&(filename[pos]), epgTitle.c_str());
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
}
|
||||
}
|
||||
pos = strlen(filename) - ((!autoshift && g_settings.recording_save_in_channeldir) ? 0 : (ext_channel_name.length() /*remove last "_"*/ +1));
|
||||
|
||||
std::string ext_file_name = g_settings.recording_filename_template;
|
||||
MakeExtFileName(channel, ext_file_name);
|
||||
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_file_name.c_str()));
|
||||
|
||||
pos = strlen(filename);
|
||||
time_t t = time(NULL);
|
||||
pos += strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
|
||||
|
||||
if(autoshift)
|
||||
strncat(filename, "_temp",FILENAMEBUFFERSIZE - strlen(filename)-1);
|
||||
@@ -702,6 +694,60 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel)
|
||||
return RECORD_OK;
|
||||
}
|
||||
|
||||
void CRecordInstance::StringReplace(std::string &str, const std::string search, const std::string rstr)
|
||||
{
|
||||
std::string::size_type ptr = 0;
|
||||
std::string::size_type pos = 0;
|
||||
while((ptr = str.find(search,pos)) != std::string::npos){
|
||||
str.replace(ptr,search.length(),rstr);
|
||||
pos = ptr + rstr.length();
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordInstance::MakeExtFileName(CZapitChannel * channel, std::string &FilenameTemplate)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
// %C == channel, %T == title, %I == info1, %d == date, %t == time_t
|
||||
if (FilenameTemplate.empty())
|
||||
FilenameTemplate = "%C_%T_%d_%t";
|
||||
|
||||
time_t t = time(NULL);
|
||||
strftime(buf,sizeof(buf),"%Y%m%d",localtime(&t));
|
||||
StringReplace(FilenameTemplate,"%d",buf);
|
||||
|
||||
strftime(buf,sizeof(buf),"%H%M%S",localtime(&t));
|
||||
StringReplace(FilenameTemplate,"%t",buf);
|
||||
|
||||
std::string channel_name = channel->getName();
|
||||
if (!(channel_name.empty())) {
|
||||
strcpy(buf, UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
|
||||
ZapitTools::replace_char(buf);
|
||||
StringReplace(FilenameTemplate,"%C",buf);
|
||||
}
|
||||
else
|
||||
StringReplace(FilenameTemplate,"%C","no_channel");
|
||||
|
||||
CShortEPGData epgdata;
|
||||
if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) {
|
||||
if (!(epgdata.title.empty())) {
|
||||
strcpy(buf, epgdata.title.c_str());
|
||||
ZapitTools::replace_char(buf);
|
||||
StringReplace(FilenameTemplate,"%T",buf);
|
||||
}
|
||||
else
|
||||
StringReplace(FilenameTemplate,"%T","no_title");
|
||||
|
||||
if (!(epgdata.info1.empty())) {
|
||||
strcpy(buf, epgdata.info1.c_str());
|
||||
ZapitTools::replace_char(buf);
|
||||
StringReplace(FilenameTemplate,"%I",buf);
|
||||
}
|
||||
else
|
||||
StringReplace(FilenameTemplate,"%I","no_info");
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordInstance::GetRecordString(std::string &str, std::string &dur)
|
||||
{
|
||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
|
||||
@@ -832,28 +878,6 @@ const std::string CRecordManager::GetFileName(t_channel_id channel_id, bool time
|
||||
/* return record mode mask, for channel_id not 0, or global */
|
||||
int CRecordManager::GetRecordMode(const t_channel_id channel_id)
|
||||
{
|
||||
#if 0
|
||||
if (RecordingStatus(channel_id) || IsTimeshift(channel_id))
|
||||
{
|
||||
if (RecordingStatus(channel_id) && !IsTimeshift(channel_id))
|
||||
return RECMODE_REC;
|
||||
if (channel_id == 0)
|
||||
{
|
||||
int records = GetRecordCount();
|
||||
if (IsTimeshift(channel_id) && (records == 1))
|
||||
return RECMODE_TSHIFT;
|
||||
else if (IsTimeshift(channel_id) && (records > 1))
|
||||
return RECMODE_REC_TSHIFT;
|
||||
else
|
||||
return RECMODE_OFF;
|
||||
} else
|
||||
{
|
||||
if (IsTimeshift(channel_id))
|
||||
return RECMODE_TSHIFT;
|
||||
}
|
||||
}
|
||||
return RECMODE_OFF;
|
||||
#endif
|
||||
int recmode = RECMODE_OFF;
|
||||
mutex.lock();
|
||||
if (channel_id == 0) {
|
||||
@@ -913,10 +937,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
||||
|
||||
if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF)
|
||||
return false;
|
||||
#if 0
|
||||
if(!CheckRecording(eventinfo))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if 1 // FIXME test
|
||||
StopSectionsd = false;
|
||||
@@ -926,18 +946,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
||||
RunStartScript();
|
||||
|
||||
mutex.lock();
|
||||
#if 0
|
||||
inst = FindInstance(eventinfo->channel_id);
|
||||
if(inst) {
|
||||
if(direct_record) {
|
||||
error_msg = RECORD_BUSY;
|
||||
} else {
|
||||
CTimerd::RecordingInfo * evt = new CTimerd::RecordingInfo(*eventinfo);
|
||||
printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle);
|
||||
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if(recmap.size() < RECORD_MAX_COUNT) {
|
||||
CFrontend * frontend = NULL;
|
||||
if(CutBackNeutrino(eventinfo->channel_id, frontend)) {
|
||||
@@ -1034,18 +1042,6 @@ bool CRecordManager::StopAutoRecord(bool lock)
|
||||
return (inst != NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo)
|
||||
{
|
||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||
/* FIXME check if frontend used for timeshift the same and will zap ?? */
|
||||
if(/*(eventinfo->channel_id == live_channel_id) ||*/ !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id))
|
||||
StopAutoRecord();
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CRecordManager::StartNextRecording()
|
||||
{
|
||||
CTimerd::RecordingInfo * eventinfo = NULL;
|
||||
@@ -1053,25 +1049,6 @@ void CRecordManager::StartNextRecording()
|
||||
|
||||
for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) {
|
||||
eventinfo = *it;
|
||||
#if 0
|
||||
bool tested = true;
|
||||
if( !recmap.empty() ) {
|
||||
CRecordInstance * inst = FindInstance(eventinfo->channel_id);
|
||||
/* same channel recording and not auto - skip */
|
||||
if(inst && !inst->Timeshift())
|
||||
tested = false;
|
||||
/* there is only auto-record which can be stopped */
|
||||
else if(recmap.size() == 1 && autoshift)
|
||||
tested = true;
|
||||
else {
|
||||
/* there are some recordings, test any (first) for now */
|
||||
recmap_iterator_t fit = recmap.begin();
|
||||
t_channel_id channel_id = fit->second->GetChannelId();
|
||||
tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id));
|
||||
}
|
||||
}
|
||||
if(tested)
|
||||
#endif
|
||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
||||
if (channel && CFEManager::getInstance()->canTune(channel))
|
||||
{
|
||||
@@ -1140,11 +1117,6 @@ void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event)
|
||||
if(inst->Timeshift())
|
||||
autoshift = false;
|
||||
|
||||
#if 0
|
||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||
if(inst->GetChannelId() == live_channel_id)
|
||||
recordingstatus = 0;
|
||||
#endif
|
||||
delete inst;
|
||||
}
|
||||
|
||||
@@ -1278,47 +1250,6 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
return messages_return::unhandled;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool CRecordManager::IsTimeshift(t_channel_id channel_id)
|
||||
{
|
||||
bool ret = false;
|
||||
CRecordInstance * inst;
|
||||
mutex.lock();
|
||||
if (channel_id != 0)
|
||||
{
|
||||
inst = FindInstance(channel_id);
|
||||
if(inst && inst->tshift_mode)
|
||||
ret = true;
|
||||
else
|
||||
ret = false;
|
||||
} else
|
||||
{
|
||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
||||
{
|
||||
if(it->second->tshift_mode)
|
||||
{
|
||||
mutex.unlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CRecordManager::SetTimeshiftMode(CRecordInstance * inst, int mode)
|
||||
{
|
||||
mutex.lock();
|
||||
/* reset all instances mode ? */
|
||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
||||
it->second->tshift_mode = TSHIFT_MODE_OFF;
|
||||
|
||||
mutex.unlock();
|
||||
if (inst)
|
||||
inst->tshift_mode = mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CRecordManager::StartTimeshift()
|
||||
{
|
||||
if(g_RemoteControl->is_video_started)
|
||||
@@ -1326,26 +1257,6 @@ void CRecordManager::StartTimeshift()
|
||||
std::string tmode = "ptimeshift"; // already recording, pause
|
||||
bool res = true;
|
||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||
#if 0
|
||||
if(RecordingStatus(live_channel_id))
|
||||
{
|
||||
tmode = "ptimeshift"; // already recording, pause
|
||||
if(GetRecordMode(live_channel_id) == RECMODE_TSHIFT)
|
||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PAUSE);
|
||||
} else
|
||||
{
|
||||
if(g_settings.temp_timeshift)
|
||||
{
|
||||
res = StartAutoRecord();
|
||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_TEMPORAER);
|
||||
} else
|
||||
{
|
||||
res = Record(live_channel_id);
|
||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PERMANET);
|
||||
}
|
||||
tmode = "timeshift"; // record just started
|
||||
}
|
||||
#endif
|
||||
/* start temporary timeshift if enabled and not running, but dont start second record */
|
||||
if (g_settings.temp_timeshift) {
|
||||
if (!FindTimeshift()) {
|
||||
@@ -1427,10 +1338,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
||||
|
||||
return menu_return::RETURN_EXIT_ALL;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING));
|
||||
#endif
|
||||
} else if(actionKey == "Timeshift")
|
||||
{
|
||||
StartTimeshift();
|
||||
@@ -1497,7 +1404,6 @@ bool CRecordManager::ShowMenu(void)
|
||||
durations.push_back(duration);
|
||||
|
||||
const char* mode_icon = NEUTRINO_ICON_REC;
|
||||
//if (inst->tshift_mode)
|
||||
if (inst->Timeshift())
|
||||
mode_icon = NEUTRINO_ICON_AUTO_SHIFT;
|
||||
|
||||
@@ -1551,7 +1457,6 @@ bool CRecordManager::ShowMenu(void)
|
||||
|
||||
bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||
{
|
||||
//int recording_id = 0;
|
||||
std::string title, duration;
|
||||
CRecordInstance * inst;
|
||||
|
||||
@@ -1562,7 +1467,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||
inst = FindInstance(channel_id);
|
||||
|
||||
if(inst) {
|
||||
//recording_id = inst->GetRecordingId();
|
||||
inst->GetRecordString(title, duration);
|
||||
title += duration;
|
||||
}
|
||||
@@ -1572,9 +1476,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||
|
||||
if(ShowMsg(LOCALE_SHUTDOWN_RECODING_QUERY, title.c_str(),
|
||||
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) {
|
||||
#if 0
|
||||
g_Timerd->stopTimerEvent(recording_id);
|
||||
#endif
|
||||
mutex.lock();
|
||||
if (recid)
|
||||
inst = FindInstanceID(recid);
|
||||
|
Reference in New Issue
Block a user