41 #include <nsArrayUtils.h>
42 #include <nsComponentManagerUtils.h>
43 #include <nsIClassInfoImpl.h>
45 #include <nsIProgrammingLanguage.h>
47 #include <nsServiceManagerUtils.h>
48 #include <nsStringGlue.h>
49 #include <nsThreadUtils.h>
52 #include <sbICascadeFilterSet.h>
53 #include <sbIFilterableMediaListView.h>
54 #include <sbILibraryManager.h>
55 #include <sbILibraryConstraints.h>
56 #include <sbIMediaList.h>
57 #include <sbIMediaListView.h>
58 #include <sbIPropertyArray.h>
59 #include <sbISortableMediaListView.h>
74 static PRLogModuleInfo* gAlbumArtScannerLog = nsnull;
75 #define TRACE(args) PR_LOG(gAlbumArtScannerLog, PR_LOG_DEBUG, args)
76 #define LOG(args) PR_LOG(gAlbumArtScannerLog, PR_LOG_WARN, args)
125 sbAlbumArtScanner::ScanListForArtwork(
sbIMediaList* aMediaList)
127 TRACE((
"sbAlbumArtScanner[0x%8.x] - ScanListForArtwork",
this));
130 nsCOMPtr<sbIMediaList> mediaList = aMediaList;
134 if (aMediaList == nsnull) {
135 nsCOMPtr<sbILibraryManager> libManager =
136 do_GetService(
"@songbirdnest.com/Songbird/library/Manager;1", &rv);
137 NS_ENSURE_SUCCESS(rv, rv);
139 nsCOMPtr<sbILibrary> mLibrary;
140 rv = libManager->GetMainLibrary(getter_AddRefs(mLibrary));
141 NS_ENSURE_SUCCESS(rv, rv);
143 mediaList = do_QueryInterface(mLibrary, &rv);
144 NS_ENSURE_SUCCESS(rv, rv);
149 rv = mediaList->CreateView(nsnull, getter_AddRefs(mMediaListView));
150 NS_ENSURE_SUCCESS(rv, rv);
154 nsCOMPtr<sbIFilterableMediaListView> filterView =
155 do_QueryInterface(mMediaListView, &rv);
156 NS_ENSURE_SUCCESS(rv, rv);
159 nsCOMPtr<sbILibraryConstraint> constraint;
160 rv = filterView->GetFilterConstraint(getter_AddRefs(constraint));
161 NS_ENSURE_SUCCESS(rv, rv);
163 nsCOMPtr<sbILibraryConstraintBuilder> builder =
164 do_CreateInstance(
"@songbirdnest.com/Songbird/Library/ConstraintBuilder;1",
166 NS_ENSURE_SUCCESS(rv, rv);
170 rv = builder->IncludeConstraint(constraint, nsnull);
171 NS_ENSURE_SUCCESS(rv, rv);
172 rv = builder->Intersect(nsnull);
173 NS_ENSURE_SUCCESS(rv, rv);
178 NS_LITERAL_STRING(
"0"),
180 NS_ENSURE_SUCCESS(rv, rv);
181 rv = builder->Intersect(nsnull);
182 NS_ENSURE_SUCCESS(rv, rv);
184 NS_LITERAL_STRING(
"0"),
188 rv = builder->Intersect(nsnull);
189 NS_ENSURE_SUCCESS(rv, rv);
191 NS_LITERAL_STRING(
"audio"),
193 NS_ENSURE_SUCCESS(rv, rv);
196 rv = builder->Get(getter_AddRefs(constraint));
197 NS_ENSURE_SUCCESS(rv, rv);
198 rv = filterView->SetFilterConstraint(constraint);
199 NS_ENSURE_SUCCESS(rv, rv);
208 nsCOMPtr<sbIMutablePropertyArray> newSort =
210 NS_ENSURE_SUCCESS(rv, rv);
212 rv = newSort->SetStrict(PR_FALSE);
213 NS_ENSURE_SUCCESS(rv, rv);
217 NS_LITERAL_STRING(
"a"));
218 NS_ENSURE_SUCCESS(rv, rv);
222 NS_LITERAL_STRING(
"a"));
223 NS_ENSURE_SUCCESS(rv, rv);
227 NS_LITERAL_STRING(
"a"));
228 NS_ENSURE_SUCCESS(rv, rv);
232 NS_LITERAL_STRING(
"a"));
233 NS_ENSURE_SUCCESS(rv, rv);
237 NS_LITERAL_STRING(
"a"));
238 NS_ENSURE_SUCCESS(rv, rv);
241 nsCOMPtr<sbISortableMediaListView> sortable =
242 do_QueryInterface(mMediaListView, &rv);
243 NS_ENSURE_SUCCESS(rv, rv);
245 rv = sortable->SetSort(newSort);
246 NS_ENSURE_SUCCESS(rv, rv);
249 rv = mMediaListView->GetLength(&mTotalItemCount);
250 NS_ENSURE_SUCCESS(rv, rv);
252 mCompletedItemCount = 0;
253 mProcessNextAlbum = PR_TRUE;
259 rv = mIntervalTimer->InitWithCallback(
this,
261 nsITimer::TYPE_REPEATING_SLACK);
262 NS_ENSURE_SUCCESS(rv, rv);
276 sbAlbumArtScanner::GetUpdateArtwork(PRBool* _retval)
278 TRACE((
"%s[%.8x] = %d", __FUNCTION__,
this, mUpdateArtwork));
279 NS_ENSURE_ARG_POINTER(_retval);
280 *_retval = mUpdateArtwork;
285 sbAlbumArtScanner::SetUpdateArtwork(PRBool aUpdateArtwork)
287 TRACE((
"%s[%.8x] = %d", __FUNCTION__,
this, aUpdateArtwork));
288 mUpdateArtwork = aUpdateArtwork;
299 NS_IMETHODIMP sbAlbumArtScanner::GetStatus(PRUint16* aStatus)
301 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetStatus",
this));
302 NS_ENSURE_ARG_POINTER( aStatus );
308 NS_IMETHODIMP sbAlbumArtScanner::GetBlocked(PRBool* aBlocked)
310 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetBlocked",
this));
311 NS_ENSURE_ARG_POINTER( aBlocked );
312 *aBlocked = PR_FALSE;
317 NS_IMETHODIMP sbAlbumArtScanner::GetStatusText(nsAString& aText)
319 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetStatusText",
this));
320 NS_ASSERTION(NS_IsMainThread(), \
321 "sbAlbumArtScanner::GetStatusText is main thread only!");
329 const PRUnichar *
strings[2] = {
330 mCurrentAlbumName.get(),
331 mCurrentFetcherName.get()
333 if (mCurrentFetcherName.IsEmpty()) {
334 stringKey.AssignLiteral(
"albumart.scanning.nofetcher.message");
336 stringKey.AssignLiteral(
"albumart.scanning.fetcher.message");
338 rv = mStringBundle->FormatStringFromName(stringKey.get(),
340 NS_ARRAY_LENGTH(strings),
341 getter_Copies(outMessage));
344 aText.Assign(stringKey);
346 aText.Assign(outMessage);
349 rv = mStringBundle->GetStringFromName(
350 NS_LITERAL_STRING(
"albumart.scanning.completed").
get(),
351 getter_Copies(mTitleText));
353 aText.AssignLiteral(
"albumart.scanning.completed");
360 NS_IMETHODIMP sbAlbumArtScanner::GetTitleText(nsAString& aText)
362 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetTitleText",
this));
367 if (mTitleText.IsEmpty()) {
368 rv = mStringBundle->GetStringFromName(
369 NS_LITERAL_STRING(
"albumart.scanning.title").
get(),
370 getter_Copies(mTitleText));
372 mTitleText.AssignLiteral(
"albumart.scanning.title");
382 NS_IMETHODIMP sbAlbumArtScanner::GetProgress(PRUint32* aProgress)
384 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetProgress",
this));
385 NS_ENSURE_ARG_POINTER( aProgress );
386 NS_ASSERTION(NS_IsMainThread(), \
387 "sbAlbumArtScanner::GetProgress is main thread only!");
389 *aProgress = mCompletedItemCount;
394 NS_IMETHODIMP sbAlbumArtScanner::GetTotal(PRUint32* aTotal)
396 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetTotal",
this));
397 NS_ENSURE_ARG_POINTER( aTotal );
398 NS_ASSERTION(NS_IsMainThread(), \
399 "sbAlbumArtScanner::GetTotal is main thread only!");
401 if (mTotalItemCount > 1) {
402 *aTotal = mTotalItemCount;
410 NS_IMETHODIMP sbAlbumArtScanner::GetErrorCount(PRUint32*
aCount)
412 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetErrorCount",
this));
413 NS_ENSURE_ARG_POINTER( aCount );
414 NS_ASSERTION(NS_IsMainThread(), \
415 "sbAlbumArtScanner::GetErrorCount is main thread only!");
417 *aCount = mErrorMessages.Length();
424 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetErrorMessages",
this));
425 NS_ENSURE_ARG_POINTER(aMessages);
426 NS_ASSERTION(NS_IsMainThread(), \
427 "sbAlbumArtScanner::GetProgress is main thread only!");
431 nsCOMPtr<nsIStringEnumerator> enumerator =
433 NS_ENSURE_TRUE(enumerator, NS_ERROR_OUT_OF_MEMORY);
435 enumerator.forget(aMessages);
443 TRACE((
"sbAlbumArtScanner[0x%8.x] - AddJobProgressListener",
this));
444 NS_ENSURE_ARG_POINTER(aListener);
445 NS_ASSERTION(NS_IsMainThread(), \
446 "sbAlbumArtScanner::AddJobProgressListener is main thread only!");
448 PRInt32 index = mListeners.IndexOf(aListener);
451 return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
453 PRBool
succeeded = mListeners.AppendObject(aListener);
454 return succeeded ?
NS_OK : NS_ERROR_FAILURE;
461 TRACE((
"sbAlbumArtScanner[0x%8.x] - RemoveJobProgressListener",
this));
462 NS_ENSURE_ARG_POINTER(aListener);
463 NS_ASSERTION(NS_IsMainThread(), \
464 "sbAlbumArtScanner::RemoveJobProgressListener is main thread only!");
466 PRInt32 indexToRemove = mListeners.IndexOf(aListener);
467 if (indexToRemove < 0) {
469 return NS_ERROR_UNEXPECTED;
473 PRBool succeeded = mListeners.RemoveObjectAt(indexToRemove);
474 NS_ENSURE_TRUE(succeeded, NS_ERROR_FAILURE);
486 NS_IMETHODIMP sbAlbumArtScanner::GetCrop(nsAString & aCrop)
488 aCrop.AssignLiteral(
"end");
499 NS_IMETHODIMP sbAlbumArtScanner::GetCanCancel(PRBool* _retval)
501 TRACE((
"sbAlbumArtScanner[0x%8.x] - GetCanCancel",
this));
507 NS_IMETHODIMP sbAlbumArtScanner::Cancel()
509 TRACE((
"sbAlbumArtScanner[0x%8.x] - Cancel",
this));
510 NS_ASSERTION(NS_IsMainThread(), \
511 "sbAlbumArtScanner::Cancel is main thread only!");
527 NS_IMETHODIMP sbAlbumArtScanner::Notify(nsITimer* aTimer)
529 NS_ENSURE_ARG_POINTER(aTimer);
532 if (aTimer == mIntervalTimer) {
533 if (mProcessNextAlbum) {
536 TRACE((
"sbAlbumArtScanner::Notify - Fetch Failed for album"));
538 mProcessNextAlbum = PR_TRUE;
556 TRACE((
"sbAlbumArtScanner[0x%8.x] - OnChangeFetcher",
this));
557 mCurrentFetcher = aFetcher;
558 aFetcher->GetName(mCurrentFetcherName);
565 sbAlbumArtScanner::OnTrackResult(nsIURI* aImageLocation,
568 TRACE((
"sbAlbumArtScanner[0x%8.x] - OnResult",
this));
569 NS_ENSURE_ARG_POINTER(aMediaItem);
574 if (mCurrentFetcher) {
576 rv = mCurrentFetcher->GetIsLocal(&isLocal);
577 NS_ENSURE_SUCCESS(rv, rv);
579 rv = MarkRemoteFetchAttempted(aMediaItem);
580 NS_ENSURE_SUCCESS(rv, rv);
585 if (aImageLocation) {
587 NS_ENSURE_SUCCESS(rv, rv);
595 sbAlbumArtScanner::OnAlbumResult(nsIURI* aImageLocation,
596 nsIArray* aMediaItems)
598 TRACE((
"sbAlbumArtScanner[0x%8.x] - OnAlbumResult",
this));
599 NS_ENSURE_ARG_POINTER(aMediaItems);
604 if (mCurrentFetcher) {
606 rv = mCurrentFetcher->GetIsLocal(&isLocal);
607 NS_ENSURE_SUCCESS(rv, rv);
610 rv = aMediaItems->GetLength(&itemCount);
611 NS_ENSURE_SUCCESS(rv, rv);
612 for (PRUint32
i = 0;
i < itemCount;
i++) {
613 nsCOMPtr<sbIMediaItem>
614 mediaItem = do_QueryElementAt(aMediaItems,
i, &rv);
615 NS_ENSURE_SUCCESS(rv, rv);
616 rv = MarkRemoteFetchAttempted(mediaItem);
617 NS_ENSURE_SUCCESS(rv, rv);
623 if (aImageLocation) {
625 NS_ENSURE_SUCCESS(rv, rv);
633 sbAlbumArtScanner::OnSearchComplete(nsIArray* aMediaItems)
635 TRACE((
"sbAlbumArtScanner[0x%8.x] - OnSearchComplete",
this));
639 mCurrentFetcher = nsnull;
642 mProcessNextAlbum = PR_TRUE;
647 NS_ENSURE_SUCCESS(rv, rv);
665 mUpdateArtwork(PR_FALSE),
667 mCompletedItemCount(0),
669 mProcessNextAlbum(PR_FALSE),
670 mCurrentAlbumItemList(nsnull),
671 mMediaListView(nsnull)
674 if (!gAlbumArtScannerLog) {
675 gAlbumArtScannerLog = PR_NewLogModule(
"sbAlbumArtScanner");
678 TRACE((
"sbAlbumArtScanner[0x%.8x] - ctor",
this));
688 TRACE((
"sbAlbumArtScanner[0x%.8x] - dtor",
this));
690 if (mIntervalTimer) {
691 mIntervalTimer->Cancel();
692 mIntervalTimer = nsnull;
694 mFetcherSet = nsnull;
695 mCurrentFetcher = nsnull;
696 mCurrentAlbumItemList = nsnull;
697 mStringBundle = nsnull;
707 TRACE((
"sbAlbumArtScanner[0x%.8x] - Initialize",
this));
711 mIntervalTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
712 NS_ENSURE_SUCCESS(rv, rv);
717 NS_ENSURE_SUCCESS(rv, rv);
724 do_CreateInstance(
"@songbirdnest.com/Songbird/album-art-fetcher-set;1", &rv);
725 NS_ENSURE_SUCCESS(rv, rv);
727 NS_ENSURE_SUCCESS(rv, rv);
730 mCurrentAlbumItemList =
731 do_CreateInstance(
"@songbirdnest.com/moz/xpcom/threadsafe-array;1", &rv);
732 NS_ENSURE_SUCCESS(rv, rv);
735 nsCOMPtr<nsIStringBundleService> StringBundleService =
736 do_GetService(
"@mozilla.org/intl/stringbundle;1", &rv );
737 NS_ENSURE_SUCCESS(rv, rv);
739 rv = StringBundleService->CreateBundle(
740 "chrome://songbird/locale/songbird.properties",
741 getter_AddRefs(mStringBundle));
742 NS_ENSURE_SUCCESS(rv, rv);
755 sbAlbumArtScanner::UpdateProgress()
757 TRACE((
"sbAlbumArtScanner[0x%.8x] - UpdateProgress",
this));
758 NS_ASSERTION(NS_IsMainThread(), \
759 "sbAlbumArtScanner::UpdateProgress is main thread only!");
765 TRACE((
"sbAlbumArtScanner::UpdateProgress - Shutting down Job"));
766 mCurrentFetcher = nsnull;
767 mProcessNextAlbum = PR_FALSE;
768 mIntervalTimer->Cancel();
769 mFetcherSet->Shutdown();
772 for (PRInt32
i = mListeners.Count() - 1;
i >= 0; --
i) {
773 mListeners[
i]->OnJobProgress(
this);
785 sbAlbumArtScanner::GetNextAlbumItems()
787 TRACE((
"sbAlbumArtScanner[0x%.8x] - GetNextAlbumItems [%d/%d]",
793 nsString mLastAlbumName;
794 nsString mLastArtistName;
797 mCurrentAlbumItemList->Clear();
805 while (mCompletedItemCount < mTotalItemCount) {
806 TRACE((
"sbAlbumArtScanner - Processing %d of %d",
810 nsCOMPtr<sbIMediaItem> item;
811 rv = mMediaListView->GetItemByIndex(mCompletedItemCount,
812 getter_AddRefs(item));
815 TRACE((
"sbAlbumArtScanner - Processing : Item %d failed with %08X",
818 mCompletedItemCount++;
821 TRACE((
"sbAlbumArtScanner - Found Item %d", mCompletedItemCount));
826 if (NS_FAILED(rv) || albumName.IsEmpty()) {
828 mCompletedItemCount++;
833 nsString albumArtistName;
839 if (!albumArtistName.IsEmpty()) {
841 artistName = albumArtistName;
846 mCompletedItemCount++;
851 if (artistName.IsEmpty()) {
853 mCompletedItemCount++;
861 NS_ENSURE_SUCCESS(rv, rv);
862 TRACE((
"sbAlbumArtScanner - Processing Track [%s] by [%s] from [%s]",
863 NS_ConvertUTF16toUTF8(trackName).
get(),
864 NS_ConvertUTF16toUTF8(artistName).
get(),
865 NS_ConvertUTF16toUTF8(albumName).
get()
871 if (mLastAlbumName.IsEmpty()) {
872 mLastAlbumName.Assign(albumName);
873 mCurrentAlbumName.Assign(albumName);
874 mLastArtistName.Assign(artistName);
875 TRACE((
"sbAlbumArtScanner - First instance of album."));
876 }
else if (!mLastAlbumName.Equals(albumName)) {
880 TRACE((
"sbAlbumArtScanner - Sending album to be processed for album art."));
884 TRACE((
"sbAlbumArtScanner - Checking artist: prev %s, current %s",
885 NS_ConvertUTF16toUTF8(mLastArtistName).
get(),
886 NS_ConvertUTF16toUTF8(artistName).
get()
888 if (!mLastArtistName.Equals(artistName) &&
889 (artistName.Find(mLastArtistName, PR_TRUE) ==
kNotFound) &&
890 (mLastArtistName.Find(artistName, PR_TRUE) ==
kNotFound)) {
892 TRACE((
"sbAlbumArtScanner - Sending album to be processed for album art."));
898 if (!mUpdateArtwork) {
899 nsString primaryImageUrl;
902 if (NS_FAILED(rv) || !primaryImageUrl.IsEmpty()) {
903 TRACE((
"sbAlbumArtScanner - Item already has cover."));
905 mCompletedItemCount++;
910 TRACE((
"sbAlbumArtScanner - Adding to list"));
911 rv = mCurrentAlbumItemList->AppendElement(NS_ISUPPORTS_CAST(
sbIMediaItem *,
914 NS_ENSURE_SUCCESS(rv, rv);
915 mCompletedItemCount++;
922 sbAlbumArtScanner::ProcessAlbum()
924 TRACE((
"sbAlbumArtScanner[0x%.8x] - ProcessAlbum",
this));
928 mProcessNextAlbum = PR_FALSE;
930 rv = GetNextAlbumItems();
931 NS_ENSURE_SUCCESS(rv, rv);
933 PRUint32 trackCount = 0;
934 rv = mCurrentAlbumItemList->GetLength(&trackCount);
935 NS_ENSURE_SUCCESS(rv, rv);
936 TRACE((
"Collected %d of %d items, current list has %d items",
940 if (trackCount > 0) {
941 TRACE((
"sbAlbumArtScanner::ProcessAlbum - Fetching artwork for items."));
942 mCurrentFetcherName.Truncate();
944 rv = mFetcherSet->FetchAlbumArtForAlbum(mCurrentAlbumItemList,
this);
945 NS_ENSURE_SUCCESS(rv, rv);
946 }
else if (mCompletedItemCount >= mTotalItemCount) {
948 TRACE((
"sbAlbumArtScanner::ProcessAlbum - All albums scanned."));
955 mProcessNextAlbum = PR_TRUE;
962 sbAlbumArtScanner::MarkRemoteFetchAttempted(
sbIMediaItem* aMediaItem)
964 TRACE((
"sbAlbumArtScanner[0x%8.x] - MarkRemoteFetchAttempted",
this));
965 NS_ENSURE_ARG_POINTER(aMediaItem);
969 nsAutoString attemptedRemoteArtFetch;
970 rv = aMediaItem->GetProperty
972 attemptedRemoteArtFetch);
973 NS_ENSURE_SUCCESS(rv, rv);
974 if (!attemptedRemoteArtFetch.Equals(NS_LITERAL_STRING(
"1"))) {
975 rv = aMediaItem->SetProperty
977 NS_LITERAL_STRING(
"1"));
978 NS_ENSURE_SUCCESS(rv, rv);
Interface to control UI aspects of sbIJobProgress.
NS_DECL_ISUPPORTS NS_DECL_SBIALBUMARTSCANNER NS_DECL_NSICLASSINFO NS_DECL_SBIJOBPROGRESS NS_DECL_SBIJOBPROGRESSUI NS_DECL_SBIJOBCANCELABLE NS_DECL_NSITIMERCALLBACK NS_DECL_SBIALBUMARTLISTENER sbAlbumArtScanner()
function succeeded(ch, cx, status, data)
#define SB_PROPERTY_ALBUMARTISTNAME
Generic interface for exposing long running jobs to the UI.
#define SB_PROPERTY_HIDDEN
NS_INTERFACE_MAP_END NS_IMPL_CI_INTERFACE_GETTER6(sbDeviceLibrary, nsIClassInfo, sbIDeviceLibrary, sbILibrary, sbIMediaList, sbIMediaItem, sbILibraryResource) sbDeviceLibrary
Interface for an album art scanner. Instantiate as a component instance. It also implements the sbIJo...
const unsigned short STATUS_SUCCEEDED
Constant indicating that the job has completed.
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
const unsigned short STATUS_RUNNING
Constant indicating that the job is active.
A component which is interested in the result of an album art fetch request.
#define SB_PROPERTY_ATTEMPTED_REMOTE_ART_FETCH
#define SB_PROPERTY_CONTENTTYPE
Songbird Album Art Scanner Definitions.
#define SB_PROPERTY_DISCNUMBER
#define SB_PROPERTY_ARTISTNAME
nsresult SetItemsArtwork(nsIURI *aImageLocation, nsIArray *aMediaItems)
#define ALBUMART_SCANNER_INTERVAL
const unsigned long TYPE_ALL
#define SB_PROPERTY_ALBUMNAME
#define PREF_ALBUMART_SCANNER_BRANCH
NS_IMPL_QUERY_INTERFACE7_CI(sbAlbumArtScanner, sbIAlbumArtScanner, nsIClassInfo, sbIJobProgress, sbIJobProgressUI, sbIJobCancelable, nsITimerCallback, sbIAlbumArtListener) NS_IMPL_CI_INTERFACE_GETTER6(sbAlbumArtScanner
virtual ~sbAlbumArtScanner()
Implemented to receive notifications from sbIJobProgress interfaces.
#define PREF_ALBUMART_SCANNER_INTERVAL
#define SB_PROPERTY_TRACKNAME
restoreHistoryPrecursor aCount
nsresult WriteImageMetadata(nsIArray *aMediaItems)
Interface for an album art fetcher. Instantiate as a component instance.
#define SB_PROPERTY_ISLIST
const unsigned short STATUS_FAILED
Constant indicating that the job has completed with errors.
nsresult SetItemArtwork(nsIURI *aImageLocation, sbIMediaItem *aMediaItem)
_getSelectedPageStyle s i
#define SB_PROPERTY_PRIMARYIMAGEURL
#define SB_PROPERTY_TRACKNUMBER
PRInt32 GetIntPref(const char *aKey, const PRInt32 aDefault)