Skip to content

Commit

Permalink
Support IRC, AIM, ICQ in shoutcast broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
qiubit committed Jun 29, 2018
1 parent 35fa2e3 commit cf760c9
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 21 deletions.
18 changes: 18 additions & 0 deletions src/engine/sidechain/shoutconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ void ShoutConnection::updateFromPreferences() {
QByteArray baStreamWebsite = encodeString(m_pProfile->getStreamWebsite());
QByteArray baStreamDesc = encodeString(m_pProfile->getStreamDesc());
QByteArray baStreamGenre = encodeString(m_pProfile->getStreamGenre());
QByteArray baStreamIRC = encodeString(m_pProfile->getStreamIRC());
QByteArray baStreamAIM = encodeString(m_pProfile->getStreamAIM());
QByteArray baStreamICQ = encodeString(m_pProfile->getStreamICQ());

// Whether the stream is public.
bool streamPublic = m_pProfile->getStreamPublic();
Expand Down Expand Up @@ -309,6 +312,21 @@ void ShoutConnection::updateFromPreferences() {
return;
}

if (shout_set_meta(m_pShout, SHOUT_META_IRC, baStreamIRC.constData()) != SHOUTERR_SUCCESS) {
errorDialog(tr("Error setting stream IRC!"), shout_get_error(m_pShout));
return;
}

if (shout_set_meta(m_pShout, SHOUT_META_AIM, baStreamAIM.constData()) != SHOUTERR_SUCCESS) {
errorDialog(tr("Error setting stream AIM!"), shout_get_error(m_pShout));
return;
}

if (shout_set_meta(m_pShout, SHOUT_META_ICQ, baStreamICQ.constData()) != SHOUTERR_SUCCESS) {
errorDialog(tr("Error setting stream ICQ!"), shout_get_error(m_pShout));
return;
}

if (shout_set_public(m_pShout, streamPublic ? 1 : 0) != SHOUTERR_SUCCESS) {
errorDialog(tr("Error setting stream public!"), shout_get_error(m_pShout));
return;
Expand Down
42 changes: 42 additions & 0 deletions src/preferences/broadcastprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ const char* kServertype = "Servertype";
const char* kStreamDesc = "StreamDesc";
const char* kStreamGenre = "StreamGenre";
const char* kStreamName = "StreamName";
const char* kStreamIRC = "StreamIRC";
const char* kStreamAIM = "StreamAIM";
const char* kStreamICQ = "StreamICQ";
const char* kStreamPublic = "StreamPublic";
const char* kStreamWebsite = "StreamWebsite";

Expand Down Expand Up @@ -146,6 +149,9 @@ bool BroadcastProfile::valuesEquals(BroadcastProfilePtr other) {
&& getStreamGenre() == other->getStreamGenre()
&& getStreamPublic() == other->getStreamPublic()
&& getStreamWebsite() == other->getStreamWebsite()
&& getStreamIRC() == other->getStreamIRC()
&& getStreamAIM() == other->getStreamAIM()
&& getStreamICQ() == other->getStreamICQ()
&& getEnableMetadata() == other->getEnableMetadata()
&& getMetadataCharset() == other->getMetadataCharset()
&& getCustomArtist() == other->getCustomArtist()
Expand Down Expand Up @@ -194,6 +200,9 @@ void BroadcastProfile::copyValuesTo(BroadcastProfilePtr other) {
other->setStreamGenre(this->getStreamGenre());
other->setStreamPublic(this->getStreamPublic());
other->setStreamWebsite(this->getStreamWebsite());
other->setStreamIRC(this->getStreamIRC());
other->setStreamAIM(this->getStreamAIM());
other->setStreamICQ(this->getStreamICQ());

other->setEnableMetadata(this->getEnableMetadata());
other->setMetadataCharset(this->getMetadataCharset());
Expand Down Expand Up @@ -225,6 +234,9 @@ void BroadcastProfile::adoptDefaultValues() {
m_streamName = QString();
m_streamPublic = kDefaultStreamPublic;
m_streamWebsite = MIXXX_WEBSITE_URL;
m_streamIRC = QString();
m_streamAIM = QString();
m_streamICQ = QString();

m_enableMetadata = kDefaultEnableMetadata;
m_metadataCharset = QString();
Expand Down Expand Up @@ -288,6 +300,9 @@ bool BroadcastProfile::loadValues(const QString& filename) {
m_streamGenre = XmlParse::selectNodeQString(doc, kStreamGenre);
m_streamPublic = (bool)XmlParse::selectNodeInt(doc, kStreamPublic);
m_streamWebsite = XmlParse::selectNodeQString(doc, kStreamWebsite);
m_streamIRC = XmlParse::selectNodeQString(doc, kStreamIRC);
m_streamAIM = XmlParse::selectNodeQString(doc, kStreamAIM);
m_streamICQ = XmlParse::selectNodeQString(doc, kStreamICQ);

m_format = XmlParse::selectNodeQString(doc, kFormat);
m_bitrate = XmlParse::selectNodeInt(doc, kBitrate);
Expand Down Expand Up @@ -346,6 +361,9 @@ bool BroadcastProfile::save(const QString& filename) {
XmlParse::addElement(doc, docRoot, kStreamPublic,
QString::number((int)m_streamPublic));
XmlParse::addElement(doc, docRoot, kStreamWebsite, m_streamWebsite);
XmlParse::addElement(doc, docRoot, kStreamIRC, m_streamIRC);
XmlParse::addElement(doc, docRoot, kStreamAIM, m_streamAIM);
XmlParse::addElement(doc, docRoot, kStreamICQ, m_streamICQ);

XmlParse::addElement(doc, docRoot, kFormat, m_format);
XmlParse::addElement(doc, docRoot, kBitrate,
Expand Down Expand Up @@ -640,6 +658,30 @@ void BroadcastProfile::setStreamWebsite(const QString& value) {
m_streamWebsite = QString(value);
}

QString BroadcastProfile::getStreamIRC() const {
return m_streamIRC;
}

void BroadcastProfile::setStreamIRC(const QString& value) {
m_streamIRC = QString(value);
}

QString BroadcastProfile::getStreamAIM() const {
return m_streamAIM;
}

void BroadcastProfile::setStreamAIM(const QString& value) {
m_streamAIM = QString(value);
}

QString BroadcastProfile::getStreamICQ() const {
return m_streamICQ;
}

void BroadcastProfile::setStreamICQ(const QString& value) {
m_streamICQ = QString(value);
}

QString BroadcastProfile::getFormat() const {
return m_format;
}
Expand Down
12 changes: 12 additions & 0 deletions src/preferences/broadcastprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ class BroadcastProfile : public QObject {
QString getStreamWebsite() const;
void setStreamWebsite(const QString& value);

QString getStreamIRC() const;
void setStreamIRC(const QString& value);

QString getStreamAIM() const;
void setStreamAIM(const QString& value);

QString getStreamICQ() const;
void setStreamICQ(const QString& value);

bool getEnableMetadata() const;
void setEnableMetadata(bool value);

Expand Down Expand Up @@ -169,6 +178,9 @@ class BroadcastProfile : public QObject {
QString m_streamGenre;
bool m_streamPublic;
QString m_streamWebsite;
QString m_streamIRC;
QString m_streamAIM;
QString m_streamICQ;

QString m_format;
int m_bitrate;
Expand Down
12 changes: 12 additions & 0 deletions src/preferences/dialog/dlgprefbroadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,15 @@ void DlgPrefBroadcast::getValuesFromProfile(BroadcastProfilePtr profile) {
// Stream website
stream_website->setText(profile->getStreamWebsite());

// Stream IRC
stream_IRC->setText(profile->getStreamIRC());

// Stream AIM
stream_AIM->setText(profile->getStreamAIM());

// Stream ICQ
stream_ICQ->setText(profile->getStreamICQ());

// Stream description
stream_desc->setText(profile->getStreamDesc());

Expand Down Expand Up @@ -470,6 +479,9 @@ void DlgPrefBroadcast::setValuesToProfile(BroadcastProfilePtr profile) {
profile->setMaximumRetries(spinBoxMaximumRetries->value());
profile->setStreamName(stream_name->text());
profile->setStreamWebsite(stream_website->text());
profile->setStreamIRC(stream_IRC->text());
profile->setStreamAIM(stream_AIM->text());
profile->setStreamICQ(stream_ICQ->text());
profile->setStreamDesc(stream_desc->toPlainText());
profile->setStreamGenre(stream_genre->text());
profile->setStreamPublic(stream_public->isChecked());
Expand Down
72 changes: 51 additions & 21 deletions src/preferences/dialog/dlgprefbroadcastdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>731</width>
<height>897</height>
<width>715</width>
<height>1012</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -131,22 +131,6 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBoxProfileSettings">
<property name="title">
Expand Down Expand Up @@ -492,6 +476,20 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout">
<item row="7" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>ICQ</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>AIM</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="stream_name">
<property name="sizePolicy">
Expand Down Expand Up @@ -593,9 +591,9 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -635,6 +633,22 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>IRC</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="stream_IRC"/>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="stream_AIM"/>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="stream_ICQ"/>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -831,6 +845,22 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
Expand Down

0 comments on commit cf760c9

Please sign in to comment.