26 #ifndef __SBLIBRARYUTILS_H__
27 #define __SBLIBRARYUTILS_H__
30 #include <nsCOMArray.h>
33 #include <nsServiceManagerUtils.h>
34 #include <nsComponentManagerUtils.h>
35 #include <nsStringAPI.h>
38 #include <nsIMutableArray.h>
44 #include <sbILibrary.h>
45 #include <sbILibraryManager.h>
68 NS_ASSERTION(mDepth >= 0,
"Illegal batch depth, mismatched calls!");
69 PR_AtomicIncrement(&mDepth);
75 PRInt32 depth = PR_AtomicDecrement(&mDepth);
76 NS_ASSERTION(depth >= 0,
"Illegal batch depth, mismatched calls!");
78 PR_AtomicDecrement(&mDepth);
84 return (PRUint32) mDepth;
124 nsIMutableArray * aCopies);
138 nsIMutableArray * aCopies);
150 nsIMutableArray * aCopies);
168 PRInt64 * _retval = nsnull);
195 nsIIOService * aIOService = nsnull);
205 PRUint16 *aListContentType);
221 nsAString
const & aPropertyName,
223 nsCOMArray<sbIMediaItem> & aMediaItems);
232 PRUint32 aContentType,
233 nsIArray ** aMediaLists);
251 nsAString
const & aListName,
271 nsCOMPtr<sbILibraryManager> libManager =
272 do_GetService(
"@songbirdnest.com/Songbird/library/Manager;1", &rv);
273 NS_ENSURE_SUCCESS(rv, rv);
275 nsCOMPtr<sbILibrary> mainLibrary;
276 return libManager->GetMainLibrary(aMainLibrary);
285 NS_ENSURE_ARG_POINTER(aLibrary);
289 nsCOMPtr<sbILibrary> mainLibrary;
291 NS_ENSURE_SUCCESS(rv, PR_FALSE);
294 rv = mainLibrary->Equals(aLibrary, &isEqual);
295 NS_ENSURE_SUCCESS(rv, PR_FALSE);
306 nsCOMPtr<sbILibrary> mainLibrary;
308 NS_ENSURE_SUCCESS(rv, rv);
310 return mainLibrary->GetGuid(aLibraryId);
321 nsCOMPtr<sbIMediaItem>,
323 nsCOMPtr<sbILibrary> library;
324 nsresult rv = mValue->GetLibrary(getter_AddRefs(library));
325 if (NS_SUCCEEDED(rv))
326 library->Remove(mValue);
329 #endif // __SBLIBRARYUTILS_H__
static nsresult GetItemsByProperty(sbIMediaList *aMediaList, nsAString const &aPropertyName, nsAString const &aValue, nsCOMArray< sbIMediaItem > &aMediaItems)
static nsresult LinkCopy(sbIMediaItem *aOriginal, sbIMediaItem *aCopy)
Links a copy to its original. It will take into account the libraries the items belong to...
static nsresult GetContentLength(sbIMediaItem *aItem, PRInt64 *_retval=nsnull)
static nsresult GetItemInLibrary(sbIMediaItem *aItem, sbILibrary *aLibrary, sbIMediaItem **_retval)
static nsresult GetMediaListByContentType(sbILibrary *aLibrary, PRUint32 aContentType, nsIArray **aMediaLists)
static nsresult GetFileContentURI(nsIFile *aFile, nsIURI **_retval)
Return a library content URI for the file specified by aFile. Special processing is required to conve...
static nsresult FindCopiesByID(sbIMediaItem *aMediaItem, sbIMediaList *aList, nsIMutableArray *aCopies)
static nsresult SetContentLength(sbIMediaItem *aItem, nsIURI *aURI)
static nsresult GetOriginItem(sbIMediaItem *aItem, sbIMediaItem **_retval)
static nsresult GetContentURI(nsIURI *aURI, nsIURI **_retval, nsIIOService *aIOService=nsnull)
Return a library content URI for the URI specified by aURI. A library content URI is a specially form...
SB_AUTO_NULL_CLASS(sbAutoRemoveMediaItem, nsCOMPtr< sbIMediaItem >,{nsCOMPtr< sbILibrary > library;nsresult rv=mValue->GetLibrary(getter_AddRefs(library));if(NS_SUCCEEDED(rv)) library->Remove(mValue);})
An interface to represent an operator that may act upon a property.
PRBool sbIsMainLibrary(sbILibrary *aLibrary)
static nsresult SuggestUniqueNameForPlaylist(sbILibrary *aLibrary, nsAString const &aListName, nsAString &aName)
Suggest a unique name for playlist.
static nsresult GetMediaListContentType(sbIMediaList *aMediaList, PRUint16 *aListContentType)
Return a media list content type.
Media library abstraction.
static nsresult FindOriginalsByID(sbIMediaItem *aMediaItem, sbIMediaList *aList, nsIMutableArray *aCopies)
static nsresult FindItemsWithSameURL(sbIMediaItem *aMediaItem, sbIMediaList *aMediaList, nsIMutableArray *aCopies)
nsresult GetMainLibrary(sbILibrary **aMainLibrary)
static PRUint32 GetEqualOperator(sbIPropertyOperator **aOperator)
nsresult GetMainLibraryId(nsAString &aLibraryId)