1 // (c) 2006 Seb Ruiz <ruiz@kde.org>
2 // See COPYING file for licensing information
4 #ifndef AMAROK_PODCASTBUNDLE_H
5 #define AMAROK_PODCASTBUNDLE_H
7 #include "podcastsettings.h"
11 class PodcastChannelBundle
14 PodcastChannelBundle() { }
15 PodcastChannelBundle( const KUrl
&url
, const QString
&title
, const QString
&author
, const KUrl
&link
,
16 const QString
&desc
, const QString
©
, PodcastSettings
*settings
)
23 setSettings( settings
); }
25 void setSettings( PodcastSettings
*settings
)
27 m_saveLocation
= settings
->saveLocation();
28 m_autoscan
= settings
->autoscan();
29 m_fetchType
= settings
->fetchType();
30 m_autotransfer
= settings
->autoTransfer();
31 m_purge
= settings
->hasPurge();
32 m_purgeCount
= settings
->purgeCount();
35 PodcastSettings
* getSettings()
37 return new PodcastSettings( m_title
, m_saveLocation
, m_autoscan
, m_fetchType
,
38 m_autotransfer
, m_purge
, m_purgeCount
);
41 /// Return the url of the podcast feed
42 const KUrl
&url() const;
43 /// The title of the Podcast channel
44 const QString
&title() const;
45 /// The author of the Podcast channel
46 const QString
&author() const;
47 /// A url to the webpage of the podcast
48 const KUrl
&link() const;
49 /// A url to the image of the podcast
50 const KUrl
&imageURL() const;
51 const QString
&description() const;
52 const QString
©right() const;
53 /// The id which the parent folder has in the database
56 void setUrl( const KUrl
&u
);
57 void setTitle( const QString
&t
);
58 void setAuthor( const QString
&a
);
59 void setLink( const KUrl
&l
);
60 void setImageURL( const KUrl
&i
);
61 void setDescription( const QString
&d
);
62 void setCopyright( const QString
&c
);
63 void setParentId( const int p
);
65 void setSaveLocation( const QString
&s
);
66 void setAutoScan( const bool b
);
67 void setFetchType( const int i
);
68 void setAutoTransfer( const bool b
);
69 void setPurge( const bool b
);
70 void setPurgeCount( const int i
);
73 const QString
& saveLocation() const;
74 bool autoscan() const;
75 int fetchType() const;
76 bool autotransfer() const;
77 bool hasPurge() const;
78 int purgeCount() const;
86 QString m_description
;
90 QString m_saveLocation
;
98 inline const KUrl
&PodcastChannelBundle::url() const { return m_url
; }
99 inline const QString
&PodcastChannelBundle::title() const { return m_title
; }
100 inline const QString
&PodcastChannelBundle::author() const { return m_author
; }
101 inline const KUrl
&PodcastChannelBundle::link() const { return m_link
; }
102 inline const KUrl
&PodcastChannelBundle::imageURL() const { return m_imageUrl
; }
103 inline const QString
&PodcastChannelBundle::description() const { return m_description
; }
104 inline const QString
&PodcastChannelBundle::copyright() const { return m_copyright
; }
105 inline int PodcastChannelBundle::parentId() const { return m_parentId
; }
107 inline void PodcastChannelBundle::setUrl ( const KUrl
&u
) { m_url
= u
; }
108 inline void PodcastChannelBundle::setTitle ( const QString
&t
) { m_title
= t
; }
109 inline void PodcastChannelBundle::setAuthor ( const QString
&a
) { m_author
= a
; }
110 inline void PodcastChannelBundle::setLink ( const KUrl
&l
) { m_link
= l
; }
111 inline void PodcastChannelBundle::setImageURL ( const KUrl
&i
) { m_imageUrl
= i
; }
112 inline void PodcastChannelBundle::setDescription ( const QString
&d
) { m_description
= d
; }
113 inline void PodcastChannelBundle::setCopyright ( const QString
&c
) { m_copyright
= c
; }
114 inline void PodcastChannelBundle::setParentId ( const int p
) { m_parentId
= p
; }
116 inline void PodcastChannelBundle::setSaveLocation( const QString
&s
) { m_saveLocation
= s
; }
117 inline void PodcastChannelBundle::setAutoScan( const bool b
) { m_autoscan
= b
; }
118 inline void PodcastChannelBundle::setFetchType( const int i
) { m_fetchType
= i
; }
119 inline void PodcastChannelBundle::setAutoTransfer( const bool b
) { m_autotransfer
= b
; }
120 inline void PodcastChannelBundle::setPurge( const bool b
) { m_purge
= b
; }
121 inline void PodcastChannelBundle::setPurgeCount( const int i
) { m_purgeCount
= i
; }
123 inline const QString
&PodcastChannelBundle::saveLocation() const { return m_saveLocation
; }
124 inline bool PodcastChannelBundle::autoscan() const { return m_autoscan
; }
125 inline int PodcastChannelBundle::fetchType() const { return m_fetchType
; }
126 inline bool PodcastChannelBundle::autotransfer() const { return m_autotransfer
; }
127 inline bool PodcastChannelBundle::hasPurge() const { return m_purge
; }
128 inline int PodcastChannelBundle::purgeCount() const { return m_purgeCount
; }
132 class PodcastEpisodeBundle
135 PodcastEpisodeBundle()
141 PodcastEpisodeBundle( const KUrl
&url
, const KUrl
&parent
, const QString
&title
,
142 const QString
&author
, const QString
&desc
, const QString
&date
,
143 const QString
&type
, const int duration
, const QString
&guid
,
151 m_description
= desc
;
154 m_duration
= duration
< 0 ? 0 : duration
;
158 if( !date
.isEmpty() )
159 m_dateTime
= KDateTime::fromString( date
);
162 /// The row id which this podcast episode has in the database
164 /// The remote url to the podcast episode
165 const KUrl
&url() const;
166 /// The local url of the podcast episode (if it has been downloaded, an invalid url otherwise)
167 const KUrl
&localUrl() const;
168 /// The url of the podcast channel
169 const KUrl
&parent() const;
170 const QString
&author() const;
171 const QString
&title() const;
172 const QString
&subtitle() const;
173 const QString
&description() const;
174 const QString
&date() const;
175 KDateTime
dateTime() const;
176 /// File type of the podcast episode, eg ogg, mp3 etc
177 const QString
&type() const;
178 int duration() const; // duration in seconds
179 uint
size() const; // file/stream size in bytes
180 /// unique identifier that should be available in the feed (RSS 2.0: guid ATOM: id)
181 const QString
&guid() const;
182 /// Has this particular podcast episode been listened to?
185 void setDBId( const int i
);
186 void setUrl( const KUrl
&u
);
187 void setLocalURL( const KUrl
&u
);
188 void setParent( const KUrl
&u
);
189 void setAuthor( const QString
&a
);
190 void setTitle( const QString
&t
);
191 void setSubtitle( const QString
&s
);
192 void setDescription( const QString
&d
);
193 void setDate( const QString
&d
);
194 void setType( const QString
&t
);
195 void setDuration( const int i
);
196 void setSize( const uint i
);
197 void setGuid( const QString
&g
);
198 void setNew( const bool &b
);
208 QString m_description
;
210 KDateTime m_dateTime
;
218 inline int PodcastEpisodeBundle::dBId() const { return m_id
; }
219 inline const KUrl
&PodcastEpisodeBundle::url() const { return m_url
; }
220 inline const KUrl
&PodcastEpisodeBundle::localUrl() const { return m_localUrl
; }
221 inline const KUrl
&PodcastEpisodeBundle::parent() const { return m_parent
; }
222 inline const QString
&PodcastEpisodeBundle::author() const { return m_author
; }
223 inline const QString
&PodcastEpisodeBundle::title() const { return m_title
; }
224 inline const QString
&PodcastEpisodeBundle::subtitle() const { return m_subtitle
; }
225 inline const QString
&PodcastEpisodeBundle::description() const { return m_description
; }
226 inline const QString
&PodcastEpisodeBundle::date() const { return m_date
; }
227 inline KDateTime
PodcastEpisodeBundle::dateTime() const { return m_dateTime
; }
228 inline const QString
&PodcastEpisodeBundle::type() const { return m_type
; }
229 inline int PodcastEpisodeBundle::duration() const { return m_duration
; }
230 inline uint
PodcastEpisodeBundle::size() const { return m_size
; }
231 inline const QString
&PodcastEpisodeBundle::guid() const { return m_guid
; }
232 inline bool PodcastEpisodeBundle::isNew() const { return m_isNew
; }
234 inline void PodcastEpisodeBundle::setDBId( const int i
) { m_id
= i
; }
235 inline void PodcastEpisodeBundle::setUrl( const KUrl
&u
) { m_url
= u
; }
236 inline void PodcastEpisodeBundle::setLocalURL( const KUrl
&u
) { m_localUrl
= u
; }
237 inline void PodcastEpisodeBundle::setParent( const KUrl
&u
) { m_parent
= u
; }
238 inline void PodcastEpisodeBundle::setAuthor( const QString
&a
) { m_author
= a
; }
239 inline void PodcastEpisodeBundle::setTitle( const QString
&t
) { m_title
= t
; }
240 inline void PodcastEpisodeBundle::setSubtitle( const QString
&t
) { m_subtitle
= t
; }
241 inline void PodcastEpisodeBundle::setDescription( const QString
&d
) { m_description
= d
; }
242 inline void PodcastEpisodeBundle::setDate( const QString
&d
)
243 { m_date
= d
; if( !d
.isEmpty() ) m_dateTime
= KDateTime::fromString( d
) ;}
244 inline void PodcastEpisodeBundle::setType( const QString
&t
) { m_type
= t
; }
245 inline void PodcastEpisodeBundle::setDuration( const int i
) { m_duration
= i
; }
246 inline void PodcastEpisodeBundle::setSize( const uint i
) { m_size
= i
; }
247 inline void PodcastEpisodeBundle::setGuid( const QString
&g
) { m_guid
= g
; }
248 inline void PodcastEpisodeBundle::setNew( const bool &b
) { m_isNew
= b
; }
250 #endif /* AMAROK_PODCASTBUNDLE_H */