Skip to content

Commit

Permalink
IPTV URL in Channel Editor
Browse files Browse the repository at this point in the history
In the mythtv-setup Channel Editor add inspection and modification
of field url in table iptv_channel. This field contains the URL for
streaming as used by the IPTV capture card.
The URL data can be obtained with a "M3U Import" from an M3U file defined in
the IPTV capture card or with a "HDHomeRun Channel Import" where an XML file
with channel data from the HDHomeRun is loaded.
  • Loading branch information
kmdewaal committed May 17, 2023
1 parent 4efd8a3 commit b2f4d67
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
51 changes: 51 additions & 0 deletions mythtv/libs/libmythtv/channelsettings.cpp
Expand Up @@ -40,6 +40,30 @@ QString ChannelDBStorage::GetSetClause(MSqlBindings &bindings) const
return query;
}

QString IPTVChannelDBStorage::GetWhereClause(MSqlBindings &bindings) const
{
QString fieldTag = (":WHERE" + m_id.getField().toUpper());
QString query(m_id.getField() + " = " + fieldTag);

bindings.insert(fieldTag, m_id.getValue());

return query;
}

QString IPTVChannelDBStorage::GetSetClause(MSqlBindings &bindings) const
{
QString fieldTag = (":SET" + m_id.getField().toUpper());
QString nameTag = (":SET" + GetColumnName().toUpper());

QString query(m_id.getField() + " = " + fieldTag + ", " +
GetColumnName() + " = " + nameTag);

bindings.insert(fieldTag, m_id.getValue());
bindings.insert(nameTag, m_user->GetDBValue());

return query;
}

/*****************************************************************************
Channel Options - Common
*****************************************************************************/
Expand Down Expand Up @@ -431,6 +455,23 @@ class OnAirGuide : public MythUICheckBoxSetting
}
};

/*****************************************************************************
Channel Options - IPTV
*****************************************************************************/
class ChannelURL : public MythUITextEditSetting
{
public:
explicit ChannelURL(const ChannelID &id) :
MythUITextEditSetting(new IPTVChannelDBStorage(this, id, "url"))
{
setLabel(QCoreApplication::translate("(ChannelSettings)", "URL"));
setHelpText(QCoreApplication::translate("(ChannelSettings)",
"URL for streaming of this channel. Used by the IPTV "
"capture card and obtained with an \"M3U Import\" or "
"with a \"HDHomeRun Channel Import\" loading of an XML file."));
}
};

/*****************************************************************************
Channel Options - Video 4 Linux
*****************************************************************************/
Expand Down Expand Up @@ -645,6 +686,16 @@ ChannelOptionsFilters::ChannelOptionsFilters(const ChannelID& id)
addChild(new OutputFilters(id));
}

ChannelOptionsIPTV::ChannelOptionsIPTV(const ChannelID& id)
{
setLabel(QCoreApplication::translate("(ChannelSettings)",
"Channel Options - IPTV"));

addChild(new Name(id));
addChild(new Channum(id));
addChild(new ChannelURL(id));
}

ChannelOptionsV4L::ChannelOptionsV4L(const ChannelID& id)
{
setLabel(QCoreApplication::translate("(ChannelSettings)",
Expand Down
18 changes: 18 additions & 0 deletions mythtv/libs/libmythtv/channelsettings.h
Expand Up @@ -104,6 +104,18 @@ class ChannelDBStorage : public SimpleDBStorage
const ChannelID& m_id;
};

class IPTVChannelDBStorage : public SimpleDBStorage
{
public:
IPTVChannelDBStorage(StorageUser *_user, const ChannelID &_id, const QString& _name) :
SimpleDBStorage(_user, "iptv_channel", _name), m_id(_id) { }

QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage
QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage

const ChannelID& m_id;
};

class OnAirGuide;
class XmltvID;
class Freqid;
Expand Down Expand Up @@ -136,6 +148,12 @@ class MTV_PUBLIC ChannelOptionsFilters: public GroupSetting
explicit ChannelOptionsFilters(const ChannelID& id);
};

class MTV_PUBLIC ChannelOptionsIPTV: public GroupSetting
{
public:
explicit ChannelOptionsIPTV(const ChannelID& id);
};

class MTV_PUBLIC ChannelOptionsV4L: public GroupSetting
{
public:
Expand Down

0 comments on commit b2f4d67

Please sign in to comment.