1 /* |
|
2 * Copyright (c) 2008 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <mpxcollectionutility.h> |
|
21 #include <mpxmediacontainerdefs.h> |
|
22 #include <mpxmediageneraldefs.h> |
|
23 #include <mpxmessagegeneraldefs.h> |
|
24 #include <mpxcollectionmessagedefs.h> |
|
25 #include <mpxcollectionpath.h> |
|
26 #include <mpxmessage2.h> |
|
27 #include <mpxcollectionmessage.h> |
|
28 #include <mpxlog.h> |
|
29 #include <mpxitemid.h> |
|
30 #include <mpxmessagecontainerdefs.h> |
|
31 #include <vcxmyvideosdefs.h> |
|
32 #include <vcxmyvideosuids.h> |
|
33 #include <mpxcommandgeneraldefs.h> |
|
34 #include <mpxcollectioncommanddefs.h> |
|
35 #include "IptvDebug.h" |
|
36 |
|
37 #include "videocontentharvesterplugin.h" |
|
38 #include "videocontentharvestermpxclient.h" |
|
39 #include "videochpublishabledata.h" |
|
40 #include "videochpublisher.h" |
|
41 #include "videonotificationlauncher.h" |
|
42 #include "videochmcategorylistener.h" |
|
43 #include "videoahpluginconstants.h" |
|
44 #include "iptvlastwatchedapi.h" |
|
45 #include "iptvlastwatcheddata.h" |
|
46 |
|
47 const TInt KVcxMpxLevelCategories = 2; |
|
48 const TInt KVcxMpxLevelVideos = 3; |
|
49 |
|
50 const TUint32 KVcxnsCHUid = 0x2001B2A8; |
|
51 |
|
52 // ======== MEMBER FUNCTIONS ======== |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CVcxNsContentHarvesterMpxClient::CVcxNsContentHarvesterMpxClient( CVcxNsChPublisher* aPublisher, |
|
59 CVcxNsChPublishableData* aPublishableData, |
|
60 CVcxNsContentHarvesterPlugin* aPlugin ): |
|
61 iCollectionOpenStatus( EVcxNsCollectionNotOpen ), |
|
62 iPublisher( aPublisher ), |
|
63 iPublishableData( aPublishableData ), |
|
64 iPlugin( aPlugin ) |
|
65 { |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CVcxNsContentHarvesterMpxClient::ConstructL() |
|
73 { |
|
74 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::ConstructL IN"); |
|
75 |
|
76 TUid domain = TUid::Uid( KVcxNsMpxMediatorDomain ); |
|
77 TUid category = TUid::Uid( KVcxNsMpxMediatorCategory ); |
|
78 TVersion version = TVersion( KVcxNsMpxEventVersion, 0, 0 ); |
|
79 |
|
80 iMCategoryListener = CVcxNsChMCategoryListener::NewL( this, |
|
81 domain, |
|
82 category, |
|
83 version ); |
|
84 TInt event = TInt( KVcxNsMpxEventDownloadStarted ); |
|
85 iMCategoryListener->RegisterAndSubscribeL( event ); |
|
86 |
|
87 event = TInt( KVcxNsMpxEventAllDownloadsEnded ); |
|
88 iMCategoryListener->RegisterAndSubscribeL( event ); |
|
89 |
|
90 domain = TUid::Uid( KVcxNsAhMediatorDomain ); |
|
91 category = TUid::Uid( KVcxNsAhMediatorCategory ); |
|
92 version = TVersion( KVcxNsAhEventVersion, 0, 0 ); |
|
93 |
|
94 iAhCategoryListener= CVcxNsChMCategoryListener::NewL( this, |
|
95 domain, |
|
96 category, |
|
97 version ); |
|
98 |
|
99 event = TInt( KVcxNsAhEventSuiteLoaded ); |
|
100 iAhCategoryListener->RegisterAndSubscribeL( event ); |
|
101 |
|
102 event = TInt( KVcxNsAhEventSuiteUnloaded ); |
|
103 iAhCategoryListener->RegisterAndSubscribeL( event ); |
|
104 |
|
105 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::ConstructL OUT"); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 CVcxNsContentHarvesterMpxClient* CVcxNsContentHarvesterMpxClient::NewL( CVcxNsChPublisher* aPublisher, |
|
113 CVcxNsChPublishableData* aPublishableData, |
|
114 CVcxNsContentHarvesterPlugin* aPlugin ) |
|
115 { |
|
116 CVcxNsContentHarvesterMpxClient* self = new( ELeave ) CVcxNsContentHarvesterMpxClient( aPublisher, |
|
117 aPublishableData, |
|
118 aPlugin ); |
|
119 |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL(); |
|
122 CleanupStack::Pop( self ); |
|
123 |
|
124 return self; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 CVcxNsContentHarvesterMpxClient::~CVcxNsContentHarvesterMpxClient() |
|
132 { |
|
133 delete iMCategoryListener; |
|
134 delete iAhCategoryListener; |
|
135 |
|
136 delete iObservedCategory; |
|
137 CloseCollection(); |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 void CVcxNsContentHarvesterMpxClient::HandleCollectionMediaL( |
|
145 const CMPXMedia& /*aMedia*/, |
|
146 TInt /*aError*/ ) |
|
147 { |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CVcxNsContentHarvesterMpxClient::HandleCollectionMessage( |
|
155 CMPXMessage* aMessage, |
|
156 TInt aError ) |
|
157 { |
|
158 TRAP_IGNORE( HandleCollectionMessageL( aMessage, aError ) ); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CVcxNsContentHarvesterMpxClient::HandleCollectionMessageL( |
|
166 CMPXMessage* aMessage, |
|
167 TInt aError ) |
|
168 { |
|
169 HandleSingleCollectionMessageL( aMessage, aError ); |
|
170 |
|
171 if ( aMessage->IsSupported( KMPXMessageArrayContents ) ) |
|
172 { |
|
173 const CMPXMessageArray* messageArray = |
|
174 aMessage->Value<CMPXMessageArray>( KMPXMessageArrayContents ); |
|
175 for( TInt i = 0; i < messageArray->Count(); i++ ) |
|
176 { |
|
177 HandleSingleCollectionMessageL( (*messageArray)[i], KErrNone ); |
|
178 } |
|
179 } |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CVcxNsContentHarvesterMpxClient::HandleSingleCollectionMessageL( |
|
187 CMPXMessage* aMessage, |
|
188 TInt aError ) |
|
189 { |
|
190 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleSingleCollectionMessageL IN"); |
|
191 |
|
192 if ( aMessage && aError == KErrNone ) |
|
193 { |
|
194 switch ( *( aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) ) ) |
|
195 { |
|
196 case KVcxCommandIdMyVideos: |
|
197 { |
|
198 if ( aMessage->IsSupported( KVcxMediaMyVideosCommandId ) ) |
|
199 { |
|
200 TInt mvMsgId = *(aMessage->Value<TInt>( KVcxMediaMyVideosCommandId ) ); |
|
201 |
|
202 switch ( mvMsgId ) |
|
203 { |
|
204 case KVcxMessageMyVideosItemsAppended: |
|
205 HandleMyVideosItemsAppendedL( aMessage, aError ); |
|
206 break; |
|
207 case KVcxMessageMyVideosGetMediasByMpxIdResp: |
|
208 break; |
|
209 default: |
|
210 break; |
|
211 } |
|
212 } |
|
213 } |
|
214 break; |
|
215 case KMPXMessageGeneral: |
|
216 { |
|
217 TInt event( *(aMessage->Value<TInt>( KMPXMessageGeneralEvent )) ); |
|
218 TInt data( *(aMessage->Value<TInt>( KMPXMessageGeneralData )) ); |
|
219 |
|
220 switch ( event ) |
|
221 { |
|
222 case TMPXCollectionMessage::EPathChanged: |
|
223 { |
|
224 if ( data == EMcContainerOpened ) |
|
225 { |
|
226 if ( iCollectionOpenStatus == EVcxNsCollectionOpening ) |
|
227 { |
|
228 iCollectionOpenStatus = EVcxNsCollectionOpened; |
|
229 } |
|
230 if( iCollectionUtility ) |
|
231 { |
|
232 iCollectionUtility->Collection().OpenL(); |
|
233 } |
|
234 } |
|
235 } |
|
236 break; |
|
237 |
|
238 case TMPXCollectionMessage::ECollectionChanged: |
|
239 case TMPXCollectionMessage::EBroadcastEvent: |
|
240 case TMPXCollectionMessage::ENoEvent: |
|
241 case TMPXCollectionMessage::EError: |
|
242 case TMPXCollectionMessage::EMediaChanged: |
|
243 case TMPXCollectionMessage::EItemChanged: |
|
244 case TMPXCollectionMessage::EFocusChanged: |
|
245 case TMPXCollectionMessage::EAsyncOpComplete: |
|
246 case TMPXCollectionMessage::EExtendedMessage: |
|
247 default: |
|
248 break; |
|
249 } |
|
250 } |
|
251 break; |
|
252 case KMPXMessageIdItemChanged: |
|
253 { |
|
254 HandleMyVideosItemsChangedL( aMessage, aError ); |
|
255 } |
|
256 break; |
|
257 |
|
258 default: |
|
259 break; |
|
260 } |
|
261 } |
|
262 |
|
263 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleSingleCollectionMessageL OUT"); |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void CVcxNsContentHarvesterMpxClient::HandleOpenL( |
|
271 const CMPXMedia& aEntries, |
|
272 TInt /*aIndex*/, |
|
273 TBool /*aComplete*/, |
|
274 TInt aError ) |
|
275 { |
|
276 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleOpenL IN"); |
|
277 if ( aError == KErrNone ) |
|
278 { |
|
279 TInt levels = CollectionLevelL(); |
|
280 |
|
281 // should the interesting level be the root? |
|
282 if ( levels == KVcxMpxLevelCategories ) |
|
283 { |
|
284 // Check that entry has an array of contents. |
|
285 if ( aEntries.IsSupported( KMPXMediaArrayContents ) ) |
|
286 { |
|
287 CMPXMediaArray* pointerArray = |
|
288 aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
289 CMPXMediaArray* categoryArray = CMPXMediaArray::NewL( *pointerArray ); |
|
290 CleanupStack::PushL( categoryArray ); |
|
291 |
|
292 SearchAndStoreCategoryL( categoryArray ); |
|
293 |
|
294 CleanupStack::Pop( categoryArray ); |
|
295 } |
|
296 } |
|
297 } |
|
298 |
|
299 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleOpenL OUT"); |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void CVcxNsContentHarvesterMpxClient::HandleOpenL( |
|
307 const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
308 TInt /*aError*/ ) |
|
309 { |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 void CVcxNsContentHarvesterMpxClient::HandleCommandComplete( |
|
317 CMPXCommand* /*aCommandResult*/, |
|
318 TInt /*aError*/ ) |
|
319 { |
|
320 } |
|
321 |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 // ----------------------------------------------------------------------------- |
|
325 // |
|
326 void CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsAppendedL( CMPXMessage* /*aMessage*/, |
|
327 TInt /*aError*/ ) |
|
328 { |
|
329 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsAppendedL IN"); |
|
330 |
|
331 TInt levels = CollectionLevelL(); |
|
332 |
|
333 if ( levels == KVcxMpxLevelCategories ) |
|
334 { |
|
335 UpdateNewVideoCountL(); |
|
336 } |
|
337 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsAppendedL OUT"); |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 void CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsChangedL( CMPXMessage* aMessage, |
|
345 TInt /*aError*/ ) |
|
346 { |
|
347 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsChangedL IN"); |
|
348 |
|
349 if( aMessage && aMessage->IsSupported( KMPXMessageChangeEventType ) ) |
|
350 { |
|
351 TMPXChangeEventType eventType( |
|
352 *aMessage->Value<TMPXChangeEventType>( KMPXMessageChangeEventType ) ); |
|
353 |
|
354 |
|
355 if( eventType == EMPXItemDeleted ) |
|
356 { |
|
357 HandleContentModifiedL( aMessage ); |
|
358 } |
|
359 |
|
360 TMPXItemId eventData( |
|
361 *aMessage->Value<TMPXItemId>( KMPXMessageMediaGeneralId ) ); |
|
362 |
|
363 TInt levels = CollectionLevelL(); |
|
364 |
|
365 if ( levels == KVcxMpxLevelCategories ) |
|
366 { |
|
367 UpdateNewVideoCountL(); |
|
368 } |
|
369 } |
|
370 |
|
371 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::HandleMyVideosItemsChangedL OUT"); |
|
372 } |
|
373 |
|
374 // ---------------------------------------------------------------------------- |
|
375 // |
|
376 // ---------------------------------------------------------------------------- |
|
377 // |
|
378 void CVcxNsContentHarvesterMpxClient::HandleContentModifiedL( CMPXMessage* aMessage ) |
|
379 { |
|
380 // check preloaded content allways, in case it's data still exists in the PS |
|
381 TPtrC preloadedName = |
|
382 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
383 TPtrC8( KTvVideoName ) ); |
|
384 |
|
385 TPtrC preloadedPath = |
|
386 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
387 TPtrC8( KTvVideoPath ) ); |
|
388 |
|
389 TPtrC lastWatchedName = |
|
390 iPublishableData->GetDesCDataL( EVCxNsCPContentLastWatched, |
|
391 TPtrC8( KTvVideoName ) ); |
|
392 TInt lastWType = |
|
393 iPublishableData->GetIntDataL( EVCxNsCPContentLastWatched, |
|
394 TPtrC8( KTvVideoLastWatchedType ) ); |
|
395 if( preloadedName.Length() > 0 ) |
|
396 { |
|
397 TPtrC filePath = |
|
398 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
399 TPtrC8( KTvVideoPath ) ); |
|
400 if( !iPublishableData->FileExists( filePath ) ) |
|
401 { |
|
402 // file no longer exists, remove it's data from the CP |
|
403 iPublisher->DeleteContentL( EVCxNsCPContentPreloaded ); |
|
404 } |
|
405 else |
|
406 { |
|
407 iPublisher->PublishContentL( EVCxNsCPContentPreloaded ); |
|
408 } |
|
409 } |
|
410 |
|
411 // check last watched item |
|
412 if( lastWatchedName.Length() > 0 && lastWType == EVCxNsCPContentLastWatched ) |
|
413 { |
|
414 |
|
415 TMPXItemId itemId = aMessage->ValueTObjectL< TMPXItemId >( KMPXMessageMediaGeneralId ); |
|
416 // check if deleted was last watched |
|
417 CIptvLastWatchedData* data = CIptvLastWatchedData::NewL(); |
|
418 CleanupStack::PushL( data ); |
|
419 iPublishableData->LastWatchedApi().GetLastWatchedDataL( *data ); |
|
420 if( data->MpxId() == itemId.iId1 ) |
|
421 { |
|
422 // last watched removed, clear data |
|
423 iPublishableData->ClearData( EVCxNsCPContentLastWatched ); |
|
424 iPublisher->PublishContentL( EVCxNsCPContentLastWatched ); |
|
425 } |
|
426 else |
|
427 { |
|
428 // check if preloaded was last watched |
|
429 if( preloadedName.Length() > 0 && !data->Uri().CompareF( preloadedPath ) ) |
|
430 { |
|
431 // it was, so clear last watched |
|
432 iPublishableData->ClearData( EVCxNsCPContentLastWatched ); |
|
433 iPublisher->PublishContentL( EVCxNsCPContentLastWatched ); |
|
434 } |
|
435 |
|
436 } |
|
437 CleanupStack::PopAndDestroy( data ); |
|
438 } |
|
439 } |
|
440 |
|
441 // ---------------------------------------------------------------------------- |
|
442 // |
|
443 // ---------------------------------------------------------------------------- |
|
444 // |
|
445 void CVcxNsContentHarvesterMpxClient::MediatorEventL( TUid aDomain, |
|
446 TUid aCategory, |
|
447 TInt aEventId, |
|
448 const TDesC8& ) |
|
449 { |
|
450 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::MediatorEventL IN"); |
|
451 |
|
452 if( aDomain == TUid::Uid( KVcxNsMpxMediatorDomain ) && |
|
453 aCategory == TUid::Uid( KVcxNsMpxMediatorCategory ) ) |
|
454 { |
|
455 if( aEventId == KVcxNsMpxEventDownloadStarted ) |
|
456 { |
|
457 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::MediatorEventL dl started"); |
|
458 |
|
459 iOngoingDownloads = ETrue; |
|
460 } |
|
461 if( aEventId == KVcxNsMpxEventAllDownloadsEnded ) |
|
462 { |
|
463 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::MediatorEventL dls finished"); |
|
464 |
|
465 iOngoingDownloads = EFalse; |
|
466 } |
|
467 } |
|
468 |
|
469 if( aDomain == TUid::Uid( KVcxNsAhMediatorDomain ) && |
|
470 aCategory == TUid::Uid( KVcxNsAhMediatorCategory ) ) |
|
471 { |
|
472 if( aEventId == KVcxNsAhEventSuiteLoaded ) |
|
473 { |
|
474 iTvVideoSuiteLoaded = ETrue; |
|
475 } |
|
476 if( aEventId == KVcxNsAhEventSuiteUnloaded ) |
|
477 { |
|
478 iTvVideoSuiteLoaded = EFalse; |
|
479 |
|
480 if( iOngoingDownloads ) |
|
481 { |
|
482 iPlugin->NotificationLauncher()->LaunchExitingNotificationL(); |
|
483 } |
|
484 } |
|
485 } |
|
486 |
|
487 if ( iCollectionOpenStatus == EVcxNsCollectionNotOpen ) |
|
488 { |
|
489 if ( iTvVideoSuiteLoaded || iOngoingDownloads ) |
|
490 { |
|
491 OpenCollectionL(); |
|
492 UpdateCategoryL(); |
|
493 } |
|
494 } |
|
495 else |
|
496 { |
|
497 if( !iTvVideoSuiteLoaded && !iOngoingDownloads ) |
|
498 { |
|
499 CloseCollection(); |
|
500 } |
|
501 } |
|
502 |
|
503 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::MediatorEventL OUT"); |
|
504 } |
|
505 |
|
506 // --------------------------------------------------------------------------- |
|
507 // |
|
508 // --------------------------------------------------------------------------- |
|
509 // |
|
510 TInt CVcxNsContentHarvesterMpxClient::CollectionLevelL() |
|
511 { |
|
512 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::CollectionLevelL"); |
|
513 |
|
514 if ( iCollectionUtility ) |
|
515 { |
|
516 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
517 CleanupStack::PushL( path ); |
|
518 TInt levels = path->Levels(); |
|
519 CleanupStack::PopAndDestroy( path ); |
|
520 |
|
521 return levels; |
|
522 } |
|
523 |
|
524 return KErrNotFound; |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // |
|
529 // --------------------------------------------------------------------------- |
|
530 // |
|
531 void CVcxNsContentHarvesterMpxClient::UpdateNewVideoCountL() |
|
532 { |
|
533 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::UpdateNewVideoCountL IN"); |
|
534 |
|
535 if( iObservedCategory && |
|
536 iObservedCategory->IsSupported( KVcxMediaMyVideosCategoryNewItemCount ) && |
|
537 iObservedCategory->IsSupported( KVcxMediaMyVideosCategoryItemCount ) ) |
|
538 { |
|
539 TInt newVideosCount = iObservedCategory->ValueTObjectL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount ); |
|
540 TInt videoCount = iObservedCategory->ValueTObjectL<TUint32>( KVcxMediaMyVideosCategoryItemCount ); |
|
541 TBool hasNewVideos = newVideosCount > 0; |
|
542 |
|
543 TBool hadNewVideos = |
|
544 iPublishableData->GetIntDataL( EVCxNsCPContentMyVideos, |
|
545 TPtrC8( KTvVideoHasNewVideos ) ); |
|
546 |
|
547 TInt savedCount = |
|
548 iPublishableData->GetIntDataL( EVCxNsCPContentMyVideos, |
|
549 TPtrC8( KTvVideoCount ) ); |
|
550 |
|
551 if( hasNewVideos != hadNewVideos || |
|
552 ( hasNewVideos && newVideosCount != savedCount ) || |
|
553 ( !hasNewVideos && videoCount != savedCount ) ) |
|
554 { |
|
555 if( hasNewVideos ) |
|
556 { |
|
557 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
558 TPtrC8( KTvVideoCount ), |
|
559 newVideosCount ); |
|
560 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
561 TPtrC8( KTvVideoHasNewVideos ), |
|
562 ETrue ); |
|
563 TPtrC newVideoName( iObservedCategory->ValueText( KVcxMediaMyVideosCategoryNewItemName ) ); |
|
564 |
|
565 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
566 TPtrC8( KTvVideoName ), |
|
567 newVideoName ); |
|
568 } |
|
569 else |
|
570 { |
|
571 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
572 TPtrC8( KTvVideoCount ), |
|
573 videoCount ); |
|
574 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
575 TPtrC8( KTvVideoHasNewVideos ), |
|
576 EFalse ); |
|
577 iPublishableData->SetDataL( EVCxNsCPContentMyVideos, |
|
578 TPtrC8( KTvVideoName ), |
|
579 KNullDesC ); |
|
580 } |
|
581 |
|
582 iPublisher->PublishContentL( EVCxNsCPContentMyVideos ); |
|
583 } |
|
584 } |
|
585 |
|
586 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::UpdateNewVideoCountL OUT"); |
|
587 } |
|
588 |
|
589 // --------------------------------------------------------------------------- |
|
590 // |
|
591 // --------------------------------------------------------------------------- |
|
592 // |
|
593 void CVcxNsContentHarvesterMpxClient::UpdateCategoryL() |
|
594 { |
|
595 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::UpdateCategoryL IN"); |
|
596 |
|
597 if ( iCollectionOpenStatus == EVcxNsCollectionNotOpen ) |
|
598 { |
|
599 // Not opened, open the collection. |
|
600 OpenCollectionL(); |
|
601 } |
|
602 else |
|
603 { |
|
604 if ( !iCollectionUtility ) |
|
605 { |
|
606 return; |
|
607 } |
|
608 |
|
609 if ( CollectionLevelL() == KVcxMpxLevelVideos ) |
|
610 { |
|
611 // Openend in video level, back |
|
612 iCollectionUtility->Collection().BackL(); |
|
613 } |
|
614 else |
|
615 { |
|
616 // Already open, refetch the data |
|
617 iCollectionUtility->Collection().OpenL(); |
|
618 } |
|
619 } |
|
620 |
|
621 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::UpdateCategoryL OUT"); |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 void CVcxNsContentHarvesterMpxClient::SearchAndStoreCategoryL( CMPXMediaArray* categoryArray ) |
|
629 { |
|
630 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::SearchAndStoreCategoryL IN"); |
|
631 |
|
632 if( categoryArray->Count() > 0 ) |
|
633 { |
|
634 CMPXMedia* category = categoryArray->AtL( 0 ); |
|
635 |
|
636 if( category ) |
|
637 { |
|
638 if( iObservedCategory ) |
|
639 { |
|
640 delete iObservedCategory; |
|
641 iObservedCategory = NULL; |
|
642 } |
|
643 |
|
644 iObservedCategory = CMPXMedia::NewL( *category ); |
|
645 |
|
646 UpdateNewVideoCountL(); |
|
647 } |
|
648 } |
|
649 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::SearchAndStoreCategoryL OUT"); |
|
650 } |
|
651 |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 void CVcxNsContentHarvesterMpxClient::OpenCollectionL() |
|
657 { |
|
658 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::OpenCollectionL IN"); |
|
659 |
|
660 if( !iCollectionUtility ) |
|
661 { |
|
662 // use our content harvester plugin's uid as a mode |
|
663 // to prevent collection utility we use to be binded |
|
664 // into context of other possible collection utility clients |
|
665 // in other content harvester plugins |
|
666 TUid mode = TUid::Uid( KVcxnsCHUid ); |
|
667 iCollectionUtility = MMPXCollectionUtility::NewL( this, mode ); |
|
668 } |
|
669 |
|
670 iCollectionOpenStatus = EVcxNsCollectionOpening; |
|
671 |
|
672 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
673 CleanupStack::PushL( path ); |
|
674 path->AppendL( KVcxUidMyVideosMpxCollection ); //my videos |
|
675 iCollectionUtility->Collection().OpenL( *path ); |
|
676 CleanupStack::PopAndDestroy( path ); |
|
677 |
|
678 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::OpenCollectionL OUT"); |
|
679 } |
|
680 |
|
681 // --------------------------------------------------------------------------- |
|
682 // |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 void CVcxNsContentHarvesterMpxClient::CloseCollection() |
|
686 { |
|
687 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::CloseCollection IN"); |
|
688 |
|
689 if( iCollectionUtility ) |
|
690 { |
|
691 iCollectionUtility->Close(); |
|
692 iCollectionUtility = NULL; |
|
693 iCollectionOpenStatus = EVcxNsCollectionNotOpen; |
|
694 } |
|
695 |
|
696 IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterMpxClient::CloseCollection OUT"); |
|
697 } |
|