engine/src/ShowEngine.cpp
branchnewlist
changeset 349 4538abb763e4
parent 336 3d6c1417e8bd
child 350 9c4fd008e20f
equal deleted inserted replaced
348:bd7f3de17443 349:4538abb763e4
   372 
   372 
   373 EXPORT_C CShowInfo* CShowEngine::GetShowByUidL(TUint aShowUid)
   373 EXPORT_C CShowInfo* CShowEngine::GetShowByUidL(TUint aShowUid)
   374 	{
   374 	{
   375 	return DBGetShowByUidL(aShowUid);
   375 	return DBGetShowByUidL(aShowUid);
   376 	}
   376 	}
       
   377 
   377 CShowInfo* CShowEngine::DBGetShowByUidL(TUint aUid)
   378 CShowInfo* CShowEngine::DBGetShowByUidL(TUint aUid)
   378 	{
   379 	{
   379 	DP("CShowEngine::DBGetShowByUid");
   380 	DP("CShowEngine::DBGetShowByUid");
   380 	CShowInfo *showInfo = NULL;
   381 	CShowInfo *showInfo = NULL;
   381 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows where uid=%u");
   382 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate from shows where uid=%u");
   382 	iSqlBuffer.Format(KSqlStatement, aUid);
   383 	iSqlBuffer.Format(KSqlStatement, aUid);
   383 
   384 
   384 	sqlite3_stmt *st;
   385 	sqlite3_stmt *st;
   385 
   386 
   386 	//DP1("SQL: %S", &iSqlBuffer.Left(KSqlDPLen));
   387 	//DP1("SQL: %S", &iSqlBuffer.Left(KSqlDPLen));
   406 
   407 
   407 EXPORT_C CShowInfo* CShowEngine::DBGetShowByFileNameL(TFileName aFileName)
   408 EXPORT_C CShowInfo* CShowEngine::DBGetShowByFileNameL(TFileName aFileName)
   408 	{
   409 	{
   409 	DP("CShowEngine::DBGetShowByUid");
   410 	DP("CShowEngine::DBGetShowByUid");
   410 	CShowInfo *showInfo = NULL;
   411 	CShowInfo *showInfo = NULL;
   411 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows where filename=\"%S\"");
   412 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where filename=\"%S\"");
   412 	iSqlBuffer.Format(KSqlStatement, &aFileName);
   413 	iSqlBuffer.Format(KSqlStatement, &aFileName);
   413 
   414 
   414 	sqlite3_stmt *st;
   415 	sqlite3_stmt *st;
   415 
   416 
   416 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   417 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   433 	}
   434 	}
   434 
   435 
   435 void CShowEngine::DBGetAllShowsL(RShowInfoArray& aShowArray)
   436 void CShowEngine::DBGetAllShowsL(RShowInfoArray& aShowArray)
   436 	{
   437 	{
   437 	DP("CShowEngine::DBGetAllShows");
   438 	DP("CShowEngine::DBGetAllShows");
   438 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows");
   439 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows");
   439 	iSqlBuffer.Format(KSqlStatement);
   440 	iSqlBuffer.Format(KSqlStatement);
   440 
   441 
   441 	sqlite3_stmt *st;
   442 	sqlite3_stmt *st;
   442 
   443 
   443 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   444 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   461 	}
   462 	}
   462 
   463 
   463 void CShowEngine::DBGetAllDownloadsL(RShowInfoArray& aShowArray)
   464 void CShowEngine::DBGetAllDownloadsL(RShowInfoArray& aShowArray)
   464 	{
   465 	{
   465 	DP("CShowEngine::DBGetAllDownloads");
   466 	DP("CShowEngine::DBGetAllDownloads");
   466 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror from downloads, shows where downloads.uid=shows.uid");
   467 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid");
   467 	iSqlBuffer.Format(KSqlStatement);
   468 	iSqlBuffer.Format(KSqlStatement);
   468 
   469 
   469 #ifndef DONT_SORT_SQL
   470 #ifndef DONT_SORT_SQL
   470 	_LIT(KSqlSort, " order by dl_index");
   471 	_LIT(KSqlSort, " order by dl_index");
   471 	iSqlBuffer.Append(KSqlSort);
   472 	iSqlBuffer.Append(KSqlSort);
   511 		{
   512 		{
   512 		User::Leave(KErrCorrupt);
   513 		User::Leave(KErrCorrupt);
   513 		}
   514 		}
   514 	}
   515 	}
   515 
   516 
       
   517 void CShowEngine::DBGetOldShowsL(RShowInfoArray& aShowArray)
       
   518 	{
       
   519 	DP("CShowEngine::DBGetOldShowsL BEGIN");
       
   520 	TTime now;
       
   521 	now.HomeTime();
       
   522 	_LIT(KSqlStatement, "select filename, deletedate shows where deletedate < %Ld");
       
   523 	iSqlBuffer.Format(KSqlStatement, now.Int64());
       
   524 
       
   525 	sqlite3_stmt *st;
       
   526 
       
   527 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
       
   528 			&st, (const void**) NULL);
       
   529 
       
   530 	if (rc == SQLITE_OK)
       
   531 		{
       
   532 		rc = sqlite3_step(st);
       
   533 		Cleanup_sqlite3_finalize_PushL(st);
       
   534 		while (rc == SQLITE_ROW)
       
   535 			{
       
   536 			CShowInfo* showInfo = CShowInfo::NewLC();
       
   537 
       
   538 			const void *filez = sqlite3_column_text16(st, 3);
       
   539 			TPtrC16 file((const TUint16*) filez);
       
   540 			showInfo->SetFileNameL(file);
       
   541 
       
   542 			sqlite3_int64 deletedate = sqlite3_column_int64(st, 15);
       
   543 			TTime timedeletedate(deletedate);
       
   544 			showInfo->SetDeleteDate(timedeletedate);
       
   545 
       
   546 			aShowArray.Append(showInfo);
       
   547 			CleanupStack::Pop(showInfo);
       
   548 			rc = sqlite3_step(st);
       
   549 			}
       
   550 		CleanupStack::PopAndDestroy();//st
       
   551 		}
       
   552 	else
       
   553 		{
       
   554 		User::Leave(KErrCorrupt);
       
   555 		}
       
   556 	DP("CShowEngine::DBGetOldShowsL END");
       
   557 	}
       
   558 
   516 CShowInfo* CShowEngine::DBGetNextDownloadL()
   559 CShowInfo* CShowEngine::DBGetNextDownloadL()
   517 	{
   560 	{
   518 	DP("CShowEngine::DBGetNextDownload");
   561 	DP("CShowEngine::DBGetNextDownload");
   519 	CShowInfo *showInfo = NULL;
   562 	CShowInfo *showInfo = NULL;
   520 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror from downloads, shows where downloads.uid=shows.uid");
   563 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid");
   521 	iSqlBuffer.Format(KSqlStatement);
   564 	iSqlBuffer.Format(KSqlStatement);
   522 
   565 
   523 #ifdef DONT_SORT_SQL
   566 #ifdef DONT_SORT_SQL
   524 	_LIT(KSqlSort, " limit 1");
   567 	_LIT(KSqlSort, " limit 1");
   525 	iSqlBuffer.Append(KSqlSort);
   568 	iSqlBuffer.Append(KSqlSort);
   558 	}
   601 	}
   559 
   602 
   560 void CShowEngine::DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid)
   603 void CShowEngine::DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid)
   561 	{
   604 	{
   562 	DP1("CShowEngine::DBGetShowsByFeed BEGIN, feedUid=%u", aFeedUid);
   605 	DP1("CShowEngine::DBGetShowsByFeed BEGIN, feedUid=%u", aFeedUid);
   563 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where feeduid=%u");
   606 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where feeduid=%u");
   564 	iSqlBuffer.Format(KSqlStatement, aFeedUid);
   607 	iSqlBuffer.Format(KSqlStatement, aFeedUid);
   565 
       
   566 	if (iShowFilter == ENewShows)
       
   567 		{
       
   568 		_LIT(KSqlStatementNewShows, " and playstate = 0"); // ENeverPlayed
       
   569 		iSqlBuffer.Append(KSqlStatementNewShows);
       
   570 		}
       
   571 	else if (iShowFilter == EDownloadedShows)
       
   572 		{
       
   573 	_LIT(KSqlStatementDownloadedShows, " and downloadstate = 4"); // EDownloaded
       
   574 		iSqlBuffer.Append(KSqlStatementDownloadedShows);
       
   575 		}
       
   576 	else if (iShowFilter == ENewAndDownloadedShows)
       
   577 		{
       
   578 	_LIT(KSqlStatementDownloadedAndNewShows, " and (downloadstate = 4 or playstate = 0)"); // EDownloaded or ENeverPlayed
       
   579 		iSqlBuffer.Append(KSqlStatementDownloadedAndNewShows);
       
   580 	
       
   581 		}
       
   582 	
   608 	
   583 #ifndef DONT_SORT_SQL	
   609 #ifndef DONT_SORT_SQL	
   584 	_LIT(KSqlOrderByDate, " order by pubdate desc");
   610 	_LIT(KSqlOrderByDate, " order by pubdate desc");
   585 	iSqlBuffer.Append(KSqlOrderByDate);
   611 	iSqlBuffer.Append(KSqlOrderByDate);
   586 #endif
   612 #endif
   648 	}
   674 	}
   649 
   675 
   650 void CShowEngine::DBGetDownloadedShowsL(RShowInfoArray& aShowArray)
   676 void CShowEngine::DBGetDownloadedShowsL(RShowInfoArray& aShowArray)
   651 	{
   677 	{
   652 	DP("CShowEngine::DBGetDownloadedShows");
   678 	DP("CShowEngine::DBGetDownloadedShows");
   653 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where downloadstate=%u");
   679 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where downloadstate=%u");
   654 	iSqlBuffer.Format(KSqlStatement, EDownloaded);
   680 	iSqlBuffer.Format(KSqlStatement, EDownloaded);
   655 
   681 
   656 #ifndef DONT_SORT_SQL
   682 #ifndef DONT_SORT_SQL
   657 	_LIT(KSqlSort, " order by title");
   683 	_LIT(KSqlSort, " order by title");
   658 	iSqlBuffer.Append(KSqlSort);
   684 	iSqlBuffer.Append(KSqlSort);
   684 	}
   710 	}
   685 
   711 
   686 void CShowEngine::DBGetNewShowsL(RShowInfoArray& aShowArray)
   712 void CShowEngine::DBGetNewShowsL(RShowInfoArray& aShowArray)
   687 	{
   713 	{
   688 	DP("CShowEngine::DBGetNewShows");
   714 	DP("CShowEngine::DBGetNewShows");
   689 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where playstate=%u");
   715 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where playstate=%u");
   690 	iSqlBuffer.Format(KSqlStatement, ENeverPlayed);
   716 	iSqlBuffer.Format(KSqlStatement, ENeverPlayed);
   691 
   717 
   692 	sqlite3_stmt *st;
   718 	sqlite3_stmt *st;
   693 
   719 
   694 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   720 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   807 	TUint showtype = sqlite3_column_int(st, 13);
   833 	TUint showtype = sqlite3_column_int(st, 13);
   808 	showInfo->SetShowType((TShowType) showtype);
   834 	showInfo->SetShowType((TShowType) showtype);
   809 	
   835 	
   810 	TInt lasterror = sqlite3_column_int(st, 14);
   836 	TInt lasterror = sqlite3_column_int(st, 14);
   811 	showInfo->SetLastError(lasterror);
   837 	showInfo->SetLastError(lasterror);
       
   838 
       
   839 	sqlite3_int64 deletedate = sqlite3_column_int64(st, 15);
       
   840 	TTime timedeletedate(deletedate);
       
   841 	showInfo->SetDeleteDate(timedeletedate);
   812 	}
   842 	}
   813 
   843 
   814 void CShowEngine::DBAddShowL(const CShowInfo& aItem)
   844 void CShowEngine::DBAddShowL(const CShowInfo& aItem)
   815 	{
   845 	{
   816 	DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url());
   846 	DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url());
   823 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   853 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   824 	TPtr descPtr(descBuf->Des());
   854 	TPtr descPtr(descBuf->Des());
   825 	descPtr.Copy(aItem.Description());
   855 	descPtr.Copy(aItem.Description());
   826 	PodcastUtils::SQLEncode(descPtr);
   856 	PodcastUtils::SQLEncode(descPtr);
   827 	
   857 	
   828 	_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\")");
   858 	_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\", \"%Lu\")");
   829 	
   859 	
   830 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   860 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   831 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   861 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   832 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   862 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   833 			aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(),
   863 			aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(),
   834 			aItem.PubDate().Int64(), aItem.ShowType());
   864 			aItem.PubDate().Int64(), aItem.ShowType(), aItem.DeleteDate().Int64());
   835 
   865 
   836 	CleanupStack::PopAndDestroy(descBuf);
   866 	CleanupStack::PopAndDestroy(descBuf);
   837 	CleanupStack::PopAndDestroy(titleBuf);
   867 	CleanupStack::PopAndDestroy(titleBuf);
   838 
   868 
   839 	sqlite3_stmt *st;
   869 	sqlite3_stmt *st;
   896 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   926 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   897 	TPtr descPtr(descBuf->Des());
   927 	TPtr descPtr(descBuf->Des());
   898 	descPtr.Copy(aItem.Description());
   928 	descPtr.Copy(aItem.Description());
   899 	PodcastUtils::SQLEncode(descPtr);
   929 	PodcastUtils::SQLEncode(descPtr);
   900 
   930 
   901 	_LIT(KSqlStatement, "update shows set url=\"%S\", title=\"%S\", description=\"%S\", filename=\"%S\", position=\"%Lu\", playtime=\"%u\", playstate=\"%u\", downloadstate=\"%u\", feeduid=\"%u\", showsize=\"%u\", trackno=\"%u\",pubdate=\"%Lu\", showtype=\"%d\", lasterror=\"%d\" where uid=\"%u\"");
   931 	_LIT(KSqlStatement, "update shows set url=\"%S\", title=\"%S\", description=\"%S\", filename=\"%S\", position=\"%Lu\", playtime=\"%u\", playstate=\"%u\", downloadstate=\"%u\", feeduid=\"%u\", showsize=\"%u\", trackno=\"%u\",pubdate=\"%Lu\", showtype=\"%d\", lasterror=\"%d\",deletedate=\"%Lu\" where uid=\"%u\"");
   902 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   932 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   903 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   933 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   904 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   934 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   905 			aItem.ShowSize(), aItem.TrackNo(), aItem.PubDate().Int64(),
   935 			aItem.ShowSize(), aItem.TrackNo(), aItem.PubDate().Int64(),
   906 			aItem.ShowType(), aItem.LastError(), aItem.Uid());
   936 			aItem.ShowType(), aItem.LastError(), aItem.Uid(), aItem.DeleteDate());
   907 
   937 
   908 	CleanupStack::PopAndDestroy(descBuf);
   938 	CleanupStack::PopAndDestroy(descBuf);
   909 	CleanupStack::PopAndDestroy(titleBuf);
   939 	CleanupStack::PopAndDestroy(titleBuf);
   910 
   940 
   911 	sqlite3_stmt *st;
   941 	sqlite3_stmt *st;
  1438 void CShowEngine::FileError(TUint /*aError*/)
  1468 void CShowEngine::FileError(TUint /*aError*/)
  1439 	{
  1469 	{
  1440 	iDownloadErrors = KMaxDownloadErrors;
  1470 	iDownloadErrors = KMaxDownloadErrors;
  1441 	}
  1471 	}
  1442 
  1472 
       
  1473 EXPORT_C void CShowEngine::ExpireOldShows()
       
  1474 	{
       
  1475 	DP("CShowEngine::ExpireOldShows BEGIN");
       
  1476 	RShowInfoArray oldShowsArray;
       
  1477 	
       
  1478 	TRAPD(err, DBGetOldShowsL(oldShowsArray));
       
  1479 	
       
  1480 	if (err == KErrNone)
       
  1481 		{
       
  1482 		for (int i=0;i<oldShowsArray.Count();i++)
       
  1483 			{
       
  1484 			DP1("    deleting %S", &oldShowsArray[i]->FileName());
       
  1485 			BaflUtils::DeleteFile(iPodcastModel.FsSession(), oldShowsArray[i]->FileName());
       
  1486 			}
       
  1487 		}
       
  1488 	DP("CShowEngine::ExpireOldShows END");
       
  1489 	}
       
  1490 
  1443 EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid)
  1491 EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid)
  1444 	{
  1492 	{
  1445 	RShowInfoArray shows;
  1493 	RShowInfoArray shows;
  1446 	
  1494 	
  1447 	TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid));
  1495 	TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid));
  1465 				shows[i]->SetPlayState(EPlayed);
  1513 				shows[i]->SetPlayState(EPlayed);
  1466 				TRAP_IGNORE(DBUpdateShowL(*shows[i]));
  1514 				TRAP_IGNORE(DBUpdateShowL(*shows[i]));
  1467 				}
  1515 				}
  1468 			}
  1516 			}
  1469 		}
  1517 		}
  1470 	}
       
  1471 
       
  1472 EXPORT_C void CShowEngine::SetShowFilter(TShowFilter aFilter)
       
  1473 	{
       
  1474 	iShowFilter = aFilter;
       
  1475 	}
  1518 	}
  1476 
  1519 
  1477 EXPORT_C void CShowEngine::MoveDownloadUpL(TUint aUid)
  1520 EXPORT_C void CShowEngine::MoveDownloadUpL(TUint aUid)
  1478 	{
  1521 	{
  1479 	DP("CShowEngine::MoveDownLoadUpL");
  1522 	DP("CShowEngine::MoveDownLoadUpL");
  1597 	else
  1640 	else
  1598 		{
  1641 		{
  1599 		User::Leave(KErrCorrupt);
  1642 		User::Leave(KErrCorrupt);
  1600 		}
  1643 		}
  1601 	}
  1644 	}
       
  1645 
       
  1646 EXPORT_C void CShowEngine::PostPlayHandling(CShowInfo *aShow)
       
  1647 	{
       
  1648 	DP("CShowEngine::PostPlayHandling BEGIN");
       
  1649 	if (!aShow)
       
  1650 		return;
       
  1651 		
       
  1652 	aShow->SetPlayState(EPlayed);
       
  1653 	
       
  1654 	TAutoDeleteSetting deleteSetting = iPodcastModel.SettingsEngine().DeleteAutomatically();
       
  1655 	TTimeIntervalDays daysAhead;
       
  1656 	
       
  1657 	switch (deleteSetting)
       
  1658 		{
       
  1659 		case EAutoDeleteOff:
       
  1660 			break;
       
  1661 		case EAutoDeleteAfter1Day:
       
  1662 			daysAhead = 1;
       
  1663 			break;
       
  1664 		case EAutoDeleteAfter7Days:
       
  1665 			daysAhead = 7;
       
  1666 			break;
       
  1667 		case EAutoDeleteAfter3Days:
       
  1668 			daysAhead = 30;
       
  1669 			break;
       
  1670 		}
       
  1671 	
       
  1672 	TTime deleteDate;
       
  1673 	deleteDate.HomeTime();
       
  1674 	deleteDate += daysAhead;
       
  1675 	aShow->SetDeleteDate(deleteDate);
       
  1676 	
       
  1677 	UpdateShowL(*aShow);
       
  1678 	DP("CShowEngine::PostPlayHandling END");
       
  1679 	}