File indexing completed on 2024-05-19 15:52:42
0001 /**************************************************************************************** 0002 * Copyright (c) 2007-2009 Bart Cerneels <bart.cerneels@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef PODCASTPROVIDER_H 0018 #define PODCASTPROVIDER_H 0019 0020 #include "core/collections/Collection.h" 0021 #include "core/playlists/PlaylistProvider.h" 0022 #include "core/podcasts/PodcastMeta.h" 0023 0024 namespace Podcasts { 0025 0026 /** 0027 @author Bart Cerneels <bart.cerneels@kde.org> 0028 */ 0029 class AMAROKCORE_EXPORT PodcastProvider : public Collections::TrackProvider, public Playlists::PlaylistProvider 0030 { 0031 public: 0032 static bool couldBeFeed( const QString &urlString ); 0033 static QUrl toFeedUrl( const QString &urlString ); 0034 0035 bool possiblyContainsTrack( const QUrl &url ) const override = 0; 0036 Meta::TrackPtr trackForUrl( const QUrl &url ) override = 0; 0037 0038 /** Special function to get an episode for a given guid. 0039 * 0040 * note: this functions is required because QUrl does not preserve every possible guids. 0041 * This means we can not use trackForUrl(). 0042 * Problematic guids contain non-latin characters, percent encoded parts, capitals, etc. 0043 */ 0044 virtual Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ) = 0; 0045 0046 virtual void addPodcast( const QUrl &url ) = 0; 0047 virtual void updateAll() {} 0048 0049 virtual Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) = 0; 0050 virtual Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) = 0; 0051 0052 virtual Podcasts::PodcastChannelList channels() = 0; 0053 0054 //TODO: need to move this to SqlPodcastProvider since it's provider specific. 0055 //perhaps use a more general transferprogress for playlists 0056 virtual void completePodcastDownloads() = 0; 0057 0058 // PlaylistProvider methods 0059 int category() const override { return Playlists::PodcastChannelPlaylist; } 0060 0061 /** convenience function that downcast the argument to PodcastChannel and calls addChannel() 0062 */ 0063 Playlists::PlaylistPtr addPlaylist(Playlists::PlaylistPtr playlist ) override; 0064 0065 /** convenience function that downcast the argument to PodcastEpisode and calls addEpisode() 0066 */ 0067 Meta::TrackPtr addTrack( const Meta::TrackPtr &track ) override; 0068 }; 0069 0070 } //namespace Podcasts 0071 0072 #endif