1 /**************************************************************************************** 2 * Copyright (c) 2007-2009 Bart Cerneels <bart.cerneels@kde.org> * 3 * * 4 * This program is free software; you can redistribute it and/or modify it under * 5 * the terms of the GNU General Public License as published by the Free Software * 6 * Foundation; either version 2 of the License, or (at your option) any later * 7 * version. * 8 * * 9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 12 * * 13 * You should have received a copy of the GNU General Public License along with * 14 * this program. If not, see <http://www.gnu.org/licenses/>. * 15 ****************************************************************************************/ 16 17 #ifndef PODCASTPROVIDER_H 18 #define PODCASTPROVIDER_H 19 20 #include "core/collections/Collection.h" 21 #include "core/playlists/PlaylistProvider.h" 22 #include "core/podcasts/PodcastMeta.h" 23 24 namespace Podcasts { 25 26 /** 27 @author Bart Cerneels <bart.cerneels@kde.org> 28 */ 29 class AMAROKCORE_EXPORT PodcastProvider : public Collections::TrackProvider, public Playlists::PlaylistProvider 30 { 31 public: 32 static bool couldBeFeed( const QString &urlString ); 33 static QUrl toFeedUrl( const QString &urlString ); 34 35 bool possiblyContainsTrack( const QUrl &url ) const override = 0; 36 Meta::TrackPtr trackForUrl( const QUrl &url ) override = 0; 37 38 /** Special function to get an episode for a given guid. 39 * 40 * note: this functions is required because QUrl does not preserve every possible guids. 41 * This means we can not use trackForUrl(). 42 * Problematic guids contain non-latin characters, percent encoded parts, capitals, etc. 43 */ 44 virtual Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ) = 0; 45 46 virtual void addPodcast( const QUrl &url ) = 0; updateAll()47 virtual void updateAll() {} 48 49 virtual Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) = 0; 50 virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) = 0; 51 52 virtual Podcasts::PodcastChannelList channels() = 0; 53 54 //TODO: need to move this to SqlPodcastProvider since it's provider specific. 55 //perhaps use a more general transferprogress for playlists 56 virtual void completePodcastDownloads() = 0; 57 58 // PlaylistProvider methods category()59 int category() const override { return Playlists::PodcastChannelPlaylist; } 60 61 /** convenience function that downcast the argument to PodcastChannel and calls addChannel() 62 */ 63 Playlists::PlaylistPtr addPlaylist(Playlists::PlaylistPtr playlist ) override; 64 65 /** convenience function that downcast the argument to PodcastEpisode and calls addEpisode() 66 */ 67 Meta::TrackPtr addTrack( const Meta::TrackPtr &track ) override; 68 }; 69 70 } //namespace Podcasts 71 72 #endif 73