Bug 227515

Summary: Broken podcast that causes weird side-effects
Product: [Applications] amarok Reporter: Marcel Dischinger <mdspam>
Component: PodcastAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: bart.cerneels
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marcel Dischinger 2010-02-18 13:32:21 UTC
Version:           2.3-beta1 (using KDE 4.3.4)
OS:                Linux
Installed from:    Debian testing/unstable Packages

I have a weird problem when adding the following podcast:
http://www.radioeins.de/archiv/podcast/hoerbar_rust.feed.podcast.xml

When I add it (and I already have a list of other podcasts), Amarok loads the icon of this podcast correctly. But no episodes are loaded at all (no '+' in front of the podcast icon). I verified that the feed is actually not empty.

But now the weird part. I now update all podcasts. Still, the "Hoerbar Rust" podcast remains empty. But when another podcast has new episodes, they are replaced with epsiodes from "Hoerbar Rust". If I play these replaced episodes, they are in fact from "Hoerbar Rust".
I can fix this by replacing the "Hoerbar Rust" podcast and update the podcasts again.
Comment 1 Myriam Schweingruber 2010-02-18 13:59:07 UTC
Confirmed on current Amarok 2.3-git
Comment 2 Bart Cerneels 2010-02-18 16:28:34 UTC
commit e6ecbbeed48cb82a6dbba9d522c6b26dea0155eb
Author: Bart Cerneels <bart.cerneels@kde.org>
Date:   Thu Feb 18 14:55:47 2010 +0100

    Fix bug in rss feed parsing using wrong url.
    
    This actually broke all feeds that do not include a guid and possible overwrited data from other feeds.
    Introduced in 2.3 beta.
    
    BUG:227515

diff --git a/ChangeLog b/ChangeLog
index f3c563f..2742f2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,9 @@ VERSION 2.3
       last check.
 
   BUGFIXES:
+    * Fixed a bug in podcast parsing that broke all feeds that do not include a
+      guid and possible overwrited data from other podcasts. Introduced in 2.3 beta.
+      (BR 227515)
     * Correctly show progress description of last remaining job in the statusbar 
       after multiple jobs have been running.
     * Fixed a regression that broke the playlist save button.
diff --git a/src/podcasts/PodcastReader.cpp b/src/podcasts/PodcastReader.cpp
index 91c3b67..a18efe4 100644
--- a/src/podcasts/PodcastReader.cpp
+++ b/src/podcasts/PodcastReader.cpp
@@ -1153,14 +1153,16 @@ PodcastReader::endItem()
         if( useGuid )
             useGuid = !m_item->guid().contains( "[A-Z]" ); //KUrl only uses lowercase
 
-        const KUrl trackId( useGuid ? m_item->uidUrl() : m_item->guid() );
+        const KUrl trackId( useGuid ? m_item->guid() : m_item->uidUrl() );
         Meta::PodcastEpisodePtr episode = Meta::PodcastEpisodePtr::dynamicCast(
                                               m_podcastProvider->trackForUrl( trackId )
                                           );
 
-        if( !episode.isNull() )
+        //make sure that the episode is not a bogus match. The channel has to be correct.
+        // See http://bugs.kde.org/show_bug.cgi?id=227515
+        if( !episode.isNull() || episode->channel() != m_channel )
         {
-            debug() << "updating episode: " << m_item->title();
+            debug() << "updating episode: " << episode->title();
 
             episode->setTitle( m_item->title() );
             episode->setSubtitle( m_item->subtitle() );
diff --git a/src/podcasts/sql/SqlPodcastProvider.cpp b/src/podcasts/sql/SqlPodcastProvider.cpp
index 1af4b48..2f37c57 100644
--- a/src/podcasts/sql/SqlPodcastProvider.cpp
+++ b/src/podcasts/sql/SqlPodcastProvider.cpp
@@ -195,13 +195,13 @@ SqlPodcastProvider::possiblyContainsTrack( const KUrl &url ) const
 Meta::TrackPtr
 SqlPodcastProvider::trackForUrl( const KUrl &url )
 {
-    DEBUG_BLOCK
+    if( url.isEmpty() )
+        return TrackPtr();
 
     SqlStorage *sqlStorage = CollectionManager::instance()->sqlStorage();
     if( !sqlStorage )
         return TrackPtr();
 
-
     QString command = "SELECT id, url, channel, localurl, guid, "
             "title, subtitle, sequencenumber, description, mimetype, pubdate, "
             "duration, filesize, isnew FROM podcastepisodes "
Comment 3 Mathias Panzenböck 2010-02-19 02:47:09 UTC
commit 78b00addfac22438b3b8fba42275c4540cf2f480
Author: Mathias Panzenböck <grosser.meister.morti@gmx.net>
Date:   Fri Feb 19 02:43:45 2010 +0100

    Fix barts fix for bug in rss feed parsing using wrong url.
    
    The condition was exactly wrong, which caused amarok to crash when there
    was no match for a podacst episode.
    
    BUG:227515

diff --git a/src/podcasts/PodcastReader.cpp b/src/podcasts/PodcastReader.cpp
index a18efe4..35ea736 100644
--- a/src/podcasts/PodcastReader.cpp
+++ b/src/podcasts/PodcastReader.cpp
@@ -1160,7 +1160,7 @@ PodcastReader::endItem()
 
         //make sure that the episode is not a bogus match. The channel has to be correct.
         // See http://bugs.kde.org/show_bug.cgi?id=227515
-        if( !episode.isNull() || episode->channel() != m_channel )
+        if( !episode.isNull() && episode->channel() == m_channel )
         {
             debug() << "updating episode: " << episode->title();
Comment 4 Marcel Dischinger 2010-02-19 10:31:21 UTC
Just as a side-note as this is not related to this bug per-se: this fix brought back the "multiplying podcast episodes" bug (https://bugs.kde.org/show_bug.cgi?id=219516) that was fixed for beta1.
Comment 5 Myriam Schweingruber 2010-02-19 11:10:21 UTC
(In reply to comment #4)
> Just as a side-note as this is not related to this bug per-se: this fix brought
> back the "multiplying podcast episodes" bug
> (https://bugs.kde.org/show_bug.cgi?id=219516) that was fixed for beta1.

Could you please comment on that bug, then? Else it gets difficult to track.