diff options
author | Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> | 2017-04-01 23:17:15 +0300 |
---|---|---|
committer | Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> | 2017-04-01 23:17:15 +0300 |
commit | eaa015874e3e494006d67260feaebe6377568ebb (patch) | |
tree | 9d407c10cbf0d541377a08e390ed603909abfddb /pages | |
parent | a8eb15416c38009efb9562c5d64ef87719ae017c (diff) | |
download | vdr-plugin-live-eaa015874e3e494006d67260feaebe6377568ebb.tar.gz vdr-plugin-live-eaa015874e3e494006d67260feaebe6377568ebb.tar.bz2 |
VDR-2.3.1 compatibility patch by Nachteule.
http://www.vdr-portal.de/board16-video-disk-recorder/board55-vdr-plugins/p1280013-vdr-live-vdr-2-3-1/#post1280013
Diffstat (limited to 'pages')
-rw-r--r-- | pages/channels_widget.ecpp | 9 | ||||
-rw-r--r-- | pages/edit_timer.ecpp | 5 | ||||
-rw-r--r-- | pages/epginfo.ecpp | 5 | ||||
-rw-r--r-- | pages/ibox.ecpp | 23 | ||||
-rw-r--r-- | pages/multischedule.ecpp | 28 | ||||
-rw-r--r-- | pages/recordings.ecpp | 5 | ||||
-rw-r--r-- | pages/remote.ecpp | 16 | ||||
-rw-r--r-- | pages/schedule.ecpp | 29 | ||||
-rw-r--r-- | pages/searchresults.ecpp | 7 | ||||
-rw-r--r-- | pages/timerconflicts.ecpp | 12 | ||||
-rw-r--r-- | pages/timers.ecpp | 7 | ||||
-rw-r--r-- | pages/vlc.ecpp | 5 | ||||
-rw-r--r-- | pages/whats_on.ecpp | 13 |
13 files changed, 164 insertions, 0 deletions
diff --git a/pages/channels_widget.ecpp b/pages/channels_widget.ecpp index fed7483..d4c06b4 100644 --- a/pages/channels_widget.ecpp +++ b/pages/channels_widget.ecpp @@ -20,12 +20,21 @@ bool logged_in(false); if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); }> <%cpp> +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + if (false) +#else ReadLock channelsLock( Channels ); if ( !channelsLock ) +#endif throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); </%cpp> <select name="<$ name $>" id="<$ name $>" <{ reply.out() << ( !onchange.empty() ? "onchange=\""+onchange+"\"" : "" ); }>> +%#if VDRVERSNUM >= 20301 +% for ( cChannel *listChannel = (cChannel *)Channels->First(); listChannel; listChannel = (cChannel *)Channels->Next( listChannel ) ) { +%#else % for ( cChannel *listChannel = Channels.First(); listChannel; listChannel = Channels.Next( listChannel ) ) { +%#endif % if ( listChannel->GroupSep() || *listChannel->Name() == '\0' ) % continue; % diff --git a/pages/edit_timer.ecpp b/pages/edit_timer.ecpp index 0fe253c..8792c23 100644 --- a/pages/edit_timer.ecpp +++ b/pages/edit_timer.ecpp @@ -112,8 +112,13 @@ cTimer* timer; if ( channelid.Valid() && eventid != 0 ) { cerr << "grabbing event" << endl << endl; cSchedulesLock schedLock; +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; + cSchedule const* schedule = Schedules->GetSchedule( channelid ); +#else cSchedules const* schedules = cSchedules::Schedules( schedLock ); cSchedule const* schedule = schedules->GetSchedule( channelid ); +#endif eventTimer.reset( new cTimer( schedule->GetEvent( eventid ) ) ); } else { diff --git a/pages/epginfo.ecpp b/pages/epginfo.ecpp index 743dcb2..77d2f91 100644 --- a/pages/epginfo.ecpp +++ b/pages/epginfo.ecpp @@ -73,6 +73,10 @@ using namespace std; } // check for event: else if (epgid.compare(0, event.length(), event) == 0) { +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; + epgEvent = EpgEvents::CreateEpgInfo(epgid, Schedules); +#else schedulesLockPtr = SchedulesLockPtr(new SchedulesLock); if (!schedulesLockPtr) { throw HtmlError(tr("Error aquiring schedules lock")); @@ -82,6 +86,7 @@ using namespace std; throw HtmlError(tr("Error aquiring schedules")); } epgEvent = EpgEvents::CreateEpgInfo(epgid, schedules); +#endif } // check for aboutbox: else if (epgid.compare(0, aboutbox.length(), aboutbox) == 0) { diff --git a/pages/ibox.ecpp b/pages/ibox.ecpp index 84c9615..5e714b0 100644 --- a/pages/ibox.ecpp +++ b/pages/ibox.ecpp @@ -50,7 +50,12 @@ TimerConflictNotifier timerNotifier(); if (NowReplaying) { RecordingsManagerPtr recManager = LiveRecordingsManager(); +#if VDRVERSNUM >= 20301 + LOCK_RECORDINGS_READ; + cRecording *recording = (cRecording *)Recordings->GetByName(NowReplaying); +#else cRecording *recording = Recordings.GetByName(NowReplaying); +#endif if (recording) { epgEvent = EpgEvents::CreateEpgInfo(recManager->Md5Hash(recording), recording, @@ -59,22 +64,40 @@ TimerConflictNotifier timerNotifier(); } else { string CHANNEL_STR("channel"); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#else ReadLock channelsLock( Channels ); +#endif if (cDevice::CurrentChannel()) { const int SKIP_GAP = 1; +#if VDRVERSNUM >= 20301 + cChannel* Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel()); + + cChannel* tmp = (cChannel *)Channels->GetByNumber(Channels->GetPrevNormal(cDevice::CurrentChannel()), -SKIP_GAP); +#else cChannel* Channel = Channels.GetByNumber(cDevice::CurrentChannel()); cChannel* tmp = Channels.GetByNumber(Channels.GetPrevNormal(cDevice::CurrentChannel()), -SKIP_GAP); +#endif if (tmp) prev_chan = tmp->GetChannelID(); +#if VDRVERSNUM >= 20301 + tmp = (cChannel *)Channels->GetByNumber(Channels->GetNextNormal(cDevice::CurrentChannel()), SKIP_GAP); +#else tmp = Channels.GetByNumber(Channels.GetNextNormal(cDevice::CurrentChannel()), SKIP_GAP); +#endif if (tmp) next_chan = tmp->GetChannelID(); const string chanName(Channel->Name()); +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; +#else cSchedulesLock schedulesLock; const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); +#endif const cSchedule *Schedule = Schedules->GetSchedule(Channel); if (Schedule) { diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp index d4fca9d..5c46557 100644 --- a/pages/multischedule.ecpp +++ b/pages/multischedule.ecpp @@ -53,9 +53,13 @@ std::vector<time_t> times_start; if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = tr("MultiSchedule"); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#else ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); +#endif #define MAX_CHANNELS 10 #define MAX_DAYS 3 @@ -72,10 +76,18 @@ std::vector<time_t> times_start; // setup default channel groups int lastChannel = LiveSetup().GetLastChannel(); if ( lastChannel == 0 ) +#if VDRVERSNUM >= 20301 + lastChannel = Channels->MaxNumber(); +#else lastChannel = Channels.MaxNumber(); +#endif std::stringstream groups; int i = 0; +#if VDRVERSNUM >= 20301 + for (cChannel *channel = (cChannel *)Channels->First(); channel && (channel->Number() <= lastChannel); channel = (cChannel *)Channels->Next(channel)) +#else for (cChannel *channel = Channels.First(); channel && (channel->Number() <= lastChannel); channel = Channels.Next(channel)) +#endif { if (channel->GroupSep()) continue; @@ -118,7 +130,11 @@ std::vector<time_t> times_start; else thisGroup = ""; int channel_no = lexical_cast< int > (thisChannel); +#if VDRVERSNUM >= 20301 + cChannel* Channel = (cChannel *)Channels->GetByNumber( channel_no ); +#else cChannel* Channel = Channels.GetByNumber( channel_no ); +#endif if ( !Channel ) { esyslog("Live: could not find channel no '%s'.", thisChannel.c_str() ); @@ -262,8 +278,12 @@ std::vector<time_t> times_start; <& menu active=("multischedule") component=("multischedule.channel_selection") &> <div class="inhalt"> <%cpp> +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; +#else cSchedulesLock schedulesLock; cSchedules const* schedules = cSchedules::Schedules( schedulesLock ); +#endif time_t now = time(NULL); if ( time_para >= times_start.size() ) @@ -296,7 +316,11 @@ std::vector<time_t> times_start; int chan = channel_groups_numbers[ channel ][ j ]; +#if VDRVERSNUM >= 20301 + cChannel* Channel = (cChannel *)Channels->GetByNumber( chan ); +#else cChannel* Channel = Channels.GetByNumber( chan ); +#endif if ( ! Channel ) continue; if ( Channel->GroupSep() || Channel->Name() == '\0' ) @@ -304,7 +328,11 @@ std::vector<time_t> times_start; channel_names[ j ] = Channel->Name(); channel_IDs[ j ] = Channel->GetChannelID(); +#if VDRVERSNUM >= 20301 + cSchedule const* Schedule = Schedules->GetSchedule( (cChannel *)Channel ); +#else cSchedule const* Schedule = schedules->GetSchedule( Channel ); +#endif if ( ! Schedule ) continue; for (const cEvent *Event = Schedule->Events()->First(); Event; diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp index 7975438..1693e2a 100644 --- a/pages/recordings.ecpp +++ b/pages/recordings.ecpp @@ -153,7 +153,12 @@ if (!deleteResult.empty()) { <div class="inhalt"> <div class="boxheader"><div><div><$ string(tr("List of recordings")) + " (" + diskinfo + ")" $></div></div></div> <%cpp> +#if VDRVERSNUM >= 20301 + LOCK_RECORDINGS_READ; + if (Recordings->Count() == 0) { // Access VDRs global cRecordings Recordings instance. +#else if (Recordings.Count() == 0) { // Access VDRs global cRecordings Recordings instance. +#endif </%cpp> <$ tr("No recordings found") $> <%cpp> diff --git a/pages/remote.ecpp b/pages/remote.ecpp index 0f2b195..a1aa0ff 100644 --- a/pages/remote.ecpp +++ b/pages/remote.ecpp @@ -31,20 +31,36 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = tr("Remote Control"); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#else ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); +#endif // cChannel* Channel; (see %request above) if ( channel > 0 ) { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->GetByNumber( channel ); +#else Channel = Channels.GetByNumber( channel ); +#endif } else { if (cDevice::CurrentChannel()) { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel()); +#else Channel = Channels.GetByNumber(cDevice::CurrentChannel()); +#endif } else { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->Get( Channels->GetNextNormal( -1 ) ); +#else Channel = Channels.Get( Channels.GetNextNormal( -1 ) ); +#endif } } if ( Channel == 0 ) diff --git a/pages/schedule.ecpp b/pages/schedule.ecpp index 8a77059..5d14e2b 100644 --- a/pages/schedule.ecpp +++ b/pages/schedule.ecpp @@ -31,29 +31,50 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <%cpp> pageTitle = trVDR("Schedule"); +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; + LOCK_CHANNELS_READ; +#else cSchedulesLock schedulesLock; cSchedules const* schedules = cSchedules::Schedules( schedulesLock ); ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); +#endif // cChannel* Channel; (see %request above) if ( channel > 0 ) { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->GetByNumber( channel ); +#else Channel = Channels.GetByNumber( channel ); +#endif } else { if (cDevice::CurrentChannel()) { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel()); +#else Channel = Channels.GetByNumber(cDevice::CurrentChannel()); +#endif } else { +#if VDRVERSNUM >= 20301 + Channel = (cChannel *)Channels->Get( Channels->GetNextNormal( -1 ) ); +#else Channel = Channels.Get( Channels.GetNextNormal( -1 ) ); +#endif } } if ( Channel == 0 ) throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); +#if VDRVERSNUM >= 20301 + cSchedule const* Schedule = Schedules->GetSchedule( (const cChannel *)Channel ); +#else cSchedule const* Schedule = schedules->GetSchedule( Channel ); +#endif </%cpp> <& pageelems.doc_type &> <html> @@ -81,7 +102,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); time_t now = time(NULL) - ::Setup.EPGLinger * 60; // tChannelID channel_id(Channel->GetChannelID()); // int evntNr = 0; +#if VDRVERSNUM >= 20301 + for (const cEvent *Event = (cEvent *)Schedule->Events()->First(); Event; Event = (cEvent *)Schedule->Events()->Next(Event)) { +#else for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { +#endif if (Event->EndTime() <= now && Event != PresentEvent) continue; @@ -99,7 +124,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); bool truncated = false; bool lastEventCurrentDay = false; { +#if VDRVERSNUM >= 20301 + cEvent* NextEvent = (cEvent *)Schedule->Events()->Next(Event); +#else cEvent* NextEvent = Schedule->Events()->Next(Event); +#endif if (!NextEvent) { lastEventCurrentDay = true; } diff --git a/pages/searchresults.ecpp b/pages/searchresults.ecpp index 64ae350..695a7cd 100644 --- a/pages/searchresults.ecpp +++ b/pages/searchresults.ecpp @@ -60,8 +60,15 @@ bool logged_in(false); <%cpp> string current_day = ""; +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#endif for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) { +#if VDRVERSNUM >= 20301 + cChannel* channel = (cChannel *)Channels->GetByChannelID(result->Channel()); +#else cChannel* channel = Channels.GetByChannelID(result->Channel()); +#endif if (!channel) continue; string channelname = channel->Name(); int channelnr = channel->Number(); diff --git a/pages/timerconflicts.ecpp b/pages/timerconflicts.ecpp index c7e18ea..83d139b 100644 --- a/pages/timerconflicts.ecpp +++ b/pages/timerconflicts.ecpp @@ -46,6 +46,10 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); % } else { <table class="listing" cellspacing="0" cellpadding="0"> <%cpp> +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_READ; + LOCK_SCHEDULES_READ; +#endif for (TimerConflicts::iterator conflict = timerConflicts.begin(); conflict != timerConflicts.end(); ++conflict) { const std::list< TimerInConflict >& conflTimers = conflict->ConflictingTimers(); for (std::list< TimerInConflict >::const_iterator confltimer = conflTimers.begin(); confltimer != conflTimers.end(); ++confltimer) { @@ -69,7 +73,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); </tr> <%cpp> for (std::list<int>::const_iterator timerIndex = confltimer->concurrentTimerIndices.begin(); timerIndex != confltimer->concurrentTimerIndices.end(); ++timerIndex) { +#if VDRVERSNUM >= 20301 + cTimer* timer = (cTimer *)Timers->Get(*timerIndex-1); +#else cTimer* timer = Timers.Get(*timerIndex-1); +#endif if (!timer) continue; std::list< int >::const_iterator nexttimerIndex = timerIndex; @@ -90,7 +98,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); EpgInfoPtr epgEvent; string longDescription; string title; +#if VDRVERSNUM >= 20301 + if (!timer->Event()) timer->SetEventFromSchedule(Schedules); +#else if (!timer->Event()) timer->SetEventFromSchedule(); +#endif if (timer->Event()) { epgEvent = EpgEvents::CreateEpgInfo(timer->Channel(), timer->Event()); longDescription = StringEscapeAndBreak(SortedTimers::GetTimerInfo(*timer)) + "<hr>" diff --git a/pages/timers.ecpp b/pages/timers.ecpp index 66b5235..cc2eeb6 100644 --- a/pages/timers.ecpp +++ b/pages/timers.ecpp @@ -77,10 +77,17 @@ static const size_t maximumDescriptionLength = 300; <table class="listing" cellspacing="0" cellpadding="0"> <%cpp> // output of the timer list: +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; +#endif for (SortedTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) { EpgInfoPtr epgEvent; string longDescription; +#if VDRVERSNUM >= 20301 + if (!timer->Event()) timer->SetEventFromSchedule(Schedules); +#else if (!timer->Event()) timer->SetEventFromSchedule(); +#endif if (timer->Event()) { epgEvent = EpgEvents::CreateEpgInfo(timer->Channel(), timer->Event()); diff --git a/pages/vlc.ecpp b/pages/vlc.ecpp index 480e949..881958c 100644 --- a/pages/vlc.ecpp +++ b/pages/vlc.ecpp @@ -34,12 +34,17 @@ using namespace vdrlive; Channel = 0; if (recid.empty()) { pageTitle = tr("VLC: live video stream"); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + Channel = (cChannel *)Channels->GetByChannelID(channel); +#else ReadLock channelsLock(Channels); if (!channelsLock) { throw HtmlError(tr("Couldn't aquire access to channels, please try again later.")); } Channel = Channels.GetByChannelID(channel); +#endif if (Channel == 0) { throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); } diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index 8232875..f9a66c3 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -38,8 +38,12 @@ string current_displaytime; if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); +#if VDRVERSNUM >= 20301 +LOCK_SCHEDULES_READ; +#else cSchedulesLock schedulesLock; const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); +#endif string head; time_t seektime = 0; @@ -124,10 +128,19 @@ if (type == "now") { // collect the broadcasts if (type != "favs") { +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + if (true) { +#else ReadLock channelsLock( Channels ); if (channelsLock) { +#endif // int evntNr = 0; +#if VDRVERSNUM >= 20301 + for (cChannel *Channel = (cChannel *)Channels->First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = (cChannel *)Channels->Next(Channel)) { +#else for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) { +#endif if (Channel->GroupSep()) { continue; } |