53
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: This class provides the functions to manipulate the Podcast table
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef MPXDBPODCAST_H
|
|
20 |
#define MPXDBPODCAST_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <f32file.h>
|
|
25 |
#include <e32property.h>
|
|
26 |
#include <badesca.h>
|
|
27 |
#include <mpxmediageneraldefs.h>
|
|
28 |
#include <mpxpodcastdefs.h>
|
|
29 |
#include <mpxmessage2.h>
|
|
30 |
|
|
31 |
#include "mpxdbtable.h"
|
|
32 |
|
|
33 |
#include "mpxpodcastcollectiondbstd.h"
|
|
34 |
#include "mpxdbactivetask.h"
|
|
35 |
#include "mpxdbcommonstd.h"
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
const TInt KMaxSystemPlaylistQuery = 20;
|
|
39 |
|
|
40 |
// FORWARD DECLARATIONS
|
|
41 |
class CMPXTableView;
|
|
42 |
class CMCGenreParser;
|
|
43 |
class CMPXCollectionPath;
|
|
44 |
|
|
45 |
// CLASS DECLARATION
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Observer interface for handling the category ID functionality.
|
|
49 |
* This is needed because the incoming CMPXMedia parameters in Add and Update methods
|
|
50 |
* contain the names for the category items and the Podcast table has to use IDs linking
|
|
51 |
* to the category tables. Using this interface removes the dependency to the category
|
|
52 |
* class.
|
|
53 |
*
|
|
54 |
* Note that this interface is only used when information is written to the Podcast table,
|
|
55 |
* when information is retrieved the query takes care of also retrieving the names from
|
|
56 |
* the corresponding category tables so the outgoing CMPXMedia will contain the correct
|
|
57 |
* information.
|
|
58 |
*/
|
|
59 |
class MMPXDbPodcastObserver
|
|
60 |
{
|
|
61 |
public:
|
|
62 |
/**
|
|
63 |
* Called when a new category item has to be added to a category table.
|
|
64 |
* @param aCategory category type
|
|
65 |
* @param aName name string
|
|
66 |
* @param aDriveId drive to add the category item to
|
|
67 |
* @param aItemChangedMessages NULL or valid changed mesages array to be updated
|
|
68 |
* @return the ID of the category item (new or existing)
|
|
69 |
*/
|
|
70 |
virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
|
|
71 |
TInt aDriveId, CMPXMessageArray* aItemChangedMessages) = 0;
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Called when the ID of a category item changed for a Music record, for example when
|
|
75 |
* the artist name changed for a song. The implementation is supposed to update the
|
|
76 |
* category record and add corresponding item changed messages to the array parameter.
|
|
77 |
* @param aCategory category type
|
|
78 |
* @param aCategoryId category item ID
|
|
79 |
* @param aItemChangedMessages NULL or valid changed mesages array to be updated
|
|
80 |
*/
|
|
81 |
virtual void DeleteEpisodeForCategoryL(TMPXGeneralCategory aCategory,
|
|
82 |
TUint32 aCategoryId, TInt aDriveId,
|
|
83 |
CMPXMessageArray* aItemChangedMessages) = 0;
|
|
84 |
};
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Podcast table handler
|
|
88 |
*
|
|
89 |
* @lib mpxpodcastdbplugin.lib
|
|
90 |
*/
|
|
91 |
class CMPXDbPodcast :
|
|
92 |
public CMPXDbTable
|
|
93 |
{
|
|
94 |
public: // Constructors and destructor
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Two-phased constructor.
|
|
98 |
* @param aDbManager database manager to use for database interactions
|
|
99 |
* @param aObserver Observer for podcast notifications
|
|
100 |
* @return New CMPXDbPodcast instance
|
|
101 |
*/
|
|
102 |
static CMPXDbPodcast* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource,
|
|
103 |
MMPXDbPodcastObserver& aObserver);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Two-phased constructor.
|
|
107 |
* @param aDbManager database manager to use for database interactions
|
|
108 |
* @param aObserver Observer for podcast notifications
|
|
109 |
* @return New CMPXDbPodcast instance
|
|
110 |
*/
|
|
111 |
static CMPXDbPodcast* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource,
|
|
112 |
MMPXDbPodcastObserver& aObserver);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Destructor.
|
|
116 |
*/
|
|
117 |
virtual ~CMPXDbPodcast();
|
|
118 |
|
|
119 |
public: // New functions
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Add a episode to the podcast table
|
|
123 |
* @param aMedia media object which contains file path,
|
|
124 |
* artist, composer, name(title), track, etc...
|
|
125 |
* @param aDrive drive to add the episode to
|
|
126 |
* @return The unique id of the episode added.
|
|
127 |
*/
|
|
128 |
TUint32 AddEpisodeL(const CMPXMedia& aMedia, TInt aDrive);
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Update info for an episode in the Podcast table
|
|
132 |
* @param aEpisodeId episode ID
|
|
133 |
* @param aMedia media object which contains file path,
|
|
134 |
* artist, composer, name(title), track, etc...
|
|
135 |
* @param aItemChangedMessages a list of change events
|
|
136 |
* @return ETrue if the change is visible in the UI
|
|
137 |
*/
|
|
138 |
CMPXDbActiveTask::TChangeVisibility UpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
|
|
139 |
CMPXMessageArray& aItemChangedMessages);
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Cleans up the deleted records
|
|
143 |
*/
|
|
144 |
void CleanupL();
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Remove an episode from the Podcast table
|
|
148 |
* @param aEpisodeId the ID of the episode to be removed
|
|
149 |
* @param aUriArray on return contains the URI of the deleted episode
|
|
150 |
* @param aItemChangedMessages on return contains changed messages
|
|
151 |
* @param IsAdd denotes whether DeleteEpisodeL is called as part of
|
|
152 |
* adding an episode or deleting an episode ,if called as part of adding
|
|
153 |
* pass ETrue else if part of deletion pass EFalse.
|
|
154 |
* @param aDeleteRecord indicates whether the client has explictly requested
|
|
155 |
* to delete the records from the database. If ETrue, records
|
|
156 |
* associated with the media will be deleted from the database;
|
|
157 |
* if EFalse, the record will be marked as deleted only.
|
|
158 |
*/
|
|
159 |
void DeleteEpisodeL(TUint32 aEpisodeId, CDesCArray& aUriArray,
|
|
160 |
CMPXMessageArray& aItemChangedMessages, TBool IsAdd, TBool aDeleteRecord);
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Remove episodes matching a category from the Podcast table
|
|
164 |
* @param aCategory the category to remove
|
|
165 |
* @param aCategoryId ID of the category to remove
|
|
166 |
* @param aUriArray on return will be filled with all the paths that were removed
|
|
167 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
168 |
*/
|
|
169 |
void DeleteCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
|
|
170 |
CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Remove all episodes from the podcast table that are published today
|
|
174 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
175 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
176 |
*/
|
|
177 |
void DeleteTodayEpisodesL(CDesCArray& aUriArray,
|
|
178 |
CMPXMessageArray& aItemChangedMessages);
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Remove all episodes from the podcast table that are published yesterday
|
|
182 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
183 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
184 |
*/
|
|
185 |
void DeleteYesterdayEpisodesL(CDesCArray& aUriArray,
|
|
186 |
CMPXMessageArray& aItemChangedMessages);
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Remove all episodes from the podcast table that are published this week
|
|
190 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
191 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
192 |
*/
|
|
193 |
void DeleteThisWeekEpisodesL(CDesCArray& aUriArray,
|
|
194 |
CMPXMessageArray& aItemChangedMessages);
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Remove all episodes from the podcast table that are published a week ago
|
|
198 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
199 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
200 |
*/
|
|
201 |
void DeleteLastWeekEpisodesL(CDesCArray& aUriArray,
|
|
202 |
CMPXMessageArray& aItemChangedMessages);
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Remove all episodes from the podcast table that are published 2 weeks ago
|
|
206 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
207 |
* @param aUpdatedPlaylists playlists updated as result of the episode removal
|
|
208 |
* @param aUpdatedCategories, a list of updated categories
|
|
209 |
*/
|
|
210 |
void Delete2WeeksAgoEpisodesL(CDesCArray& aUriArray,
|
|
211 |
CMPXMessageArray& aItemChangedMessages);
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Remove all episodes from the podcast table that are published 3 weeks ago
|
|
215 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
216 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
217 |
*/
|
|
218 |
void Delete3WeeksAgoEpisodesL(CDesCArray& aUriArray,
|
|
219 |
CMPXMessageArray& aItemChangedMessages);
|
|
220 |
|
|
221 |
/**
|
|
222 |
* Remove all episodes from the podcast table that are published last month
|
|
223 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
224 |
* @param aUpdatedPlaylists playlists updated as result of the episode removal
|
|
225 |
* @param aUpdatedCategories, a list of updated categories
|
|
226 |
*/
|
|
227 |
void DeleteLastMonthEpisodesL(CDesCArray& aUriArray,
|
|
228 |
CMPXMessageArray& aItemChangedMessages);
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Remove all episodes from the podcast table that are published earlier
|
|
232 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
233 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
234 |
*/
|
|
235 |
void DeleteEarlierEpisodesL(CDesCArray& aUriArray,
|
|
236 |
CMPXMessageArray& aItemChangedMessages);
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Remove all episodes from the podcast table that do not have a publish date
|
|
240 |
* @param aUriArray on return will be filled with all the paths that were removed
|
|
241 |
* @param aItemChangedMessages change events as result of the episode removal
|
|
242 |
*/
|
|
243 |
void DeleteUnknownEpisodesL(CDesCArray& aUriArray,
|
|
244 |
CMPXMessageArray& aItemChangedMessages);
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Get duration for the given episode
|
|
248 |
* @param aEpisodeId episode ID of the episode to search for
|
|
249 |
* @return Episode duration
|
|
250 |
*/
|
|
251 |
TInt EpisodeDurationL(TUint32 aEpisodeId);
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Get duration for all episodes
|
|
255 |
* @return Duration value
|
|
256 |
*/
|
|
257 |
TInt AllEpisodesDurationL();
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Get duration for all episodes of a specified title
|
|
261 |
* @param aTitleId identifies the title
|
|
262 |
* @return Duration value
|
|
263 |
*/
|
|
264 |
TInt TitleDurationL(TUint32 aTitleId);
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Get duration for not played episodes
|
|
268 |
* @return Duration value
|
|
269 |
*/
|
|
270 |
TInt NotPlayedDurationL();
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Get duration for recently added episodes
|
|
274 |
* @return Duration value
|
|
275 |
*/
|
|
276 |
TInt RecentlyAddedDurationL();
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Get the name of the episode that matches the given episode ID
|
|
280 |
* @param aEpisodeId ID of the episode
|
|
281 |
* @return Episode name, ownership is transferred.
|
|
282 |
*/
|
|
283 |
HBufC* GetNameL(TUint32 aEpisodeId);
|
|
284 |
|
|
285 |
/**
|
|
286 |
* Get URI of the episode
|
|
287 |
* @param aEpisodeId ID of the episode
|
|
288 |
* @return Episode URI, ownership is transferred.
|
|
289 |
*/
|
|
290 |
HBufC* GetUriL(TUint32 aEpisodeId);
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Get the drive of the episode
|
|
294 |
* @param aEpisodeId ID of the episode
|
|
295 |
* @return Episode drive
|
|
296 |
*/
|
|
297 |
TInt GetDriveL(TUint32 aEpisodeId);
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Gets information for an episode
|
|
301 |
* @param aEpisodeId identifies the episode
|
|
302 |
* @param aAttrs attributes to be returned
|
|
303 |
* @param aMedia returns the episode info
|
|
304 |
*/
|
|
305 |
void GetEpisodeL(TUint32 aEpisodeId, const TArray<TMPXAttribute>& aAttrs,
|
|
306 |
CMPXMedia& aMedia);
|
|
307 |
|
|
308 |
/**
|
|
309 |
* Gets all episodes
|
|
310 |
* @param aAttrs attributes to be retrieved
|
|
311 |
* @param aMediaArray returns the episode info
|
|
312 |
*/
|
|
313 |
void GetAllEpisodesL(const TArray<TMPXAttribute>& aAttrs,
|
|
314 |
CMPXMediaArray& aMediaArray);
|
|
315 |
|
|
316 |
/**
|
|
317 |
* Gets the episodes for a category
|
|
318 |
* @param aCategory category type
|
|
319 |
* @param aCategoryId category item
|
|
320 |
* @param aAttrs attributes to be retrieved
|
|
321 |
* @param aMediaArray returns the episodes info
|
|
322 |
* @param aOrder should the query be ordered, default EFalse
|
|
323 |
*/
|
|
324 |
void GetEpisodesForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
|
|
325 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray,
|
|
326 |
TBool aOrder = EFalse);
|
|
327 |
|
|
328 |
/**
|
|
329 |
* Get all the episodes that match the given title ID
|
|
330 |
* @param aTitleId ID of the title to match
|
|
331 |
* @param aAttrs Array of attributes to return
|
|
332 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
333 |
*/
|
|
334 |
void GetEpisodesMatchingTitleL(TUint aTitleId,
|
|
335 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Get the episodes from the podcast table with playcount equal to zero
|
|
339 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
340 |
* selection criteria
|
|
341 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
342 |
* @param aIndexOfCurrentlyPlayingItem index of the currently playing
|
|
343 |
* episode or KErrNotFound(-1) if no currently playing episode within
|
|
344 |
* this playlist
|
|
345 |
*/
|
|
346 |
void GetNotYetPlayedPlaylistEpisodesL(const TArray<TMPXAttribute>& aAttrs,
|
|
347 |
CMPXMediaArray& aMediaArray, TInt& aIndexOfCurrentlyPlayingItem);
|
|
348 |
|
|
349 |
/**
|
|
350 |
* Get the episodes from the podcast table that were added within the last 7 days
|
|
351 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
352 |
* selection criteria
|
|
353 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
354 |
* @param aIndexOfCurrentlyPlayingItem index of the currently playing
|
|
355 |
* episode or KErrNotFound(-1) if no currently playing episode within
|
|
356 |
* this playlist
|
|
357 |
*/
|
|
358 |
void GetRecentlyAddedPlaylistEpisodesL(const TArray<TMPXAttribute>& aAttrs,
|
|
359 |
CMPXMediaArray& aMediaArray, TInt& aIndexOfCurrentlyPlayingItem);
|
|
360 |
|
|
361 |
/**
|
|
362 |
* Get the episodes from the podcast table published today
|
|
363 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
364 |
* item in the media array
|
|
365 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
366 |
* selection criteria
|
|
367 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
368 |
*/
|
|
369 |
void GetTodayEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
370 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
371 |
|
|
372 |
/**
|
|
373 |
* Get the episodes from the podcast table published today
|
|
374 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
375 |
* item in the media array
|
|
376 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
377 |
* selection criteria
|
|
378 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
379 |
*/
|
|
380 |
void GetYesterdayEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
381 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
382 |
|
|
383 |
/**
|
|
384 |
* Get the episodes from the podcast table published this week
|
|
385 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
386 |
* item in the media array
|
|
387 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
388 |
* selection criteria
|
|
389 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
390 |
*/
|
|
391 |
void GetThisWeekEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
392 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
393 |
|
|
394 |
/**
|
|
395 |
* Get the episodes from the podcast table published last week.
|
|
396 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
397 |
* item in the media array
|
|
398 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
399 |
* selection criteria
|
|
400 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
401 |
*/
|
|
402 |
void GetLastWeekEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
403 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
404 |
|
|
405 |
/**
|
|
406 |
* Get the episodes from the podcast table published two weeks ago
|
|
407 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
408 |
* item in the media array
|
|
409 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
410 |
* selection criteria
|
|
411 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
412 |
*/
|
|
413 |
void Get2WeeksAgoEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
414 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
415 |
|
|
416 |
/**
|
|
417 |
* Get the episodes from the podcast table published three weeks ago
|
|
418 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
419 |
* item in the media array
|
|
420 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
421 |
* selection criteria
|
|
422 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
423 |
*/
|
|
424 |
void Get3WeeksAgoEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
425 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
426 |
|
|
427 |
/**
|
|
428 |
* Get the episodes from the podcast table published last month
|
|
429 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
430 |
* item in the media array
|
|
431 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
432 |
* selection criteria
|
|
433 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
434 |
*/
|
|
435 |
void GetLastMonthEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
436 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
437 |
|
|
438 |
/**
|
|
439 |
* Get the episodes from the podcast table published earlier
|
|
440 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
441 |
* item in the media array
|
|
442 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
443 |
* selection criteria
|
|
444 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
445 |
*/
|
|
446 |
void GetEarlierEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
447 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
448 |
|
|
449 |
/**
|
|
450 |
* Get the episodes from the podcast table without a publish date
|
|
451 |
* @param aPublishDateCategoryId if specified (> 0), record the category id in the
|
|
452 |
* item in the media array
|
|
453 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
454 |
* selection criteria
|
|
455 |
* @param aMediaArray Array to place all the matching episodes' required info
|
|
456 |
*/
|
|
457 |
void GetUnknownEpisodesL(const TMPXItemId& aPublishDateCategoryId,
|
|
458 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
459 |
|
|
460 |
/**
|
|
461 |
* Find the total number of episodes without loading any media objects
|
|
462 |
* Generates a simple sql query to open a column quickly to find the count
|
|
463 |
* @return number of items
|
|
464 |
*/
|
|
465 |
TInt CountL();
|
|
466 |
|
|
467 |
/**
|
|
468 |
* Get the number of episodes from the podcast table published today
|
|
469 |
* @return Number of episodes published today.
|
|
470 |
*/
|
|
471 |
TInt GetTodayEpisodesCountL();
|
|
472 |
|
|
473 |
/**
|
|
474 |
* Get the number of episodes from the podcast table published today
|
|
475 |
* @return Number of episodes published yesterday.
|
|
476 |
*/
|
|
477 |
TInt GetYesterdayEpisodesCountL();
|
|
478 |
|
|
479 |
/**
|
|
480 |
* Get the number of episodes from the podcast table published this week
|
|
481 |
* @return Number of episodes published this week.
|
|
482 |
*/
|
|
483 |
TInt GetThisWeekEpisodesCountL();
|
|
484 |
|
|
485 |
/**
|
|
486 |
* Get the number of episodes from the podcast table published last week.
|
|
487 |
* @return Number of episodes published last week.
|
|
488 |
*/
|
|
489 |
TInt GetLastWeekEpisodesCountL();
|
|
490 |
|
|
491 |
/**
|
|
492 |
* Get the number of episodes from the podcast table published two weeks ago
|
|
493 |
* @return Number of episodes published 2 weeks ago.
|
|
494 |
*/
|
|
495 |
TInt Get2WeeksAgoEpisodesCountL();
|
|
496 |
|
|
497 |
/**
|
|
498 |
* Get the number of episodes from the podcast table published three weeks ago
|
|
499 |
* @return Number of episodes published 3 weeks ago.
|
|
500 |
*/
|
|
501 |
TInt Get3WeeksAgoEpisodesCountL();
|
|
502 |
|
|
503 |
/**
|
|
504 |
* Get the number of episodes from the podcast table published last month
|
|
505 |
* @return Number of episodes published last month.
|
|
506 |
*/
|
|
507 |
TInt GetLastMonthEpisodesCountL();
|
|
508 |
|
|
509 |
/**
|
|
510 |
* Get the number of episodes from the podcast table published earlieronth.
|
|
511 |
*/
|
|
512 |
TInt GetEarlierEpisodesCountL();
|
|
513 |
|
|
514 |
/**
|
|
515 |
* Get the episodes from the podcast table without a publish date
|
|
516 |
* @return Number of episodes without a publish date.
|
|
517 |
*/
|
|
518 |
TInt GetUnknownEpisodesCountL();
|
|
519 |
|
|
520 |
/**
|
|
521 |
* Find the total number of episodes recently added.
|
|
522 |
* @return number of episodes
|
|
523 |
*/
|
|
524 |
TInt GetRecentlyAddedEpisodesCountL();
|
|
525 |
|
|
526 |
/**
|
|
527 |
* Find the total number of episodes that have not been played without loading
|
|
528 |
* any media objects. Generates a simple sql query to open al column quickly
|
|
529 |
* to find the count
|
|
530 |
* @return number of items
|
|
531 |
*/
|
|
532 |
TInt GetNotYetPlayedEpisodesCountL();
|
|
533 |
|
|
534 |
/**
|
|
535 |
* Find episode(s) which match(es) the selection criteria
|
|
536 |
* @param aGeneralId selection criteria (could be episode/album/artist/genre/composer Id)
|
|
537 |
* @param aContainerId selection criteria (could be artist/album id)
|
|
538 |
* @param aType criteria type (EMPXItem or EMPXGroup)
|
|
539 |
* @param aPodcastType podcast criteria type (EMPXPodcastGroup or EMPXPodcastItem)
|
|
540 |
* @param aCriteria selection criteria
|
|
541 |
* @param aAttrs the attributes to include for the artist(s) matching the
|
|
542 |
* selection criteria
|
|
543 |
* @param aMediaArray Returns the episodes matching the selection criteria
|
|
544 |
*/
|
|
545 |
void FindEpisodesL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
|
|
546 |
TMPXPodcastType aPodcastType, const CMPXMedia& aCriteria,
|
|
547 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
|
|
548 |
|
|
549 |
/**
|
|
550 |
* Sets the value of the IsPlaying field for a given episode
|
|
551 |
* @param aEpisodeId identifies the episode
|
|
552 |
* @param aIsPlaying IsPlaying field value
|
|
553 |
*/
|
|
554 |
void SetIsPlayingL(TUint32 aEpisodeId, TBool aIsPlaying);
|
|
555 |
|
|
556 |
/**
|
|
557 |
* Returns the podcast count for a given drive
|
|
558 |
* @param aDrive drive
|
|
559 |
* @return the count
|
|
560 |
*/
|
|
561 |
TUint GetDrivePodcastCountL(TInt aDrive);
|
|
562 |
|
|
563 |
/**
|
|
564 |
* Get URIs for a given number of podcasts
|
|
565 |
* @param aDrive, specifies drive number for db selection
|
|
566 |
* @param aFromID, specifies unique ID of last record retrieved
|
|
567 |
* @param aRecords, specifies the number of records to get
|
|
568 |
* @param aUriArr, will contain all URIs on return
|
|
569 |
* @param aLastID, will contain unique ID of a last record in the array
|
|
570 |
*/
|
|
571 |
void GetPodcastUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
|
|
572 |
CDesCArray& aUriArr, TInt& aLastID);
|
|
573 |
|
|
574 |
private:
|
|
575 |
|
|
576 |
/**
|
|
577 |
* Adds an episode to the Podcast table
|
|
578 |
* @param aEpisodeId identifies the episode
|
|
579 |
* @param aMedia contains the episode attributes
|
|
580 |
* @param aDrive drive to add the episode to
|
|
581 |
* @param aItemChangedMessages item changed messages to update
|
|
582 |
*/
|
|
583 |
TBool DoAddEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia, TInt aDrive,
|
|
584 |
CMPXMessageArray* aItemChangedMessages);
|
|
585 |
|
|
586 |
/**
|
|
587 |
* Updates an episode in the Podcast table
|
|
588 |
* @param aEpisodeId identifies the episode
|
|
589 |
* @param aMedia contains the episode attributes
|
|
590 |
* @param aItemChangedMessages NULL or item changed messages to update
|
|
591 |
*/
|
|
592 |
CMPXDbActiveTask::TChangeVisibility DoUpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
|
|
593 |
CMPXMessageArray* aItemChangedMessages);
|
|
594 |
|
|
595 |
/**
|
|
596 |
* Updates an episode in the Podcast table
|
|
597 |
* @param aEpisodeId identifies the episode
|
|
598 |
* @param aMedia contains the episode attributes
|
|
599 |
* @param aDrive drive to add the episode to
|
|
600 |
* @param aItemChangedMessages item changed messages to update
|
|
601 |
* @param aRecordset current episode record in the Podcast table.
|
|
602 |
* Required to detect any field changes.
|
|
603 |
*/
|
|
604 |
CMPXDbActiveTask::TChangeVisibility DoUpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia, TInt aDrive,
|
|
605 |
CMPXMessageArray* aItemChangedMessages, RSqlStatement& aRecordset);
|
|
606 |
|
|
607 |
/**
|
|
608 |
* Deletes an episode corresponding to the current record in aRecordset
|
|
609 |
* @param aRecordset current episode record in the Podcast table.
|
|
610 |
* Required to detect any field changes.
|
|
611 |
* @param aUriArray Returns the episode URI
|
|
612 |
* @param aItemChangedMessages Returns item changed messages
|
|
613 |
* @param aDeleteRecord ETrue if the episode should be deleted, EFalse if it
|
|
614 |
* should just be marked as deleted
|
|
615 |
*/
|
|
616 |
void DeleteRecordsetL(RSqlStatement& aRecordset, CDesCArray& aUriArray,
|
|
617 |
CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
|
|
618 |
|
|
619 |
/**
|
|
620 |
* Remove a episode from the podcast table
|
|
621 |
* @param aRecordset episode record to be removed
|
|
622 |
* @param aUriArray, on return will be filled with all the paths that were removed
|
|
623 |
* @param aItemChangedMessages: change events as result of the episode removal
|
|
624 |
* @param IsAdd denotes whether DoDeleteEpisodeL is called as part of
|
|
625 |
* adding an episode or deleting an episode.
|
|
626 |
* @param aDeleteRecord: indicates whether the client has explictly requested
|
|
627 |
* to delete the records from the database. If ETrue, records
|
|
628 |
* associated with the media will be deleted from the database;
|
|
629 |
* if EFalse, whether to mark the records as deleted or to delete
|
|
630 |
* the records will be based on other deciding factors.
|
|
631 |
* @return Error code.
|
|
632 |
*/
|
|
633 |
void DoDeleteEpisodeL(RSqlStatement& aRecordset, CDesCArray& aUriArray,
|
|
634 |
CMPXMessageArray& aItemChangedMessages, TBool IsAdd, TBool aDeleteRecord = EFalse);
|
|
635 |
|
|
636 |
/**
|
|
637 |
* Constructs the fields and corresponding values to be written into the Podcast
|
|
638 |
* table for update and insert statements.
|
|
639 |
* @param aEpisodeId identifies the song
|
|
640 |
* @param aMedia contains the new song attributes
|
|
641 |
* @param aItemChangedMessages item changed mesages to add to
|
|
642 |
* @param aPodcastTable points to the existing record in the Podcast table for
|
|
643 |
* updates or NULL for inserts
|
|
644 |
* @param aFields returns the field names to be updated
|
|
645 |
* @param aValues returns the field values to be updated
|
|
646 |
* @param aDrive drive the song is on
|
|
647 |
* @return ETrue if the change is visible in the UI
|
|
648 |
*/
|
|
649 |
CMPXDbActiveTask::TChangeVisibility GeneratePodcastFieldsValuesL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
|
|
650 |
CMPXMessageArray* aItemChangedMessages, RSqlStatement* aPodcastTable,
|
|
651 |
CDesCArray& aFields, CDesCArray& aValues, TInt aDrive);
|
|
652 |
|
|
653 |
/**
|
|
654 |
* Checks if the specified category field (artist/album/genre/composer)
|
|
655 |
* will change and notifies the observer if so.
|
|
656 |
* @param aCategory identifies the category
|
|
657 |
* @param aMedia contains the new record attributes
|
|
658 |
* @param aAttribute corresponding attribute in the media parameter
|
|
659 |
* @param aOldId previous value of the category field or 0 if new record
|
|
660 |
* @param aDriveId drive ID the update is for
|
|
661 |
* @param aItemChangedMessages item changed messages to append to
|
|
662 |
* @param aItemId returns the category item ID
|
|
663 |
* @return ETrue if the field was modified
|
|
664 |
*/
|
|
665 |
TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
|
|
666 |
const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
|
|
667 |
CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
|
|
668 |
|
|
669 |
/**
|
|
670 |
* Update the media with information found in DB
|
|
671 |
* @param aPodcastTable podcast record
|
|
672 |
* @param aAttrs, the attributes to include for the artist(s) matching the
|
|
673 |
* selection criteria
|
|
674 |
* @param aMedia the episode details object
|
|
675 |
*/
|
|
676 |
void UpdateMediaL(RSqlStatement& aPodcastTable, const TArray<TMPXAttribute>& aAttrs,
|
|
677 |
CMPXMedia& aMedia);
|
|
678 |
|
|
679 |
/**
|
|
680 |
* Set the media general attributes in media object with its corresponding
|
|
681 |
* value from the podcast table
|
|
682 |
* @param aPodcastTable podcast record
|
|
683 |
* @param aAttrId the required attributes
|
|
684 |
* @param aMedia the media object to set
|
|
685 |
*/
|
|
686 |
void UpdateMediaGeneralL(RSqlStatement& aPodcastTable, TUint aAttrId,
|
|
687 |
CMPXMedia& aMedia);
|
|
688 |
|
|
689 |
/**
|
|
690 |
* Set the media podcast attributes in media object with its corresponding
|
|
691 |
* value from the podcast table
|
|
692 |
* @param aPodcastTable podcast record
|
|
693 |
* @param aAttrId the required attributes
|
|
694 |
* @param aMedia the media object to set
|
|
695 |
*/
|
|
696 |
void UpdateMediaMusicL(RSqlStatement& aPodcastTable, TUint aAttrId,
|
|
697 |
CMPXMedia& aMedia);
|
|
698 |
|
|
699 |
/**
|
|
700 |
* Set the media audio attributes in media object with its corresponding
|
|
701 |
* value from the podcast table
|
|
702 |
* @param aPodcastTable podcast record
|
|
703 |
* @param aAttrId the required attributes
|
|
704 |
* @param aMedia the media object to set
|
|
705 |
*/
|
|
706 |
void UpdateMediaAudioL(RSqlStatement& aPodcastTable, TUint aAttrId,
|
|
707 |
CMPXMedia& aMedia);
|
|
708 |
|
|
709 |
/**
|
|
710 |
* Set the podcast attributes in media object with its corresponding value
|
|
711 |
* from the podcast table
|
|
712 |
* @param aPodcastTable podcast record
|
|
713 |
* @param aAttrId the required attributes
|
|
714 |
* @param aMedia the media object to set
|
|
715 |
*/
|
|
716 |
void UpdateMediaPodcastL(RSqlStatement& aPodcastTable, TUint aAttrId,
|
|
717 |
CMPXMedia& aMedia);
|
|
718 |
|
|
719 |
/**
|
|
720 |
* Get the DRM type of the given file
|
|
721 |
* @param aFile: file
|
|
722 |
* @return DRM type.
|
|
723 |
*/
|
|
724 |
TMCDrmType DRMTypeL(const TDesC& aFile);
|
|
725 |
|
|
726 |
/**
|
|
727 |
* Generate matching columns and matching values for podcast table from the given criteria
|
|
728 |
* @param aGeneralId, selection criteria (could be episode/album/artist/genre/composer Id)
|
|
729 |
* @param aContainerId, selection criteria (could be artist/album id)
|
|
730 |
* @param aType, criteria type (EMPXItem or EMPXGroup)
|
|
731 |
* @param aPodcastType, podcast criteria type (EMPXPodcastGroup or EMPXPodcastItem)
|
|
732 |
* @param aCriteria, selection criteria
|
|
733 |
* @return Newly allocated SQL criteria string on the CS.
|
|
734 |
* Ownership is passed to the caller.
|
|
735 |
*/
|
|
736 |
HBufC* GeneratePodcastMatchingCriteriaLC(TUint32 aGeneralId, TUint32 aContainerId,
|
|
737 |
TMPXGeneralType aType, TMPXPodcastType aPodcastType, const CMPXMedia& aCriteria);
|
|
738 |
|
|
739 |
/**
|
|
740 |
* Generate publish date category criteria string for the specified
|
|
741 |
* publish date category
|
|
742 |
* @param aPublishDateCateogry the publish date category to generate
|
|
743 |
* criteria string for
|
|
744 |
* @return the generated criteria string
|
|
745 |
*/
|
|
746 |
HBufC* GeneratePublishDateCategoryCriteriaL(const TUint& aPublishDateCategoryID);
|
|
747 |
|
|
748 |
/**
|
|
749 |
* Generates a full URI from a Podcast record.
|
|
750 |
* @param aRecordset Podcast table record
|
|
751 |
* @return Full URI string. The ownership is passed to the caller.
|
|
752 |
*/
|
|
753 |
HBufC* ConstructUriL(RSqlStatement& aRecordset);
|
|
754 |
|
|
755 |
/**
|
|
756 |
* Checks if the specified episode exists.
|
|
757 |
* @param aId identifies the episode
|
|
758 |
* @return ETrue if it exists, EFalse otherwise
|
|
759 |
*/
|
|
760 |
TBool EpisodeExistsL(TUint32 aEpisodeId);
|
|
761 |
|
|
762 |
/**
|
|
763 |
* Checks if extra attributes are required. The "standard" attribute set includes:
|
|
764 |
* EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
|
|
765 |
* EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
|
|
766 |
* @param aAttrs attributes to be checked
|
|
767 |
* @return ETrue if extra attributes are required
|
|
768 |
*/
|
|
769 |
TBool ExtraFieldsRequired(const TArray<TMPXAttribute>& aAttrs);
|
|
770 |
|
|
771 |
/**
|
|
772 |
* Adds the publish date category ID as a MPXMediaPodcastPubDateCategoryId
|
|
773 |
* attribute to the last media item in the array. Only does this if
|
|
774 |
* the category id is valid (<>0).
|
|
775 |
* @param aPublishDateCategoryId category ID to be added
|
|
776 |
* @param aMediaArray array containing media items
|
|
777 |
*/
|
|
778 |
void ProcessPublishDateCategoryL(const TMPXItemId& aPublishDateCategoryId,
|
|
779 |
CMPXMediaArray& aMediaArray);
|
|
780 |
|
|
781 |
/**
|
|
782 |
* Returns the index of the playing item in the arry or KErrNotFound if no
|
|
783 |
* item is marked as playing.
|
|
784 |
* @param aMediaArray array to be processed
|
|
785 |
* @return index of playing item or KErrNotFound
|
|
786 |
*/
|
|
787 |
TInt GetPlayingItemL(CMPXMediaArray& aMediaArray);
|
|
788 |
|
|
789 |
private: // from MMPXTable
|
|
790 |
|
|
791 |
/**
|
|
792 |
* @see MMPXTable
|
|
793 |
*/
|
|
794 |
virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
|
|
795 |
|
|
796 |
/**
|
|
797 |
* @see MMPXTable
|
|
798 |
*/
|
|
799 |
virtual void DropTableL(RSqlDatabase& aDatabase);
|
|
800 |
|
|
801 |
/**
|
|
802 |
* @see MMPXTable
|
|
803 |
*/
|
|
804 |
virtual TBool CheckTableL(RSqlDatabase& aDatabase);
|
|
805 |
|
|
806 |
private:
|
|
807 |
|
|
808 |
/**
|
|
809 |
* C++ constructor.
|
|
810 |
* @param aDbManager database manager to use for database interactions
|
|
811 |
* @param aObserver Observer for podcast notifications
|
|
812 |
*/
|
|
813 |
CMPXDbPodcast(CMPXDbManager& aDbManager,
|
|
814 |
MMPXDbPodcastObserver& aObserver);
|
|
815 |
|
|
816 |
/**
|
|
817 |
* Symbian 2nd phase constructor.
|
|
818 |
*/
|
|
819 |
void ConstructL(CMPXResource& aResource);
|
|
820 |
|
|
821 |
private:
|
|
822 |
|
|
823 |
/**
|
|
824 |
* Column indexes in the music table
|
|
825 |
*/
|
|
826 |
enum TPodcastColumns
|
|
827 |
{
|
|
828 |
EPodcastUniqueId = KMPXTableDefaultIndex,
|
|
829 |
EPodcastDeleted,
|
|
830 |
EPodcastDbFlag,
|
|
831 |
EPodcastVolumeId,
|
|
832 |
EPodcastIsPlaying,
|
|
833 |
EPodcastTitle,
|
|
834 |
EPodcastLocation,
|
|
835 |
EPodcastPublishDate,
|
|
836 |
EPodcastAlbumTrack,
|
|
837 |
EPodcastPlayCount,
|
|
838 |
EPodcastTimeAdded,
|
|
839 |
EPodcastTimePlayed,
|
|
840 |
EPodcastDuration,
|
|
841 |
EPodcastSync,
|
|
842 |
EPodcastModified,
|
|
843 |
EPodcastArtist,
|
|
844 |
EPodcastAlbum,
|
|
845 |
EPodcastGenre,
|
|
846 |
EPodcastComposer,
|
|
847 |
EPodcastReleaseDate,
|
|
848 |
EPodcastRating,
|
|
849 |
EPodcastComment,
|
|
850 |
EPodcastCopyright,
|
|
851 |
EPodcastArt,
|
|
852 |
EPodcastUrl,
|
|
853 |
EPodcastDRM,
|
|
854 |
EPodcastLastPlayPosition,
|
|
855 |
EPodcastSampleRate,
|
|
856 |
EPodcastBitRate,
|
|
857 |
EPodcastNumChannels,
|
|
858 |
EPodcastCodec,
|
|
859 |
EPodcastMimeType,
|
|
860 |
EPodcastArtistName,
|
|
861 |
EPodcastAlbumName,
|
|
862 |
EPodcastGenreName,
|
|
863 |
EPodcastComposerName,
|
|
864 |
EPodcastFieldCount
|
|
865 |
};
|
|
866 |
|
|
867 |
private: // Data
|
|
868 |
|
|
869 |
CDesCArrayFlat* iExtensionsDrm; // file extensions to check DRM type, owned
|
|
870 |
MMPXDbPodcastObserver& iObserver;
|
|
871 |
};
|
|
872 |
|
|
873 |
#endif // MPXDBPODCAST_H
|
|
874 |
|
|
875 |
// End of File
|