MythTV  master
tvbrowsehelper.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QCoreApplication>
3 
4 // MythTV
7 
8 #include "cardutil.h"
9 #include "channelutil.h"
10 #include "playercontext.h"
11 #include "recordinginfo.h"
12 #include "remoteencoder.h"
13 #include "tv_play.h"
14 #include "tvbrowsehelper.h"
15 
16 #define LOC QString("BrowseHelper: ")
17 
18 static void format_time(int seconds, QString& tMin, QString& tHrsMin)
19 {
20  int minutes = seconds / 60;
21  int hours = minutes / 60;
22  int min = minutes % 60;
23 
24  tMin = TV::tr("%n minute(s)", "", minutes);
25  tHrsMin = QString("%1:%2").arg(hours).arg(min, 2, 10, QChar('0'));
26 }
27 
29  : MThread("TVBrowseHelper"),
30  m_parent(Parent)
31 {
32 }
33 
35 {
36  BrowseStop();
37  BrowseWait();
38 }
39 
40 void TVBrowseHelper::BrowseInit(std::chrono::seconds BrowseMaxForward, bool BrowseAllTuners,
41  bool UseChannelGroups, const QString &DBChannelOrdering)
42 {
43  m_dbBrowseMaxForward = BrowseMaxForward;
45  m_dbUseChannelGroups = UseChannelGroups;
46 
47  m_dbAllChannels = ChannelUtil::GetChannels(0, true, "channum, callsign");
48  ChannelUtil::SortChannels(m_dbAllChannels, DBChannelOrdering, false);
49 
50  for (const auto & chan : m_dbAllChannels)
51  {
52  m_dbChanidToChannum[chan.m_chanId] = chan.m_chanNum;
53  m_dbChanidToSourceid[chan.m_chanId] = chan.m_sourceId;
54  m_dbChannumToChanids.insert(chan.m_chanNum,chan.m_chanId);
55  }
56 
57  m_dbAllVisibleChannels = ChannelUtil::GetChannels(0, true, "channum, callsign");
58  ChannelUtil::SortChannels(m_dbAllVisibleChannels, DBChannelOrdering, false);
59  start();
60 }
61 
63 {
64  QMutexLocker locker(&m_browseLock);
65  m_browseList.clear();
66  m_browseRun = false;
67  m_browseWait.wakeAll();
68 }
69 
71 {
72  MThread::wait();
73 }
74 
77 bool TVBrowseHelper::BrowseStart(bool SkipBrowse)
78 {
79  if (!gCoreContext->IsUIThread())
80  return false;
81 
82  QMutexLocker locker(&m_browseLock);
83 
84  if (m_browseTimerId)
85  return true;
86 
87  m_parent->ClearOSD();
90  context->LockPlayingInfo(__FILE__, __LINE__);
91  if (context->m_playingInfo)
92  {
96  context->UnlockPlayingInfo(__FILE__, __LINE__);
98 
99  if (!SkipBrowse)
100  {
102  locker.unlock();
103  BrowseDispInfo(bi);
104  }
105  return true;
106  }
107  context->UnlockPlayingInfo(__FILE__, __LINE__);
109  return false;
110 }
111 
117 void TVBrowseHelper::BrowseEnd(bool ChangeChannel)
118 {
119  if (!gCoreContext->IsUIThread())
120  return;
121 
122  QMutexLocker locker(&m_browseLock);
123 
124  if (m_browseTimerId)
125  {
127  m_browseTimerId = 0;
128  }
129 
130  m_browseList.clear();
131  m_browseWait.wakeAll();
132 
133  OSD* osd = m_parent->GetOSDL();
134  if (osd)
137 
138  if (ChangeChannel)
140 }
141 
143 {
144  if (!gCoreContext->IsUIThread())
145  return;
146 
147  if (!BrowseStart(true))
148  return;
149 
152 
153  QMutexLocker locker(&m_browseLock);
154  if (BROWSE_SAME == Browseinfo.m_dir)
155  m_browseList.clear();
156  m_browseList.push_back(Browseinfo);
157  m_browseWait.wakeAll();
158 }
159 
161 {
162  BrowseInfo bi(Direction);
163  if (BROWSE_SAME != Direction)
164  BrowseDispInfo(bi);
165 }
166 
168 {
169  if (!gCoreContext->IsUIThread())
170  return;
171 
173  {
174  BrowseInfo bi(Channum, 0);
175  BrowseDispInfo(bi);
176  return;
177  }
178 
181  if (!context->m_recorder || !context->m_lastCardid)
182  {
184  return;
185  }
186 
187  uint inputid = static_cast<uint>(context->m_lastCardid);
189  uint sourceid = CardUtil::GetSourceID(inputid);
190  if (sourceid)
191  {
192  BrowseInfo bi(Channum, sourceid);
193  BrowseDispInfo(bi);
194  }
195 }
196 
198 {
199  QMutexLocker locker(&m_browseLock);
204  return bi;
205 }
206 
214 uint TVBrowseHelper::GetBrowseChanId(const QString& Channum, uint PrefCardid, uint PrefSourceid) const
215 {
216  if (PrefSourceid)
217  {
218  auto samesourceid = [&Channum, &PrefSourceid](const ChannelInfo& Chan)
219  { return Chan.m_sourceId == PrefSourceid && Chan.m_chanNum == Channum; };
220  auto chan = std::find_if(m_dbAllChannels.cbegin(), m_dbAllChannels.cend(), samesourceid);
221  if (chan != m_dbAllChannels.cend())
222  return chan->m_chanId;
223  }
224 
225  if (PrefCardid)
226  {
227  auto prefcardid = [&Channum, &PrefCardid](const ChannelInfo& Chan)
228  { return Chan.GetInputIds().contains(PrefCardid) && Chan.m_chanNum == Channum; };
229  auto chan = std::find_if(m_dbAllChannels.cbegin(), m_dbAllChannels.cend(), prefcardid);
230  if (chan != m_dbAllChannels.cend())
231  return chan->m_chanId;
232  }
233 
235  {
236  auto channelmatch = [&Channum](const ChannelInfo& Chan) { return Chan.m_chanNum == Channum; };
237  auto chan = std::find_if(m_dbAllChannels.cbegin(), m_dbAllChannels.cend(), channelmatch);
238  if (chan != m_dbAllChannels.cend())
239  return chan->m_chanId;
240  }
241 
242  return 0;
243 }
244 
251 {
254  if (!context->m_recorder)
255  {
257  return;
258  }
259 
260  QString title;
261  QString subtitle;
262  QString desc;
263  QString category;
264  QString endtime;
265  QString callsign;
266  QString iconpath;
267  QDateTime begts;
268  QDateTime endts;
269 
270  QString starttime = Infomap["dbstarttime"];
271  QString chanid = Infomap["chanid"];
272  QString channum = Infomap["channum"];
273  QString seriesid = Infomap["seriesid"];
274  QString programid = Infomap["programid"];
275 
276  context->m_recorder->GetNextProgram(Direction, title, subtitle, desc, category,
277  starttime, endtime, callsign, iconpath,
278  channum, chanid, seriesid, programid);
280 
281  if (!starttime.isEmpty())
282  begts = MythDate::fromString(starttime);
283  else
284  begts = MythDate::fromString(Infomap["dbstarttime"]);
285 
286  Infomap["starttime"] = MythDate::toString(begts, MythDate::kTime);
287  Infomap["startdate"] = MythDate::toString(begts, MythDate::kDateFull | MythDate::kSimplify);
288 
289  Infomap["endtime"] = Infomap["enddate"] = "";
290  if (!endtime.isEmpty())
291  {
292  endts = MythDate::fromString(endtime);
293  Infomap["endtime"] = MythDate::toString(endts, MythDate::kTime);
294  Infomap["enddate"] = MythDate::toString(endts, MythDate::kDateFull | MythDate::kSimplify);
295  }
296 
297  Infomap["lenmins"] = TV::tr("%n minute(s)", "", 0);
298  Infomap["lentime"] = "0:00";
299  if (begts.isValid() && endts.isValid())
300  {
301  QString lenM;
302  QString lenHM;
303  format_time(static_cast<int>(begts.secsTo(endts)), lenM, lenHM);
304  Infomap["lenmins"] = lenM;
305  Infomap["lentime"] = lenHM;
306  }
307 
308  Infomap["dbstarttime"] = starttime;
309  Infomap["dbendtime"] = endtime;
310  Infomap["title"] = title;
311  Infomap["subtitle"] = subtitle;
312  Infomap["description"] = desc;
313  Infomap["category"] = category;
314  Infomap["callsign"] = callsign;
315  Infomap["channum"] = channum;
316  Infomap["chanid"] = chanid;
317  Infomap["iconpath"] = iconpath;
318  Infomap["seriesid"] = seriesid;
319  Infomap["programid"] = programid;
320 }
321 
323 {
324  uint chanid = Infomap["chanid"].toUInt();
325  if (!chanid)
326  {
327  LOG(VB_GENERAL, LOG_ERR, LOC + "GetNextProgramDB() requires a chanid");
328  return;
329  }
330 
331  int chandir = -1;
332  switch (direction)
333  {
334  case BROWSE_UP: chandir = CHANNEL_DIRECTION_UP; break;
335  case BROWSE_DOWN: chandir = CHANNEL_DIRECTION_DOWN; break;
336  case BROWSE_FAVORITE: chandir = CHANNEL_DIRECTION_FAVORITE; break;
337  case BROWSE_SAME:
338  case BROWSE_LEFT:
339  case BROWSE_RIGHT:
340  case BROWSE_INVALID: break;
341  }
342 
343  if (chandir != -1)
344  {
346  chanid,
347  0 /* mplexid_restriction */,
348  0 /* chanid restriction */,
349  static_cast<ChannelChangeDirection>(chandir),
350  true /* skip non visible */,
351  true /* skip_same_channum_and_callsign */,
352  true /* skip_other_sources */);
353  }
354 
355  Infomap["chanid"] = QString::number(chanid);
356  Infomap["channum"] = m_dbChanidToChannum[chanid];
357 
358  QDateTime nowtime = MythDate::current();
359  static constexpr int64_t kSixHours {6LL * 60 * 60};
360  QDateTime latesttime = nowtime.addSecs(kSixHours);
361  QDateTime browsetime = MythDate::fromString(Infomap["dbstarttime"]);
362 
363  MSqlBindings bindings;
364  bindings[":CHANID"] = chanid;
365  bindings[":NOWTS"] = nowtime;
366  bindings[":LATESTTS"] = latesttime;
367  bindings[":BROWSETS"] = browsetime;
368  bindings[":BROWSETS2"] = browsetime;
369 
370  QString querystr = " WHERE program.chanid = :CHANID ";
371  switch (direction)
372  {
373  case BROWSE_LEFT:
374  querystr += " AND program.endtime <= :BROWSETS AND program.endtime > :NOWTS ";
375  break;
376  case BROWSE_RIGHT:
377  querystr += " AND program.starttime > :BROWSETS AND program.starttime < :LATESTTS ";
378  break;
379  default:
380  querystr += " AND program.starttime <= :BROWSETS AND program.endtime > :BROWSETS2 ";
381  };
382 
383  ProgramList progList;
384  ProgramList dummySched;
385  LoadFromProgram(progList, querystr, bindings, dummySched);
386 
387  if (progList.empty())
388  {
389  Infomap["dbstarttime"] = "";
390  return;
391  }
392 
393  const ProgramInfo* prog = (direction == BROWSE_LEFT) ?
394  progList[static_cast<uint>(progList.size() - 1)] : progList[0];
395  Infomap["dbstarttime"] = prog->GetScheduledStartTime(MythDate::ISODate);
396 }
397 
399 {
400  RunProlog();
401  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Helper thread starting");
402  QMutexLocker locker(&m_browseLock);
403  while (true)
404  {
405  while (m_browseList.empty() && m_browseRun)
406  m_browseWait.wait(&m_browseLock);
407 
408  if (!m_browseRun)
409  break;
410 
411  BrowseInfo bi = m_browseList.front();
412  m_browseList.pop_front();
413 
414  std::vector<uint> chanids;
415  if (BROWSE_SAME == bi.m_dir)
416  {
417  if (!bi.m_chanId)
418  {
419  std::vector<uint> chanids_extra;
421  QMultiMap<QString,uint>::iterator it;
422  it = m_dbChannumToChanids.lowerBound(bi.m_chanNum);
423  for ( ; (it != m_dbChannumToChanids.end()) &&
424  (it.key() == bi.m_chanNum); ++it)
425  {
426  if (m_dbChanidToSourceid[*it] == sourceid)
427  chanids.push_back(*it);
428  else
429  chanids_extra.push_back(*it);
430  }
431  chanids.insert(chanids.end(),
432  chanids_extra.begin(),
433  chanids_extra.end());
434  }
436  m_browseChanId = (chanids.empty()) ? bi.m_chanId : chanids[0];
438  }
439 
440  BrowseDirection direction = bi.m_dir;
441 
442  QDateTime lasttime = MythDate::fromString(m_browseStartTime);
443  QDateTime curtime = MythDate::current();
444  if (lasttime < curtime)
445  m_browseStartTime = curtime.toString(Qt::ISODate);
446 
447  QDateTime maxtime = curtime.addSecs(m_dbBrowseMaxForward.count());
448  if ((lasttime > maxtime) && (direction == BROWSE_RIGHT))
449  continue;
450 
451  m_browseLock.unlock();
452 
453  // if browsing channel groups is enabled or
454  // direction if BROWSE_FAVORITES
455  // Then pick the next channel in the channel group list to browse
456  // If channel group is ALL CHANNELS (-1), then bypass picking from
457  // the channel group list
458  if ((m_dbUseChannelGroups || (direction == BROWSE_FAVORITE)) &&
459  (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT) &&
460  (direction != BROWSE_SAME))
461  {
463  if (m_parent->m_channelGroupId > -1)
464  {
466  if ((direction == BROWSE_UP) || (direction == BROWSE_FAVORITE))
467  dir = CHANNEL_DIRECTION_UP;
468  else if (direction == BROWSE_DOWN)
470 
472  direction = BROWSE_SAME;
473 
474  m_parent->m_channelGroupLock.unlock();
475 
476  m_browseLock.lock();
477  m_browseChanId = chanid;
478  m_browseChanNum.clear();
479  m_browseLock.unlock();
480  }
481  else
482  {
483  m_parent->m_channelGroupLock.unlock();
484  }
485  }
486 
487  if (direction == BROWSE_FAVORITE)
488  direction = BROWSE_UP;
489 
490  InfoMap infoMap;
491  infoMap["dbstarttime"] = m_browseStartTime;
492  infoMap["channum"] = m_browseChanNum;
493  infoMap["chanid"] = QString::number(m_browseChanId);
494 
496 
497  if (!m_dbBrowseAllTuners)
498  {
499  GetNextProgram(direction, infoMap);
500  }
501  else
502  {
503  if (!chanids.empty())
504  {
505  auto tunable = [](uint chanid) { return TV::IsTunable(chanid); };
506  auto it = std::find_if(chanids.cbegin(), chanids.cend(), tunable);
507  if (it != chanids.cend())
508  {
509  infoMap["chanid"] = QString::number(*it);
510  GetNextProgramDB(direction, infoMap);
511  }
512  }
513  else
514  {
515  uint orig_chanid = infoMap["chanid"].toUInt();
516  GetNextProgramDB(direction, infoMap);
517  while (!TV::IsTunable(infoMap["chanid"].toUInt()) &&
518  (infoMap["chanid"].toUInt() != orig_chanid))
519  {
520  GetNextProgramDB(direction, infoMap);
521  }
522  }
523  }
525 
526  m_browseLock.lock();
527 
528  m_browseChanNum = infoMap["channum"];
529  m_browseChanId = infoMap["chanid"].toUInt();
530 
531  if (((direction == BROWSE_LEFT) || (direction == BROWSE_RIGHT)) &&
532  !infoMap["dbstarttime"].isEmpty())
533  {
534  m_browseStartTime = infoMap["dbstarttime"];
535  }
536 
537  if (!m_browseList.empty())
538  {
539  // send partial info to UI for appearance of responsiveness
540  QCoreApplication::postEvent(m_parent, new UpdateBrowseInfoEvent(infoMap));
541  continue;
542  }
543  m_browseLock.unlock();
544 
545  // pull in additional data from the DB...
547  infoMap["channelgroup"] = ChannelGroup::GetChannelGroupName(m_parent->m_channelGroupId);
548  else
549  infoMap["channelgroup"] = QObject::tr("All channels");
550 
551  QDateTime startts = MythDate::fromString(m_browseStartTime);
552  RecordingInfo recinfo(m_browseChanId, startts, false);
553  recinfo.ToMap(infoMap);
554  infoMap["iconpath"] = ChannelUtil::GetIcon(recinfo.GetChanID());
555 
556  m_browseLock.lock();
557  QCoreApplication::postEvent(m_parent, new UpdateBrowseInfoEvent(infoMap));
558  }
559  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Helper thread exiting");
560  RunEpilog();
561 }
ChannelInfo
Definition: channelinfo.h:31
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:101
TVBrowseHelper::m_dbChannumToChanids
QMultiMap< QString, uint > m_dbChannumToChanids
Definition: tvbrowsehelper.h:81
BROWSE_LEFT
@ BROWSE_LEFT
Fetch information on current channel in the past.
Definition: tv.h:43
PlayerContext::m_lastCardid
int m_lastCardid
CardID of current/last recorder.
Definition: playercontext.h:124
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
OSD_WIN_BROWSE
static constexpr const char * OSD_WIN_BROWSE
Definition: osd.h:34
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:283
TVBrowseHelper::BrowseEnd
void BrowseEnd(bool ChangeChannel)
Ends channel browsing.
Definition: tvbrowsehelper.cpp:117
BROWSE_UP
@ BROWSE_UP
Fetch information on previous channel.
Definition: tv.h:41
PlayerContext::UnlockPlayingInfo
void UnlockPlayingInfo(const char *file, int line) const
Definition: playercontext.cpp:245
ChannelGroup::GetChannelGroupName
static QString GetChannelGroupName(int grpid)
Definition: channelgroup.cpp:374
BrowseInfo::m_chanNum
QString m_chanNum
Definition: tvbrowsehelper.h:38
TVBrowseHelper::~TVBrowseHelper
~TVBrowseHelper() override
Definition: tvbrowsehelper.cpp:34
CHANNEL_DIRECTION_DOWN
@ CHANNEL_DIRECTION_DOWN
Definition: tv.h:31
ChannelChangeDirection
ChannelChangeDirection
ChannelChangeDirection is an enumeration of possible channel changing directions.
Definition: tv.h:28
CHANNEL_DIRECTION_UP
@ CHANNEL_DIRECTION_UP
Definition: tv.h:30
TVBrowseHelper::m_browseStartTime
QString m_browseStartTime
Definition: tvbrowsehelper.h:86
TVBrowseHelper::TVBrowseHelper
TVBrowseHelper(TV *Parent)
Definition: tvbrowsehelper.cpp:28
MThread::wait
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:300
BrowseInfo::m_chanId
uint m_chanId
Definition: tvbrowsehelper.h:39
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
TV::kBrowseTimeout
static const std::chrono::milliseconds kBrowseTimeout
Definition: tv_play.h:746
TVBrowseHelper::m_browseTimerId
int m_browseTimerId
Definition: tvbrowsehelper.h:65
ProgramInfo::GetChanNum
QString GetChanNum(void) const
This is the channel "number", in the form 1, 1_2, 1-2, 1#1, etc.
Definition: programinfo.h:376
AutoDeleteDeque::empty
bool empty(void) const
Definition: autodeletedeque.h:66
RemoteEncoder::GetNextProgram
void GetNextProgram(int direction, QString &title, QString &subtitle, QString &desc, QString &category, QString &starttime, QString &endtime, QString &callsign, QString &iconpath, QString &channelname, QString &chanid, QString &seriesid, QString &programid)
Returns information about the program that would be seen if we changed the channel using ChangeChanne...
Definition: remoteencoder.cpp:693
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1346
TVBrowseHelper::m_dbChanidToSourceid
QHash< uint, uint > m_dbChanidToSourceid
Definition: tvbrowsehelper.h:80
TV::ChangeChannel
void ChangeChannel(const ChannelInfoList &Options)
Definition: tv_play.cpp:6114
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MThread::RunProlog
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:196
TVBrowseHelper::m_browseChanNum
QString m_browseChanNum
Definition: tvbrowsehelper.h:84
TV::ClearOSD
void ClearOSD()
Definition: tv_play.cpp:6175
TVBrowseHelper::GetBrowseChanId
uint GetBrowseChanId(const QString &Channum, uint PrefCardid, uint PrefSourceid) const
Returns a chanid for the channum, or 0 if none is available.
Definition: tvbrowsehelper.cpp:214
ChannelUtil::GetNextChannel
static uint GetNextChannel(const ChannelInfoList &sorted, uint old_chanid, uint mplexid_restriction, uint chanid_restriction, ChannelChangeDirection direction, bool skip_non_visible=true, bool skip_same_channum_and_callsign=false, bool skip_other_sources=false)
Definition: channelutil.cpp:2357
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ChannelUtil::SortChannels
static void SortChannels(ChannelInfoList &list, const QString &order, bool eliminate_duplicates=false)
Definition: channelutil.cpp:2300
BROWSE_INVALID
@ BROWSE_INVALID
Definition: tv.h:39
tvbrowsehelper.h
TVBrowseHelper::BrowseWait
void BrowseWait()
Definition: tvbrowsehelper.cpp:70
TV::GetOSDL
OSD * GetOSDL()
Definition: tv_play.cpp:10067
TV::m_channelGroupChannelList
ChannelInfoList m_channelGroupChannelList
Definition: tv_play.h:665
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:390
mythlogging.h
TVBrowseHelper::GetNextProgram
void GetNextProgram(BrowseDirection Direction, InfoMap &Infomap) const
Fetches information on the desired program from the backend.
Definition: tvbrowsehelper.cpp:250
PlayerContext::m_playingInfo
ProgramInfo * m_playingInfo
Currently playing info.
Definition: playercontext.h:121
TVBrowseHelper::m_dbChanidToChannum
QHash< uint, QString > m_dbChanidToChannum
Definition: tvbrowsehelper.h:79
PlayerContext::LockPlayingInfo
void LockPlayingInfo(const char *file, int line) const
Definition: playercontext.cpp:233
TV::StartTimer
int StartTimer(std::chrono::milliseconds Interval, int Line)
Definition: tv_play.cpp:2635
TV::KillTimer
void KillTimer(int Id)
Definition: tv_play.cpp:2643
BrowseAllTuners
static HostCheckBoxSetting * BrowseAllTuners()
Definition: globalsettings.cpp:1728
TVBrowseHelper::m_dbUseChannelGroups
bool m_dbUseChannelGroups
Definition: tvbrowsehelper.h:78
TVBrowseHelper::BrowseInit
void BrowseInit(std::chrono::seconds BrowseMaxForward, bool BrowseAllTuners, bool UseChannelGroups, const QString &DBChannelOrdering)
Definition: tvbrowsehelper.cpp:40
TVBrowseHelper::m_dbBrowseAllTuners
bool m_dbBrowseAllTuners
Definition: tvbrowsehelper.h:77
MThread::RunEpilog
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:209
ProgramInfo::ToMap
virtual void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10, uint date_format=0) const
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
Definition: programinfo.cpp:1542
TV::IsTunable
static bool IsTunable(uint ChanId)
Definition: tv_play.cpp:6638
TVBrowseHelper::BrowseStop
void BrowseStop()
Definition: tvbrowsehelper.cpp:62
UpdateBrowseInfoEvent
Definition: mythevent.h:119
TVBrowseHelper::GetNextProgramDB
void GetNextProgramDB(BrowseDirection Direction, InfoMap &Infomap) const
Definition: tvbrowsehelper.cpp:322
TVBrowseHelper::m_browseRun
bool m_browseRun
Definition: tvbrowsehelper.h:87
TVBrowseHelper::m_browseChanId
uint m_browseChanId
Definition: tvbrowsehelper.h:85
ChannelUtil::GetChannels
static ChannelInfoList GetChannels(uint sourceid, bool visible_only, const QString &group_by=QString(), uint channel_groupid=0)
Definition: channelutil.h:243
CHANNEL_DIRECTION_FAVORITE
@ CHANNEL_DIRECTION_FAVORITE
Definition: tv.h:32
uint
unsigned int uint
Definition: compat.h:79
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:54
BROWSE_DOWN
@ BROWSE_DOWN
Fetch information on next channel.
Definition: tv.h:42
TVBrowseHelper::BrowseDispInfo
void BrowseDispInfo(const BrowseInfo &Browseinfo)
Definition: tvbrowsehelper.cpp:142
BROWSE_RIGHT
@ BROWSE_RIGHT
Fetch information on current channel in the future.
Definition: tv.h:44
channelutil.h
TVBrowseHelper::GetBrowsedInfo
BrowseInfo GetBrowsedInfo() const
Definition: tvbrowsehelper.cpp:197
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:26
AutoDeleteDeque< ProgramInfo * >
BROWSE_FAVORITE
@ BROWSE_FAVORITE
Fetch information on the next favorite channel.
Definition: tv.h:45
TV::ReturnOSDLock
void ReturnOSDLock() const
Definition: tv_play.cpp:10085
recordinginfo.h
TVBrowseHelper::m_browseWait
QWaitCondition m_browseWait
Definition: tvbrowsehelper.h:88
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:372
TVBrowseHelper::m_browseLock
QMutex m_browseLock
Definition: tvbrowsehelper.h:83
TV::ReturnPlayerLock
void ReturnPlayerLock() const
Definition: tv_play.cpp:10102
Channum
Definition: channelsettings.cpp:57
BrowseInfo
Definition: tvbrowsehelper.h:23
format_time
static void format_time(int seconds, QString &tMin, QString &tHrsMin)
Definition: tvbrowsehelper.cpp:18
ChannelUtil::GetIcon
static QString GetIcon(uint chanid)
Definition: channelutil.cpp:1245
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
mythcorecontext.h
cardutil.h
playercontext.h
TV::GetPlayerContext
PlayerContext * GetPlayerContext()
Return a pointer to TV::m_playerContext.
Definition: tv_play.cpp:160
TVBrowseHelper::m_dbAllVisibleChannels
ChannelInfoList m_dbAllVisibleChannels
Definition: tvbrowsehelper.h:75
TV::m_channelGroupId
volatile int m_channelGroupId
Definition: tv_play.h:664
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:17
LoadFromProgram
bool LoadFromProgram(ProgramList &destination, const QString &where, const QString &groupBy, const QString &orderBy, const MSqlBindings &bindings, const ProgramList &schedList)
Definition: programinfo.cpp:5642
LOC
#define LOC
Definition: tvbrowsehelper.cpp:16
BROWSE_SAME
@ BROWSE_SAME
Fetch browse information on current channel and time.
Definition: tv.h:40
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
CardUtil::GetSourceID
static uint GetSourceID(uint inputid)
Definition: cardutil.cpp:1904
OSD::HideWindow
void HideWindow(const QString &Window) override
Definition: osd.cpp:672
TVBrowseHelper::m_parent
TV * m_parent
Definition: tvbrowsehelper.h:73
TV::m_channelGroupLock
QMutex m_channelGroupLock
Lock necessary when modifying channel group variables.
Definition: tv_play.h:663
PlayerContext
Definition: playercontext.h:53
remoteencoder.h
TVBrowseHelper::BrowseChannel
void BrowseChannel(const QString &Channum)
Definition: tvbrowsehelper.cpp:167
BrowseInfo::m_dir
BrowseDirection m_dir
Definition: tvbrowsehelper.h:37
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
TVBrowseHelper::m_browseList
QList< BrowseInfo > m_browseList
Definition: tvbrowsehelper.h:89
BrowseDirection
BrowseDirection
Used to request ProgramInfo for channel browsing.
Definition: tv.h:37
TV::GetPlayerReadLock
void GetPlayerReadLock() const
Definition: tv_play.cpp:10097
PlayerContext::m_recorder
RemoteEncoder * m_recorder
Definition: playercontext.h:118
MythDate::kTime
@ kTime
Default local time.
Definition: mythdate.h:22
CHANNEL_DIRECTION_SAME
@ CHANNEL_DIRECTION_SAME
Definition: tv.h:33
TVBrowseHelper::BrowseStart
bool BrowseStart(bool SkipBrowse=false)
Begins channel browsing.
Definition: tvbrowsehelper.cpp:77
OSD
Definition: osd.h:93
TVBrowseHelper::m_dbAllChannels
ChannelInfoList m_dbAllChannels
Definition: tvbrowsehelper.h:74
TVBrowseHelper::m_dbBrowseMaxForward
std::chrono::seconds m_dbBrowseMaxForward
Definition: tvbrowsehelper.h:76
AutoDeleteDeque::size
size_t size(void) const
Definition: autodeletedeque.h:67
TVBrowseHelper::run
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: tvbrowsehelper.cpp:398
tv_play.h
BrowseInfo::m_startTime
QString m_startTime
Definition: tvbrowsehelper.h:40
TV
Control TV playback.
Definition: tv_play.h:154