Commit df283727 authored by Bart Cerneels's avatar Bart Cerneels
Browse files

Episodes without guid should also be checked.

BUG:240389
parent 944febea
......@@ -647,14 +647,19 @@ SqlPodcastChannel::setImageUrl( const KUrl &imageUrl )
Podcasts::PodcastEpisodePtr
SqlPodcastChannel::addEpisode( PodcastEpisodePtr episode )
{
DEBUG_BLOCK
debug() << "adding episode " << episode->title() << " to sqlchannel " << title();
if( !m_provider )
return PodcastEpisodePtr();
//check for guid and return the episode we might already have.
if( !episode->guid().isEmpty() && m_provider->possiblyContainsTrack( episode->guid() ) )
KUrl checkUrl;
//searched in the database for guid or enclosure url
if( !episode->guid().isEmpty() )
checkUrl = episode->guid();
else if( !episode->uidUrl().isEmpty() )
checkUrl = episode->uidUrl();
else
return PodcastEpisodePtr(); //noting to check for
if( m_provider->possiblyContainsTrack( checkUrl ) )
return PodcastEpisodePtr::dynamicCast( m_provider->trackForUrl( episode->guid() ) );
//force episodes load.
......
......@@ -242,7 +242,7 @@ SqlPodcastProvider::possiblyContainsTrack( const KUrl &url ) const
if( !sqlStorage )
return false;
QString command = "SELECT title FROM podcastepisodes WHERE guid='%1' OR url='%1' "
QString command = "SELECT id FROM podcastepisodes WHERE guid='%1' OR url='%1' "
"OR localurl='%1';";
command = command.arg( sqlStorage->escape( url.url() ) );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment