File indexing completed on 2025-01-19 04:24:30

0001 /****************************************************************************************
0002  * Copyright 2010 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 
0018 #include "MediaDevicePodcastProvider.h"
0019 
0020 using namespace Podcasts;
0021 
0022 MediaDevicePodcastProvider::MediaDevicePodcastProvider( Meta::MediaDeviceHandler *handler )
0023         : m_handler( handler )
0024 {
0025 }
0026 
0027 void
0028 MediaDevicePodcastProvider::addPodcast( const QUrl &url )
0029 {
0030     Q_UNUSED( url )
0031     //can this handler even fetch feeds itself?
0032 }
0033 
0034 PodcastChannelPtr
0035 MediaDevicePodcastProvider::addChannel( const PodcastChannelPtr &channel )
0036 {
0037     Q_UNUSED( channel )
0038     return PodcastChannelPtr();
0039 }
0040 
0041 PodcastEpisodePtr
0042 MediaDevicePodcastProvider::addEpisode( PodcastEpisodePtr episode )
0043 {
0044     Q_UNUSED( episode )
0045     return PodcastEpisodePtr();
0046 }
0047 
0048 PodcastChannelList
0049 MediaDevicePodcastProvider::channels()
0050 {
0051     PodcastChannelList channels;
0052     return channels;
0053 }
0054 
0055 void
0056 MediaDevicePodcastProvider::removeSubscription( PodcastChannelPtr channel )
0057 {
0058     Q_UNUSED( channel )
0059 }
0060 
0061 void
0062 MediaDevicePodcastProvider::configureProvider()
0063 {
0064 }
0065 
0066 void
0067 MediaDevicePodcastProvider::configureChannel( PodcastChannelPtr channel )
0068 {
0069     Q_UNUSED( channel )
0070 }
0071 
0072 QString
0073 MediaDevicePodcastProvider::prettyName() const
0074 {
0075     return i18nc( "Podcasts on a media device", "Podcasts on %1", m_handler->prettyName() );
0076 }
0077 
0078 Playlists::PlaylistList
0079 MediaDevicePodcastProvider::playlists()
0080 {
0081     Playlists::PlaylistList playlists;
0082 
0083     foreach( PodcastChannelPtr channel, channels() )
0084         playlists << Playlists::PlaylistPtr::dynamicCast( channel );
0085 
0086     return playlists;
0087 }
0088 
0089 Playlists::PlaylistPtr
0090 MediaDevicePodcastProvider::addPlaylist(Playlists::PlaylistPtr playlist )
0091 {
0092     PodcastChannelPtr channel = PodcastChannelPtr::dynamicCast( playlist );
0093     if( channel.isNull() )
0094         return Playlists::PlaylistPtr();
0095 
0096     return Playlists::PlaylistPtr::dynamicCast( addChannel( channel ) );
0097 }
0098 
0099 Meta::TrackPtr
0100 MediaDevicePodcastProvider::addTrack(const Meta::TrackPtr &track )
0101 {
0102     PodcastEpisodePtr episode = PodcastEpisodePtr::dynamicCast( track );
0103     if( episode.isNull() )
0104         return Meta::TrackPtr();
0105 
0106     return Meta::TrackPtr::dynamicCast( addEpisode( episode ) );
0107 }