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