File indexing completed on 2025-01-19 04:24:29
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Alejandro Wainzinger <aikawarazuni@gmail.com> * 0003 * Copyright (c) 2010 Bart Cerneels <bart.cerneels@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #ifndef PODCASTCAPABILITY_H 0019 #define PODCASTCAPABILITY_H 0020 0021 #include "core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h" 0022 #include "core-impl/collections/mediadevicecollection/podcast/MediaDevicePodcastMeta.h" 0023 0024 namespace Handler 0025 { 0026 class MEDIADEVICECOLLECTION_EXPORT PodcastCapability : public Handler::Capability 0027 { 0028 public: 0029 ~PodcastCapability() override; 0030 0031 /** 0032 * This method initializes iteration over some list of Podcast structs 0033 * e.g. with libgpod, this initializes a GList to the beginning of 0034 * the list of Podcasts 0035 */ 0036 virtual void prepareToParsePodcasts() = 0; 0037 0038 /** 0039 * This method runs a test to see if we have reached the end of 0040 * the list of Podcasts to be parsed on the device, e.g. in libgpod 0041 * this tests if cur != NULL, i.e. if(cur) 0042 */ 0043 virtual bool isEndOfParsePodcastsList() = 0; 0044 0045 /** 0046 * This method moves the iterator to the next Podcast on the list of 0047 * Podcast structs, e.g. with libgpod, cur = cur->next where cur 0048 * is a GList* 0049 */ 0050 virtual void prepareToParseNextPodcast() = 0; 0051 0052 /** 0053 * This method attempts to access the special struct of the 0054 * next Podcast, so that information can then be parsed from it. 0055 * For libgpod, this is m_currPodcast = ( Itdb_Podcast * ) cur->data 0056 */ 0057 virtual void nextPodcastToParse() = 0; 0058 0059 /** 0060 * This method checks if the Podcast should be parsed, or skipped. 0061 * Certain Podcasts, like the master Podcast on the iPod, do not 0062 * need to be or should not be parsed. 0063 * @return true if should not parse, false otherwise. 0064 */ 0065 virtual bool shouldNotParseNextPodcast() = 0; 0066 0067 /** 0068 * This method initializes iteration over some list of track structs 0069 * that correspond to a Podcast struct 0070 * e.g. with libgpod, this initializes a GList to the beginning of 0071 * the list of tracks 0072 */ 0073 virtual void prepareToParsePodcastEpisode() = 0; 0074 0075 /** 0076 * This method runs a test to see if we have reached the end of 0077 * the list of episode in the Podcast to be parsed on the device, e.g. in libgpod 0078 * this tests if cur != NULL, i.e. if(cur) 0079 */ 0080 virtual bool isEndOfParsePodcast() = 0; 0081 0082 /** 0083 * This method moves the iterator to the next track on the Podcast of 0084 * track structs, e.g. with libgpod, cur = cur->next where cur 0085 * is a GList* 0086 */ 0087 virtual void prepareToParseNextPodcastEpisode() = 0; 0088 0089 /** 0090 * This method attempts to access the special struct of the 0091 * next track on the Podcast, so that information can then be parsed from it. 0092 * For libgpod, this is m_currtrack = (Itdb_Track*) cur->data 0093 */ 0094 virtual void nextPodcastEpisodeToParse() = 0; 0095 0096 /** 0097 * Returns a MediaDeviceTrackPtr that is associated with the currently parsed track struct. 0098 * @return A MediaDeviceTrackPtr to currently parsed track struct 0099 */ 0100 virtual MediaDevicePodcastEpisodePtr libGetEpisodePtrForEpisodeStruct() = 0; 0101 0102 /** 0103 * Returns a string containing the Podcast name of the currently parsed Podcast struct, if available. 0104 * @return A string with the name of the currently parsed Podcast 0105 */ 0106 virtual QString libGetPodcastName() = 0; 0107 0108 /** 0109 * Adds a podcast 0110 */ 0111 virtual void addPodcast( const Podcasts::PodcastChannelPtr &channel ) = 0; 0112 0113 /** 0114 * Deletes a particular Podcast from the device 0115 * @param channel the channel to remove 0116 */ 0117 virtual void removePodcast( const MediaDevicePodcastChannelPtr &channel ) = 0; 0118 0119 /** 0120 * Deletes a particular Podcast Episode from the device 0121 * @param episode the episode to remove 0122 */ 0123 virtual void removePodcastEpisode( const MediaDevicePodcastEpisodePtr &episode ) = 0; 0124 0125 /** 0126 * This method must create a two-way association of the current Podcasts::Podcast 0127 * to the special struct provided by the library to read/write information. 0128 * For example, for libgpod one would associate Itdb_Podcast*. It makes 0129 * the most sense to use a QHash since it is fastest lookup and order 0130 * does not matter. 0131 * @param channel The channel to two-way associate with a library list struct 0132 */ 0133 virtual void setAssociatePodcast( const MediaDevicePodcastChannelPtr &channel ) { Q_UNUSED( channel ) } 0134 0135 static Type capabilityInterfaceType() { return Handler::Capability::Podcast; } 0136 }; 0137 } 0138 0139 #endif