GPodder search
This commit is contained in:
committed by
craig.p.drummond
parent
f0b8209804
commit
9599c27bee
@@ -42,6 +42,7 @@
|
||||
<file alias="cbc">online/icons/cbc.svg</file>
|
||||
<file alias="npr">online/icons/npr.svg</file>
|
||||
<file alias="itunes">online/icons/itunes.svg</file>
|
||||
<file alias="gpodder">online/icons/gpodder.svg</file>
|
||||
<file alias="podcast_directories.xml">online/podcast_directories.xml</file>
|
||||
|
||||
<file alias="digitallyimported">streams/icons/digitallyimported.png</file>
|
||||
|
||||
44
online/icons/gpodder.svg
Normal file
44
online/icons/gpodder.svg
Normal file
@@ -0,0 +1,44 @@
|
||||
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<filter height="1.91511" id="filter3973" width="1.12704" x="-.06352" y="-.45755">
|
||||
<feGaussianBlur stdDeviation="1.078"/>
|
||||
</filter>
|
||||
<linearGradient id="linearGradient5209">
|
||||
<stop offset="0" stop-color="#fff"/>
|
||||
<stop offset="1" stop-color="#fff" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient7462-8">
|
||||
<stop offset="0" stop-color="#fff"/>
|
||||
<stop offset="1" stop-color="#e5e5e5"/>
|
||||
</linearGradient>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5461" x1="16.72341" x2="29.89414" xlink:href="#linearGradient5209" y1="12.17449" y2="30.9062"/>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5463" x1="37.87717" x2="16.16986" xlink:href="#linearGradient5209" y1="13.95532" y2="30.17483"/>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5465" x1="14.22842" x2="33.03559" xlink:href="#linearGradient5209" y1="9.92482" y2="29.44845"/>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" id="linearGradient3940" x1="-61.31361" x2="-60.33789" xlink:href="#linearGradient5209" y1="49.15529" y2="69.28846"/>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" id="linearGradient3942" x1="-59.30152" x2="-61.21298" xlink:href="#linearGradient5209" y1="49.86308" y2="68.12606"/>
|
||||
<radialGradient cx="7.08361" cy="23.56488" gradientTransform="matrix(-3.442732,-.964236,.539404,-1.925888,19.34944,75.83522)" gradientUnits="userSpaceOnUse" id="radialGradient3934" r=".81757">
|
||||
<stop offset="0"/>
|
||||
<stop offset="1" stop-color="#6e6e6e"/>
|
||||
</radialGradient>
|
||||
<radialGradient cx="-60.64864" cy="72.83783" gradientTransform="matrix(5.867644,-1.91396e-7,4.885091e-8,1.965199,295.216,-70.303)" gradientUnits="userSpaceOnUse" id="radialGradient3932" r="13.86075" xlink:href="#linearGradient7462-8"/>
|
||||
<radialGradient cx="-60.64864" cy="72.83783" gradientTransform="matrix(5.867644,-1.91396e-7,4.8850908e-8,1.965199,295.216,-70.303)" gradientUnits="userSpaceOnUse" id="radialGradient3936" r="13.86075" xlink:href="#linearGradient7462-8"/>
|
||||
</defs>
|
||||
<path d="m32.70369,42.25476a20.37351,2.82843 0 1,1 -40.74703,0 20.37351,2.82843 0 1,1 40.74703,0z" fill="#2e3436" filter="url(#filter3973)" opacity=".766" transform="matrix(1.003507,0,0,.767101,11.954828,11.354422)"/>
|
||||
<path d="m36.59278,23.07449a11.31371,11.31371 0 1,1 -22.62742,0 11.31371,11.31371 0 1,1 22.62742,0z" fill="#e0c4f4" opacity=".7" stroke="#cfa2ee" stroke-width=".55189" transform="matrix(1.811961,0,0,1.811961,-21.80469,-18.810073)"/>
|
||||
<path d="m36.59278,23.07449a11.31371,11.31371 0 1,1 -22.62742,0 11.31371,11.31371 0 1,1 22.62742,0z" fill="#bd80e8" opacity=".7" stroke="#a34ede" stroke-width=".68986" transform="matrix(1.449569,0,0,1.449569,-12.643751,-11.14593)"/>
|
||||
<path d="m36.59278,23.07449a11.31371,11.31371 0 1,1 -22.62742,0 11.31371,11.31371 0 1,1 22.62742,0z" fill="#a34ede" opacity=".7" stroke="#431266" stroke-width="1.01323" transform="matrix(.986941,0,0,.986941,-.948937,-2.302935)"/>
|
||||
<path d="m25.28125,12.46875c-5.86775,0-10.59375,4.726-10.59375,10.59375s4.726,10.59375 10.59375,10.59375 10.59375-4.726 10.59375-10.59375-4.726-10.59375-10.59375-10.59375z" fill="none" opacity=".4" stroke="url(#linearGradient5461)" stroke-width=".55189" transform="matrix(1.811961,0,0,1.811961,-21.71333,-18.973547)"/>
|
||||
<path d="m25.28125,12.6875c-5.73629,0-10.375,4.63871-10.375,10.375s4.63871,10.375 10.375,10.375 10.375-4.63871 10.375-10.375-4.63871-10.375-10.375-10.375z" fill="none" opacity=".4" stroke="url(#linearGradient5463)" stroke-width=".68986" transform="matrix(1.449569,0,0,1.449569,-12.552391,-11.309404)"/>
|
||||
<path d="m25.28125,13.03125c-5.54956,0-10.03125,4.48169-10.03125,10.03125s4.48169,10.03125 10.03125,10.03125 10.03125-4.48169 10.03125-10.03125-4.48169-10.03125-10.03125-10.03125z" fill="none" opacity=".4" stroke="url(#linearGradient5465)" stroke-width="1.01323" transform="matrix(.986941,0,0,.986941,-.857577,-2.466409)"/>
|
||||
<path d="m19.21,29.94802c-.39129-3.14353-1.18506-20.27163 3.43903-20.44646s5.85636,15.6338 6.30527,19.81033-1.03468,7.92279 8.91147,5.63157c4.41816-1.01778 6.91368-3.46176 6.60882,2.63073s-11.31704,6.27081-16.51972,6.69138c-13.97065.79435-24.59323-.41429-24.4535-3.86666s.31774-4.89768 2.8847-4.42875c17.16121,3.135 13.20433-2.96608 12.82393-6.02215z" fill="#75507b" stroke="#3d2a3f"/>
|
||||
<path d="m22.6875,10.625c-.22804.0086-.37974.08304-.65625.40625s-.58773.90174-.84375,1.65625c-.51204,1.50902-.83854,3.70494-1,6-.32293,4.59012-.01985,9.71029.15625,11.125 .07119.57191.38794,1.54721.5625,2.625s.19625,2.38049-.625,3.5-2.29006,1.77389-4.5,1.96875-5.27814-.01842-9.625-.8125c-.53759-.09821-.82984-.06657-.9375-.03125s-.10087.01979-.1875.1875c-.17327.33543-.33686,1.47327-.40625,3.1875-.00565.13955.02728.24759.1875.4375s.49597.44127 1,.6875c1.00806.49246 2.6526.94504 4.78125,1.25 4.25041.60893 10.35808.70468 17.28125.3125h.03125c2.65276-.21337 6.62246-.37569 9.875-1.1875 1.63164-.40725 3.0699-.98637 4.03125-1.71875s1.47203-1.53533 1.53125-2.71875c.07257-1.4502-.06009-2.32398-.1875-2.625s.0171-.15109-.25-.15625c-.53419-.01032-2.42335.76933-4.78125,1.3125-2.54631.58657-4.38387.82673-5.84375.71875s-2.62359-.63024-3.3125-1.5-.85144-1.89173-.9375-2.875-.08432-1.97753-.1875-2.9375c-.22886-2.12921-.63999-7.08594-1.5625-11.4375-.46126-2.17578-1.05865-4.20127-1.75-5.5625-.34568-.68062-.74314-1.18522-1.0625-1.46875s-.52685-.35337-.78125-.34375z" fill="none" opacity=".4" stroke="#fff"/>
|
||||
<path d="m41.97179,35.43436c-9.83582,5.3149-21.30943,2.99108-36.78257,5.55612 .04297.02008.06087-.13529.10662-.11545 1.00282.43482 2.67344.99245 4.79809,1.26379 4.24931.54269 10.69717.83632 17.6324.4879 6.02102-.29951 11.99384-1.0993 13.7219-2.88144 2.92325-2.48703.14985-5.47877.52356-4.31092z" fill="#fff" fill-rule="evenodd" opacity=".2"/>
|
||||
<path d="m-49.35135,72.83784a11.2973,24.67568 0 1,1 -22.59459,0 11.2973,24.67568 0 1,1 22.59459,0z" fill="url(#radialGradient3932)" stroke="#000" stroke-width="2.47734" transform="matrix(.43405,.020585,-.0182,.374531,45.352591,-2.72605)"/>
|
||||
<path d="m8.17568,23.62162a.81757,1.63514 0 1,1 -1.63514,0 .81757,1.63514 0 1,1 1.63514,0z" fill="url(#radialGradient3934)" transform="matrix(2.079193,.098603,-.099866,2.055162,4.399928,-22.949051)"/>
|
||||
<path d="m-49.35135,72.83784a11.2973,24.67568 0 1,1 -22.59459,0 11.2973,24.67568 0 1,1 22.59459,0z" fill="url(#radialGradient3936)" stroke="#000" stroke-width="2.47734" transform="matrix(.432372,-.043096,.038016,.373064,53.265119,-7.015848)"/>
|
||||
<path d="m8.17568,23.62162a.81757,1.63514 0 1,1 -1.63514,0 .81757,1.63514 0 1,1 1.63514,0z" fill="url(#radialGradient3934)" transform="matrix(2.062721,.276853,-.280469,2.038705,21.992363,-24.267451)"/>
|
||||
<path d="m-49.35135,72.83784a11.2973,24.67568 0 1,1 -22.59459,0 11.2973,24.67568 0 1,1 22.59459,0z" fill="none" opacity=".5" stroke="url(#linearGradient3940)" stroke-width="2.47734" transform="matrix(.43405,.020585,-.0182,.374531,45.352591,-2.72605)"/>
|
||||
<path d="m-49.35135,72.83784a11.2973,24.67568 0 1,1 -22.59459,0 11.2973,24.67568 0 1,1 22.59459,0z" fill="none" opacity=".5" stroke="url(#linearGradient3942)" stroke-width="2.47734" transform="matrix(.432372,-.043096,.038016,.373064,53.265119,-7.015848)"/>
|
||||
<path d="m-.125,19.875a1,1 0 1,1 -2,0 1,1 0 1,1 2,0z" fill-rule="evenodd" opacity=".95" transform="matrix(1.044637,.153842,-.155697,1.032569,21.548487,7.59693)"/>
|
||||
<path d="m-.125,19.875a1,1 0 1,1 -2,0 1,1 0 1,1 2,0z" fill-rule="evenodd" opacity=".95" transform="matrix(.873981,.58605,-.593114,.863885,43.204347,10.578365)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.3 KiB |
@@ -105,7 +105,7 @@ public:
|
||||
void parseResonse(QIODevice *dev)
|
||||
{
|
||||
if (!dev) {
|
||||
MessageBox::error(this, i18n("Failed to fetch podcasts"));
|
||||
MessageBox::error(this, i18n("Failed to fetch podcasts from iTunes"));
|
||||
return;
|
||||
}
|
||||
QJson::Parser parser;
|
||||
@@ -114,11 +114,8 @@ public:
|
||||
MessageBox::error(this, i18n("There was a problem parsing the response from the iTunes Store"));
|
||||
return;
|
||||
}
|
||||
if (data.toMap().contains(QLatin1String("errorMessage"))) {
|
||||
MessageBox::error(this, data.toMap()[QLatin1String("errorMessage")].toString());
|
||||
return;
|
||||
}
|
||||
foreach (const QVariant& resultVariant, data.toMap()[QLatin1String("results")].toList()) {
|
||||
|
||||
foreach (const QVariant &resultVariant, data.toMap()[QLatin1String("results")].toList()) {
|
||||
QVariantMap result(resultVariant.toMap());
|
||||
if (result[QLatin1String("kind")].toString() != QLatin1String("podcast")) {
|
||||
continue;
|
||||
@@ -134,6 +131,56 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class GPodderSearchPage : public PodcastSearchPage
|
||||
{
|
||||
public:
|
||||
GPodderSearchPage(QWidget *p) : PodcastSearchPage(p) { }
|
||||
|
||||
void doSearch()
|
||||
{
|
||||
QString text=search->text().trimmed();
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl url(QLatin1String("http://gpodder.net/search.json"));
|
||||
#if QT_VERSION < 0x050000
|
||||
QUrl &query=url;
|
||||
#else
|
||||
QUrlQuery query;
|
||||
#endif
|
||||
query.addQueryItem(QLatin1String("q"), text);
|
||||
#if QT_VERSION >= 0x050000
|
||||
url.setQuery(query);
|
||||
#endif
|
||||
fetch(url);
|
||||
}
|
||||
|
||||
void parseResonse(QIODevice *dev)
|
||||
{
|
||||
if (!dev) {
|
||||
MessageBox::error(this, i18n("Failed to fetch podcasts from GPodder"));
|
||||
return;
|
||||
}
|
||||
QJson::Parser parser;
|
||||
QVariant data = parser.parse(dev);
|
||||
if (data.isNull()) {
|
||||
MessageBox::error(this, i18n("There was a problem parsing the response from GPodder"));
|
||||
return;
|
||||
}
|
||||
QVariantList list=data.toList();
|
||||
foreach (const QVariant &var, list) {
|
||||
QVariantMap map=var.toMap();
|
||||
addPodcast(map[QLatin1String("title")].toString(),
|
||||
map[QLatin1String("url")].toUrl(),
|
||||
map[QLatin1String("logo_url")].toUrl(),
|
||||
map[QLatin1String("description")].toString(),
|
||||
map[QLatin1String("website")].toString(),
|
||||
0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PodcastPage::PodcastPage(QWidget *p)
|
||||
: QWidget(p)
|
||||
, job(0)
|
||||
@@ -193,6 +240,10 @@ void PodcastPage::cancelImage()
|
||||
|
||||
void PodcastPage::addPodcast(const QString &name, const QUrl &url, const QUrl &image, const QString &description, const QString &webPage, QTreeWidgetItem *p)
|
||||
{
|
||||
if (name.isEmpty() || url.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *podItem=p ? new QTreeWidgetItem(p, QStringList() << name)
|
||||
: new QTreeWidgetItem(tree, QStringList() << name);
|
||||
|
||||
@@ -454,12 +505,15 @@ PodcastSearchDialog::PodcastSearchDialog(QWidget *parent)
|
||||
ITunesSearchPage *itunes=new ITunesSearchPage(this);
|
||||
Icon itunesIcon;
|
||||
itunesIcon.addFile(":itunes");
|
||||
if (itunesIcon.isNull()) {
|
||||
itunesIcon=Icon("folder");
|
||||
}
|
||||
widget->addPage(itunes, i18n("Search iTunes"), itunesIcon, i18n("Search for podcasts on iTunes"));
|
||||
pages << itunes;
|
||||
|
||||
GPodderSearchPage *gpodder=new GPodderSearchPage(this);
|
||||
Icon gpodderIcon;
|
||||
gpodderIcon.addFile(":gpodder");
|
||||
widget->addPage(gpodder, i18n("Search GPodder"), gpodderIcon, i18n("Search for podcasts on GPodder.net"));
|
||||
pages << gpodder;
|
||||
|
||||
QFile file(":podcast_directories.xml");
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QXmlStreamReader reader(&file);
|
||||
@@ -470,11 +524,10 @@ PodcastSearchDialog::PodcastSearchDialog(QWidget *parent)
|
||||
QString name=reader.attributes().value(QLatin1String("name")).toString();
|
||||
QString icon=reader.attributes().value(QLatin1String("icon")).toString();
|
||||
Icon icn;
|
||||
if (!icon.isEmpty()) {
|
||||
icn.addFile(":"+icon);
|
||||
}
|
||||
if (icn.isNull()) {
|
||||
if (icon.isEmpty()) {
|
||||
icn=Icon("folder");
|
||||
} else {
|
||||
icn.addFile(":"+icon);
|
||||
}
|
||||
OpmlBrowsePage *page=new OpmlBrowsePage(this, QUrl(reader.attributes().value(QLatin1String("url")).toString()));
|
||||
widget->addPage(page, i18n("Browse %1", name), icn, i18n("Browse %1 podcasts", name));
|
||||
|
||||
Reference in New Issue
Block a user