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(std::chrono::seconds 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 
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  {
345  chanid,
346  0 /* mplexid_restriction */,
347  0 /* chanid restriction */,
348  static_cast<ChannelChangeDirection>(chandir),
349  true /* skip non visible */,
350  true /* skip_same_channum_and_callsign */,
351  true /* skip_other_sources */);
352  }
353 
354  Infomap["chanid"] = QString::number(chanid);
355  Infomap["channum"] = m_dbChanidToChannum[chanid];
356 
357  QDateTime nowtime = MythDate::current();
358  QDateTime latesttime = nowtime.addSecs(6*60*60);
359  QDateTime browsetime = MythDate::fromString(Infomap["dbstarttime"]);
360 
361  MSqlBindings bindings;
362  bindings[":CHANID"] = chanid;
363  bindings[":NOWTS"] = nowtime;
364  bindings[":LATESTTS"] = latesttime;
365  bindings[":BROWSETS"] = browsetime;
366  bindings[":BROWSETS2"] = browsetime;
367 
368  QString querystr = " WHERE program.chanid = :CHANID ";
369  switch (direction)
370  {
371  case BROWSE_LEFT:
372  querystr += " AND program.endtime <= :BROWSETS AND program.endtime > :NOWTS ";
373  break;
374  case BROWSE_RIGHT:
375  querystr += " AND program.starttime > :BROWSETS AND program.starttime < :LATESTTS ";
376  break;
377  default:
378  querystr += " AND program.starttime <= :BROWSETS AND program.endtime > :BROWSETS2 ";
379  };
380 
381  ProgramList progList;
382  ProgramList dummySched;
383  LoadFromProgram(progList, querystr, bindings, dummySched);
384 
385  if (progList.empty())
386  {
387  Infomap["dbstarttime"] = "";
388  return;
389  }
390 
391  const ProgramInfo* prog = (direction == BROWSE_LEFT) ?
392  progList[static_cast<uint>(progList.size() - 1)] : progList[0];
393  Infomap["dbstarttime"] = prog->GetScheduledStartTime(MythDate::ISODate);
394 }
395 
397 {
398  RunProlog();
399  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Helper thread starting");
400  QMutexLocker locker(&m_browseLock);
401  while (true)
402  {
403  while (m_browseList.empty() && m_browseRun)
404  m_browseWait.wait(&m_browseLock);
405 
406  if (!m_browseRun)
407  break;
408 
409  BrowseInfo bi = m_browseList.front();
410  m_browseList.pop_front();
411 
412  std::vector<uint> chanids;
413  if (BROWSE_SAME == bi.m_dir)
414  {
415  if (!bi.m_chanId)
416  {
417  std::vector<uint> chanids_extra;
419  QMultiMap<QString,uint>::iterator it;
420  it = m_dbChannumToChanids.lowerBound(bi.m_chanNum);
421  for ( ; (it != m_dbChannumToChanids.end()) &&
422  (it.key() == bi.m_chanNum); ++it)
423  {
424  if (m_dbChanidToSourceid[*it] == sourceid)
425  chanids.push_back(*it);
426  else
427  chanids_extra.push_back(*it);
428  }
429  chanids.insert(chanids.end(),
430  chanids_extra.begin(),
431  chanids_extra.end());
432  }
434  m_browseChanId = (chanids.empty()) ? bi.m_chanId : chanids[0];
436  }
437 
438  BrowseDirection direction = bi.m_dir;
439 
440  QDateTime lasttime = MythDate::fromString(m_browseStartTime);
441  QDateTime curtime = MythDate::current();
442  if (lasttime < curtime)
443  m_browseStartTime = curtime.toString(Qt::ISODate);
444 
445  QDateTime maxtime = curtime.addSecs(m_dbBrowseMaxForward.count());
446  if ((lasttime > maxtime) && (direction == BROWSE_RIGHT))
447  continue;
448 
449  m_browseLock.unlock();
450 
451  // if browsing channel groups is enabled or
452  // direction if BROWSE_FAVORITES
453  // Then pick the next channel in the channel group list to browse
454  // If channel group is ALL CHANNELS (-1), then bypass picking from
455  // the channel group list
456  if ((m_dbUseChannelGroups || (direction == BROWSE_FAVORITE)) &&
457  (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT) &&
458  (direction != BROWSE_SAME))
459  {
461  if (m_parent->m_channelGroupId > -1)
462  {
464  if ((direction == BROWSE_UP) || (direction == BROWSE_FAVORITE))
465  dir = CHANNEL_DIRECTION_UP;
466  else if (direction == BROWSE_DOWN)
468 
470  direction = BROWSE_SAME;
471 
472  m_parent->m_channelGroupLock.unlock();
473 
474  m_browseLock.lock();
475  m_browseChanId = chanid;
476  m_browseChanNum.clear();
477  m_browseLock.unlock();
478  }
479  else
480  {
481  m_parent->m_channelGroupLock.unlock();
482  }
483  }
484 
485  if (direction == BROWSE_FAVORITE)
486  direction = BROWSE_UP;
487 
488  InfoMap infoMap;
489  infoMap["dbstarttime"] = m_browseStartTime;
490  infoMap["channum"] = m_browseChanNum;
491  infoMap["chanid"] = QString::number(m_browseChanId);
492 
494 
495  if (!m_dbBrowseAllTuners)
496  {
497  GetNextProgram(direction, infoMap);
498  }
499  else
500  {
501  if (!chanids.empty())
502  {
503  auto tunable = [](uint chanid) { return TV::IsTunable(chanid); };
504  auto it = std::find_if(chanids.cbegin(), chanids.cend(), tunable);
505  if (it != chanids.cend())
506  {
507  infoMap["chanid"] = QString::number(*it);
508  GetNextProgramDB(direction, infoMap);
509  }
510  }
511  else
512  {
513  uint orig_chanid = infoMap["chanid"].toUInt();
514  GetNextProgramDB(direction, infoMap);
515  while (!TV::IsTunable(infoMap["chanid"].toUInt()) &&
516  (infoMap["chanid"].toUInt() != orig_chanid))
517  {
518  GetNextProgramDB(direction, infoMap);
519  }
520  }
521  }
523 
524  m_browseLock.lock();
525 
526  m_browseChanNum = infoMap["channum"];
527  m_browseChanId = infoMap["chanid"].toUInt();
528 
529  if (((direction == BROWSE_LEFT) || (direction == BROWSE_RIGHT)) &&
530  !infoMap["dbstarttime"].isEmpty())
531  {
532  m_browseStartTime = infoMap["dbstarttime"];
533  }
534 
535  if (!m_browseList.empty())
536  {
537  // send partial info to UI for appearance of responsiveness
538  QCoreApplication::postEvent(m_parent, new UpdateBrowseInfoEvent(infoMap));
539  continue;
540  }
541  m_browseLock.unlock();
542 
543  // pull in additional data from the DB...
545  infoMap["channelgroup"] = ChannelGroup::GetChannelGroupName(m_parent->m_channelGroupId);
546  else
547  infoMap["channelgroup"] = QObject::tr("All channels");
548 
549  QDateTime startts = MythDate::fromString(m_browseStartTime);
550  RecordingInfo recinfo(m_browseChanId, startts, false);
551  recinfo.ToMap(infoMap);
552  infoMap["iconpath"] = ChannelUtil::GetIcon(recinfo.GetChanID());
553 
554  m_browseLock.lock();
555  QCoreApplication::postEvent(m_parent, new UpdateBrowseInfoEvent(infoMap));
556  }
557  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Helper thread exiting");
558  RunEpilog();
559 }
ChannelInfo
Definition: channelinfo.h:31
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:97
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:122
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:286
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:245
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: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:27
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:303
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:744
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:375
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:1372
TVBrowseHelper::m_dbChanidToSourceid
QHash< uint, uint > m_dbChanidToSourceid
Definition: tvbrowsehelper.h:80
TV::ChangeChannel
void ChangeChannel(const ChannelInfoList &Options)
Definition: tv_play.cpp:6144
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:196
TVBrowseHelper::m_browseChanNum
QString m_browseChanNum
Definition: tvbrowsehelper.h:84
TV::ClearOSD
void ClearOSD()
Definition: tv_play.cpp:6205
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
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:2334
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:2277
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:10116
TV::m_channelGroupChannelList
ChannelInfoList m_channelGroupChannelList
Definition: tv_play.h:663
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:389
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:120
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:2646
TV::KillTimer
void KillTimer(int Id)
Definition: tv_play.cpp:2654
BrowseAllTuners
static HostCheckBoxSetting * BrowseAllTuners()
Definition: globalsettings.cpp:1726
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:39
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:1560
TV::IsTunable
static bool IsTunable(uint ChanId)
Definition: tv_play.cpp:6660
TVBrowseHelper::BrowseStop
void BrowseStop()
Definition: tvbrowsehelper.cpp:61
UpdateBrowseInfoEvent
Definition: mythevent.h:118
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:243
CHANNEL_DIRECTION_FAVORITE
@ CHANNEL_DIRECTION_FAVORITE
Definition: tv.h:32
uint
unsigned int uint
Definition: compat.h:144
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
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: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:10134
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:371
TVBrowseHelper::m_browseLock
QMutex m_browseLock
Definition: tvbrowsehelper.h:83
TV::ReturnPlayerLock
void ReturnPlayerLock() const
Definition: tv_play.cpp:10151
Channum
Definition: channelsettings.cpp:56
BrowseInfo
Definition: tvbrowsehelper.h:23
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:1243
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:171
TVBrowseHelper::m_dbAllVisibleChannels
ChannelInfoList m_dbAllVisibleChannels
Definition: tvbrowsehelper.h:75
TV::m_channelGroupId
volatile int m_channelGroupId
Definition: tv_play.h:662
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:5566
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:48
CardUtil::GetSourceID
static uint GetSourceID(uint inputid)
Definition: cardutil.cpp:1844
OSD::HideWindow
void HideWindow(const QString &Window) override
Definition: osd.cpp:669
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:661
PlayerContext
Definition: playercontext.h:52
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: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:10146
PlayerContext::m_recorder
RemoteEncoder * m_recorder
Definition: playercontext.h:117
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:76
OSD
Definition: osd.h:94
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:396
tv_play.h
BrowseInfo::m_startTime
QString m_startTime
Definition: tvbrowsehelper.h:40
TV
Control TV playback.
Definition: tv_play.h:154