MythTV  master
channelgroup.cpp
Go to the documentation of this file.
1 // c++
2 #include <algorithm>
3 
4 // mythtv
5 #include "libmythbase/mythdb.h"
7 
8 #include "channelgroup.h"
9 #include "channelutil.h"
10 #include "sourceutil.h"
11 
12 #define LOC QString("Channel Group: ")
13 
14 inline bool lt_group(const ChannelGroupItem &a, const ChannelGroupItem &b)
15 {
16  return QString::localeAwareCompare(a.m_name, b.m_name) < 0;
17 }
18 
19 bool ChannelGroup::ToggleChannel(uint chanid, int changrpid, bool delete_chan)
20 {
21  // Check if it already exists for that chanid...
23  query.prepare(
24  "SELECT channelgroup.id "
25  "FROM channelgroup "
26  "WHERE channelgroup.chanid = :CHANID AND "
27  "channelgroup.grpid = :GRPID "
28  "LIMIT 1");
29  query.bindValue(":CHANID", chanid);
30  query.bindValue(":GRPID", changrpid);
31 
32  if (!query.exec())
33  {
34  MythDB::DBError("ChannelGroup::ToggleChannel", query);
35  return false;
36  }
37  if (query.next() && delete_chan)
38  {
39  // We have a record...Remove it to toggle...
40  QString id = query.value(0).toString();
41  query.prepare("DELETE FROM channelgroup WHERE id = :CHANID");
42  query.bindValue(":CHANID", id);
43  if (!query.exec())
44  MythDB::DBError("ChannelGroup::ToggleChannel -- delete", query);
45  LOG(VB_GENERAL, LOG_INFO, LOC +
46  QString("Removing channel %1 from group %2.").arg(id).arg(changrpid));
47  }
48  else if (query.size() == 0)
49  {
50  // We have no record...Add one to toggle...
51  query.prepare("INSERT INTO channelgroup (chanid,grpid) "
52  "VALUES (:CHANID, :GRPID)");
53  query.bindValue(":CHANID", chanid);
54  query.bindValue(":GRPID", changrpid);
55  if (!query.exec())
56  MythDB::DBError("ChannelGroup::ToggleChannel -- insert", query);
57  LOG(VB_GENERAL, LOG_INFO, LOC +
58  QString("Adding channel %1 to group %2.")
59  .arg(chanid).arg(changrpid));
60  }
61  else
62  {
63  LOG(VB_GENERAL, LOG_INFO, LOC +
64  QString("Channel %1 already present in group %2.")
65  .arg(chanid).arg(changrpid));
66  }
67 
68  return true;
69 }
70 
71 bool ChannelGroup::AddChannel(uint chanid, int changrpid)
72 {
73  // Make sure the channel group exists
75  query.prepare(
76  "SELECT grpid, name FROM channelgroupnames "
77  "WHERE grpid = :GRPID");
78  query.bindValue(":GRPID", changrpid);
79 
80  if (!query.exec())
81  {
82  MythDB::DBError("ChannelGroup::AddChannel", query);
83  return false;
84  }
85  if (query.size() == 0)
86  {
87  LOG(VB_GENERAL, LOG_INFO, LOC +
88  QString("AddChannel failed to find channel group %1.").arg(changrpid));
89  return false;
90  }
91 
92  query.first();
93  QString groupName = query.value(1).toString();
94 
95  // Make sure the channel exists and is visible
96  query.prepare(
97  "SELECT chanid, name FROM channel "
98  "WHERE chanid = :CHANID "
99  "AND visible > 0 "
100  "AND deleted IS NULL");
101  query.bindValue(":CHANID", chanid);
102 
103  if (!query.exec())
104  {
105  MythDB::DBError("ChannelGroup::AddChannel", query);
106  return false;
107  }
108  if (query.size() == 0)
109  {
110  LOG(VB_GENERAL, LOG_INFO, LOC +
111  QString("AddChannel failed to find channel %1.").arg(chanid));
112  return false;
113  }
114 
115  query.first();
116  QString chanName = query.value(1).toString();
117 
118  // Check if it already exists for that chanid...
119  query.prepare(
120  "SELECT channelgroup.id "
121  "FROM channelgroup "
122  "WHERE channelgroup.chanid = :CHANID AND "
123  "channelgroup.grpid = :GRPID "
124  "LIMIT 1");
125  query.bindValue(":CHANID", chanid);
126  query.bindValue(":GRPID", changrpid);
127 
128  if (!query.exec())
129  {
130  MythDB::DBError("ChannelGroup::AddChannel", query);
131  return false;
132  }
133  if (query.size() == 0)
134  {
135  // We have no record...Add one to toggle...
136  query.prepare("INSERT INTO channelgroup (chanid,grpid) "
137  "VALUES (:CHANID, :GRPID)");
138  query.bindValue(":CHANID", chanid);
139  query.bindValue(":GRPID", changrpid);
140  if (!query.exec())
141  MythDB::DBError("ChannelGroup::AddChannel -- insert", query);
142  LOG(VB_GENERAL, LOG_INFO, LOC +
143  QString("Adding channel %1 to group %2.")
144  .arg(chanName, groupName));
145  }
146 
147  return true;
148 }
149 
150 bool ChannelGroup::DeleteChannel(uint chanid, int changrpid)
151 {
152  // Check if it already exists for that chanid...
153  MSqlQuery query(MSqlQuery::InitCon());
154  query.prepare(
155  "SELECT channelgroup.id "
156  "FROM channelgroup "
157  "WHERE channelgroup.chanid = :CHANID AND "
158  "channelgroup.grpid = :GRPID "
159  "LIMIT 1");
160  query.bindValue(":CHANID", chanid);
161  query.bindValue(":GRPID", changrpid);
162 
163  if (!query.exec())
164  {
165  MythDB::DBError("ChannelGroup::DeleteChannel", query);
166  return false;
167  }
168  if (query.next())
169  {
170  // We have a record...Remove it to toggle...
171  QString id = query.value(0).toString();
172  query.prepare("DELETE FROM channelgroup WHERE id = :CHANID");
173  query.bindValue(":CHANID", id);
174  if (!query.exec())
175  MythDB::DBError("ChannelGroup::DeleteChannel -- delete", query);
176  LOG(VB_GENERAL, LOG_INFO, LOC +
177  QString("Removing channel with id=%1.").arg(id));
178  }
179 
180  return true;
181 }
182 
183 // Create a list of all channel groups that are manually configured
184 //
185 // The channel groups are returned in the following order:
186 // - Favorites
187 // - Manually created channel groups, sorted by name.
188 //
190 {
191  ChannelGroupList list;
192  QString qstr;
193  MSqlQuery query(MSqlQuery::InitCon());
194 
195  // Always the Favorites with group id 1
196  if (includeEmpty)
197  {
198  qstr = "SELECT grpid, name FROM channelgroupnames"
199  " WHERE grpid = 1";
200  }
201  else
202  {
203  qstr = "SELECT DISTINCT t1.grpid, name FROM channelgroupnames t1, channelgroup t2"
204  " WHERE t1.grpid = t2.grpid"
205  " AND t1.grpid = 1";
206  }
207  query.prepare(qstr);
208  if (!query.exec())
209  MythDB::DBError("ChannelGroup::GetChannelGroups Favorites", query);
210  else
211  {
212  if (query.next())
213  {
214  ChannelGroupItem group(query.value(0).toUInt(),
215  query.value(1).toString());
216  list.push_back(group);
217  }
218  }
219 
220  // Then the channel groups that are manually created
221  if (includeEmpty)
222  {
223  qstr = "SELECT grpid, name FROM channelgroupnames"
224  " WHERE name NOT IN (SELECT name FROM videosource)"
225  " AND name <> 'Priority' "
226  " AND grpid <> 1"
227  " ORDER BY NAME";
228  }
229  else
230  {
231  qstr = "SELECT DISTINCT t1.grpid, name FROM channelgroupnames t1, channelgroup t2"
232  " WHERE t1.grpid = t2.grpid"
233  " AND name NOT IN (SELECT name FROM videosource)"
234  " AND name <> 'Priority' "
235  " AND t1.grpid <> 1"
236  " ORDER BY NAME";
237  }
238  query.prepare(qstr);
239  if (!query.exec())
240  MythDB::DBError("ChannelGroup::GetChannelGroups manual", query);
241  else
242  {
243  while (query.next())
244  {
245  ChannelGroupItem group(query.value(0).toUInt(),
246  query.value(1).toString());
247  list.push_back(group);
248  }
249  }
250 
251  return list;
252 }
253 
254 // Create a list of all channel groups that are automatically created
255 //
256 // The channel groups are returned in the following order:
257 // - Priority channels
258 // - Channel groups created automatically from videosources, sorted by name.
259 //
261 {
262  ChannelGroupList list;
263  QString qstr;
264  MSqlQuery query(MSqlQuery::InitCon());
265 
266  // The Priority channel group if it exists
267  if (includeEmpty)
268  {
269  qstr = "SELECT grpid, name FROM channelgroupnames"
270  " WHERE name = 'Priority'";
271  }
272  else
273  {
274  qstr = "SELECT DISTINCT t1.grpid, name FROM channelgroupnames t1, channelgroup t2"
275  " WHERE t1.grpid = t2.grpid "
276  " AND name = 'Priority'";
277  }
278  query.prepare(qstr);
279  if (!query.exec())
280  MythDB::DBError("ChannelGroup::GetChannelGroups Priority", query);
281  else
282  {
283  if (query.next())
284  {
285  ChannelGroupItem group(query.value(0).toUInt(),
286  query.value(1).toString());
287  list.push_back(group);
288  }
289  }
290 
291  // The channel groups that are automatically created from videosources
292  if (includeEmpty)
293  {
294  qstr = "SELECT grpid, name FROM channelgroupnames"
295  " WHERE name IN (SELECT name FROM videosource)"
296  " ORDER BY NAME";
297  }
298  else
299  {
300  qstr = "SELECT DISTINCT t1.grpid, name FROM channelgroupnames t1, channelgroup t2"
301  " WHERE t1.grpid = t2.grpid"
302  " AND name IN (SELECT name FROM videosource)"
303  " ORDER BY NAME";
304  }
305  query.prepare(qstr);
306  if (!query.exec())
307  MythDB::DBError("ChannelGroup::GetChannelGroups videosources", query);
308  else
309  {
310  while (query.next())
311  {
312  ChannelGroupItem group(query.value(0).toUInt(),
313  query.value(1).toString());
314  list.push_back(group);
315  }
316  }
317  return list;
318 }
319 
320 // Create a list of all channel groups
321 //
322 // The channel groups are returned in the following order:
323 // - Favorites
324 // - Manually created channel groups, sorted by name.
325 // - Priority channels
326 // - Channel groups created automatically from videosources, sorted by name.
327 //
329 {
330  ChannelGroupList list = GetManualChannelGroups(includeEmpty);
331  ChannelGroupList more = GetAutomaticChannelGroups(includeEmpty);
332  list.insert(list.end(), more.begin(), more.end());
333  return list;
334 }
335 
336 // Cycle through the available channel groups.
337 // At the end return -1 to select "All Channels".
339 {
340  // If no groups return -1 for "All Channels"
341  if (sorted.empty())
342  return -1;
343 
344  // If grpid is "All Channels" (-1), then return the first grpid
345  if (grpid == -1)
346  return sorted[0].m_grpId;
347 
348  auto it = std::find(sorted.cbegin(), sorted.cend(), grpid);
349 
350  // If grpid is not in the list, return -1 for "All Channels"
351  if (it == sorted.end())
352  return -1;
353 
354  ++it;
355 
356  // If we reached the end, the next option is "All Channels" (-1)
357  if (it == sorted.end())
358  return -1;
359 
360  return it->m_grpId;
361 }
362 
363 bool ChannelGroup::InChannelGroupList(const ChannelGroupList &groupList, int grpid)
364 {
365  auto it = std::find(groupList.cbegin(), groupList.cend(), grpid);
366  return it != groupList.end();
367 }
368 
369 bool ChannelGroup::NotInChannelGroupList(const ChannelGroupList &groupList, int grpid)
370 {
371  return !InChannelGroupList(groupList, grpid);
372 }
373 
375 {
376  // All Channels
377  if (grpid == -1)
378  return tr("All Channels");
379 
380  // No group
381  if (grpid == 0)
382  return "";
383 
384  MSqlQuery query(MSqlQuery::InitCon());
385  query.prepare("SELECT name FROM channelgroupnames WHERE grpid = :GROUPID");
386  query.bindValue(":GROUPID", grpid);
387 
388  if (!query.exec())
389  MythDB::DBError("ChannelGroup::GetChannelGroups", query);
390  else if (query.next())
391  return query.value(0).toString();
392 
393  return "";
394 }
395 
396 int ChannelGroup::GetChannelGroupId(const QString& changroupname)
397 {
398  // All Channels
399  if (changroupname == "All Channels")
400  return -1;
401 
402  MSqlQuery query(MSqlQuery::InitCon());
403 
404  query.prepare("SELECT grpid FROM channelgroupnames "
405  "WHERE name = :GROUPNAME");
406  query.bindValue(":GROUPNAME", changroupname);
407 
408  if (!query.exec())
409  MythDB::DBError("ChannelGroup::GetChannelGroups", query);
410  else if (query.next())
411  return query.value(0).toUInt();
412 
413  return 0;
414 }
415 
416 static void AddChannelGroup(const QString &groupName)
417 {
418  int groupId = ChannelGroup::GetChannelGroupId(groupName);
419  if (groupId == 0)
420  {
421  LOG(VB_GENERAL, LOG_INFO, QString("Add channelgroup %1").arg(groupName));
422 
423  MSqlQuery query(MSqlQuery::InitCon());
424  query.prepare("INSERT INTO channelgroupnames (name) VALUE (:NEWNAME);");
425  query.bindValue(":NEWNAME", groupName);
426 
427  if (!query.exec())
428  MythDB::DBError("AddChannelGroup", query);
429  }
430 }
431 
432 static void RemoveChannelGroup(const QString &groupName)
433 {
434  int groupId = ChannelGroup::GetChannelGroupId(groupName);
435  if (groupId > 0)
436  {
437  // Yes, channelgroup does exist. Remove all existing channels.
438  LOG(VB_GENERAL, LOG_INFO, QString("Remove channels of channelgroup %1").arg(groupName));
439 
440  MSqlQuery query(MSqlQuery::InitCon());
441  query.prepare("DELETE FROM channelgroup WHERE grpid = :GRPID;");
442  query.bindValue(":GRPID", groupId);
443 
444  if (!query.exec())
445  MythDB::DBError("RemoveChannelGroup 1", query);
446 
447  // And also the channelgroupname
448  LOG(VB_GENERAL, LOG_INFO, QString("Remove channelgroup %1").arg(groupName));
449  query.prepare("DELETE FROM channelgroupnames WHERE grpid = :GRPID;");
450  query.bindValue(":GRPID", groupId);
451 
452  if (!query.exec())
453  MythDB::DBError("RemoveChannelGroup 2", query);
454  }
455  else
456  {
457  LOG(VB_GENERAL, LOG_DEBUG, QString("Channelgroup %1 not found").arg(groupName));
458  }
459 }
460 
461 // UpdateChannelGroups
462 //
463 // Create and maintain a channel group for each connected video source
464 // with the name of the video source.
465 // Create and maintain a channel group Priority for
466 // all channels that have a recording priority bigger than 0.
467 //
469 {
470  QMap<int, QString> allSources;
471  QMap<int, QString> connectedSources;
472  QMap<int, QString> disconnectedSources;
473 
474  // Get list of all video sources
475  {
476  MSqlQuery query(MSqlQuery::InitCon());
477  query.prepare("SELECT sourceid,name FROM videosource;");
478  if (query.exec())
479  {
480  while (query.next())
481  allSources[query.value(0).toInt()] = query.value(1).toString();
482  }
483  else
484  MythDB::DBError("UpdateChannelGroups videosource 1", query);
485  }
486 
487  // Split all video sources into a list of video sources that are connected to one
488  // or more capture cards and a list of video sources that are not connected.
489  for (auto it = allSources.cbegin(); it != allSources.cend(); ++it)
490  {
491  uint sourceId = it.key();
492  int count = SourceUtil::GetConnectionCount(sourceId);
493  if (count > 0)
494  connectedSources[sourceId] = allSources[sourceId];
495  else
496  disconnectedSources[sourceId] = allSources[sourceId];
497  }
498 
499  // If there is only one connected video source then we do not need a special
500  // channel group for that video source; it is then the same as "All Channels".
501  QMap<int, QString> removeSources = disconnectedSources;
502  if (connectedSources.size() == 1)
503  {
504  auto it = connectedSources.cbegin();
505  uint sourceid = it.key();
506  removeSources[sourceid] = *it;
507  }
508 
509  // Remove channelgroup channels and the channelgroupname for disconnected video sources.
510  for (const auto &sourceName : qAsConst(removeSources))
511  {
512  RemoveChannelGroup(sourceName);
513  }
514 
515  // Remove all channels that do not exist anymore or that are not visible.
516  // This is done only for the automatic channel groups.
517  {
519  MSqlQuery query(MSqlQuery::InitCon());
520  for (const auto &chgrp : list)
521  {
522  query.prepare(
523  "DELETE from channelgroup WHERE grpid = :GRPID"
524  " AND chanid NOT IN "
525  " (SELECT chanid FROM channel WHERE deleted IS NULL AND visible > 0)");
526  query.bindValue(":GRPID", chgrp.m_grpId);
527  if (!query.exec())
528  {
529  MythDB::DBError("ChannelGroup::UpdateChannelGroups", query);
530  return;
531  }
532  if (query.numRowsAffected() > 0)
533  {
534  LOG(VB_GENERAL, LOG_INFO, QString("Removed %1 channels from channelgroup %2")
535  .arg(query.numRowsAffected()).arg(chgrp.m_grpId));
536  }
537  }
538  }
539 
540  // Create a channel group for each connected video source only if there is
541  // more than one video source configured with a capture card.
542  if (connectedSources.size() > 1)
543  {
544  // Add channelgroupname entry if it does not exist yet
545  for (const auto &sourceName : qAsConst(connectedSources))
546  {
547  AddChannelGroup(sourceName);
548  }
549 
550  // Add all visible channels to the channelgroups
551  for (auto it = connectedSources.cbegin(); it != connectedSources.cend(); ++it)
552  {
553  uint sourceId = it.key();
554  QString sourceName = connectedSources[sourceId];
555  int groupId = ChannelGroup::GetChannelGroupId(sourceName);
556 
557  if (groupId > 0)
558  {
559  LOG(VB_GENERAL, LOG_INFO, QString("Update channelgroup %1").arg(sourceName));
560  MSqlQuery query(MSqlQuery::InitCon());
561  query.prepare(
562  "SELECT chanid FROM channel "
563  "WHERE sourceid = :SOURCEID "
564  "AND deleted IS NULL "
565  "AND visible > 0 ");
566  query.bindValue(":SOURCEID", sourceId);
567  if (!query.exec())
568  {
569  MythDB::DBError("ChannelGroup::UpdateChannelGroups", query);
570  return;
571  }
572  while (query.next())
573  {
574  uint chanId = query.value(0).toUInt();
575  ChannelGroup::AddChannel(chanId, groupId);
576  }
577  }
578  }
579  }
580 
581  // Channelgroup Priority
582 
583  // Find the number of priority channels in all connected video sources
584  uint numPrioChannels = 0;
585  for (auto it = connectedSources.cbegin(); it != connectedSources.cend(); ++it)
586  {
587  uint sourceId = it.key();
588  MSqlQuery query(MSqlQuery::InitCon());
589  query.prepare(
590  "SELECT count(*) FROM channel "
591  "WHERE sourceid = :SOURCEID "
592  "AND deleted IS NULL "
593  "AND visible > 0 "
594  "AND recpriority > 0");
595  query.bindValue(":SOURCEID", sourceId);
596  if (!query.exec())
597  {
598  MythDB::DBError("UpdateChannelGroups Priority select channels", query);
599  return;
600  }
601  if (query.next())
602  {
603  numPrioChannels += query.value(0).toUInt();
604  }
605  }
606  LOG(VB_GENERAL, LOG_INFO, QString("Found %1 priority channels").arg(numPrioChannels));
607 
608  if (numPrioChannels > 0)
609  {
610  // Add channel group for Priority channels
611  QString groupName = "Priority";
612  AddChannelGroup(groupName);
613  LOG(VB_GENERAL, LOG_INFO, QString("Update channelgroup %1").arg(groupName));
614 
615  // Update all channels in channel group Priority
616  int groupId = ChannelGroup::GetChannelGroupId(groupName);
617  if (groupId > 0)
618  {
619  // Remove all channels from channelgroup Priority that do not have priority anymore.
620  MSqlQuery query(MSqlQuery::InitCon());
621  query.prepare(
622  "DELETE from channelgroup WHERE grpid = :GRPID "
623  " AND chanid NOT IN "
624  " (SELECT chanid FROM channel "
625  " WHERE deleted IS NULL "
626  " AND visible > 0 "
627  " AND recpriority > 0)");
628  query.bindValue(":GRPID", groupId);
629  if (!query.exec())
630  {
631  MythDB::DBError("ChannelGroup::UpdateChannelGroups", query);
632  return;
633  }
634  if (query.numRowsAffected() > 0)
635  {
636  LOG(VB_GENERAL, LOG_INFO, QString("Removed %1 channels from channelgroup Priority")
637  .arg(query.numRowsAffected()));
638  }
639 
640  // Add all channels from all connected video groups if they have priority
641  for (auto it = connectedSources.cbegin(); it != connectedSources.cend(); ++it)
642  {
643  uint sourceId = it.key();
644  query.prepare(
645  "SELECT chanid FROM channel "
646  "WHERE sourceid = :SOURCEID "
647  "AND deleted IS NULL "
648  "AND visible > 0 "
649  "AND recpriority > 0");
650  query.bindValue(":SOURCEID", sourceId);
651  if (!query.exec())
652  {
653  MythDB::DBError("UpdateChannelGroups Priority select channels", query);
654  return;
655  }
656  while (query.next())
657  {
658  uint chanId = query.value(0).toUInt();
659  ChannelGroup::AddChannel(chanId, groupId);
660  }
661  }
662  }
663  }
664  else
665  {
666  // No priority channels in connected video sources, so no Priority channel group
667  RemoveChannelGroup("Priority");
668  }
669 }
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:807
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
MSqlQuery::size
int size(void) const
Definition: mythdbcon.h:215
lt_group
bool lt_group(const ChannelGroupItem &a, const ChannelGroupItem &b)
Definition: channelgroup.cpp:14
ChannelGroup::GetChannelGroupName
static QString GetChannelGroupName(int grpid)
Definition: channelgroup.cpp:374
mythdb.h
ChannelGroupItem
Definition: channelgroup.h:15
ChannelGroup::InChannelGroupList
static bool InChannelGroupList(const ChannelGroupList &groupList, int grpid)
Definition: channelgroup.cpp:363
ChannelGroup::AddChannel
static bool AddChannel(uint chanid, int changrpid)
Definition: channelgroup.cpp:71
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:205
ChannelGroup::GetManualChannelGroups
static ChannelGroupList GetManualChannelGroups(bool includeEmpty=true)
Definition: channelgroup.cpp:189
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:608
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
ChannelGroup::GetChannelGroups
static ChannelGroupList GetChannelGroups(bool includeEmpty=true)
Definition: channelgroup.cpp:328
sourceutil.h
mythlogging.h
AddChannelGroup
static void AddChannelGroup(const QString &groupName)
Definition: channelgroup.cpp:416
MSqlQuery::first
bool first(void)
Wrap QSqlQuery::first() so we can display the query results.
Definition: mythdbcon.cpp:817
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:540
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:227
ChannelGroupList
std::vector< ChannelGroupItem > ChannelGroupList
Definition: channelgroup.h:31
uint
unsigned int uint
Definition: compat.h:81
LOC
#define LOC
Definition: channelgroup.cpp:12
ChannelGroupItem::m_name
QString m_name
Definition: channelgroup.h:29
ChannelGroup::NotInChannelGroupList
static bool NotInChannelGroupList(const ChannelGroupList &groupList, int grpid)
Definition: channelgroup.cpp:369
channelutil.h
ChannelGroup::ToggleChannel
static bool ToggleChannel(uint chanid, int changrpid, bool delete_chan)
Definition: channelgroup.cpp:19
ChannelGroup::GetNextChannelGroup
static int GetNextChannelGroup(const ChannelGroupList &sorted, int grpid)
Definition: channelgroup.cpp:338
channelgroup.h
ChannelGroup::GetChannelGroupId
static int GetChannelGroupId(const QString &changroupname)
Definition: channelgroup.cpp:396
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:883
ChannelGroup::UpdateChannelGroups
static void UpdateChannelGroups(void)
Definition: channelgroup.cpp:468
RemoveChannelGroup
static void RemoveChannelGroup(const QString &groupName)
Definition: channelgroup.cpp:432
MSqlQuery::numRowsAffected
int numRowsAffected() const
Definition: mythdbcon.h:218
SourceUtil::GetConnectionCount
static uint GetConnectionCount(uint sourceid)
Definition: sourceutil.cpp:227
ChannelGroup::GetAutomaticChannelGroups
static ChannelGroupList GetAutomaticChannelGroups(bool includeEmpty=true)
Definition: channelgroup.cpp:260
find
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
Definition: dvbstreamhandler.cpp:363
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:832
ChannelGroup::DeleteChannel
static bool DeleteChannel(uint chanid, int changrpid)
Definition: channelgroup.cpp:150