sbiTunesImporter.cpp File Reference
#include "sbiTunesImporter.h"
#include <algorithm>
#include <nsAppDirectoryServiceDefs.h>
#include <nsArrayUtils.h>
#include <nsAutoPtr.h>
#include <nsCOMArray.h>
#include <nsComponentManagerUtils.h>
#include <nsDirectoryServiceUtils.h>
#include <nsXPCOMCIDInternal.h>
#include <nsIArray.h>
#include <nsIBufferedStreams.h>
#include <nsIFile.h>
#include <nsIFileURL.h>
#include <nsIInputStream.h>
#include <nsIIOService.h>
#include <nsILineInputStream.h>
#include <nsILocalFile.h>
#include <nsIProperties.h>
#include <nsISimpleEnumerator.h>
#include <nsIURI.h>
#include <nsIXULRuntime.h>
#include <nsMemory.h>
#include <nsNetUtil.h>
#include <nsThreadUtils.h>
#include <prtime.h>
#include <sbIAlbumArtFetcherSet.h>
#include <sbIAlbumArtListener.h>
#include <sbFileUtils.h>
#include <sbILibrary.h>
#include <sbILocalDatabaseLibrary.h>
#include <sbIMediaList.h>
#include <sbIPropertyArray.h>
#include <sbLibraryUtils.h>
#include <sbIMediacoreTypeSniffer.h>
#include <sbPrefBranch.h>
#include <sbPropertiesCID.h>
#include <sbStringUtils.h>
#include <sbStandardProperties.h>
#include "sbiTunesImporterAlbumArtListener.h"
#include "sbiTunesImporterJob.h"
#include "sbiTunesImporterStatus.h"
Include dependency graph for sbiTunesImporter.cpp:

Go to the source code of this file.

Classes

struct  PropertyMap
 
struct  sbiTunesImporterEnumeratePropertiesData
 

Macros

#define TRACE(args)   /* nothing */
 
#define LOG(args)   /* nothing */
 

Typedefs

typedef nsString(* ValueConversion )(nsAString const &aValue)
 

Functions

nsString ConvertRating (nsAString const &aRating)
 
nsString ConvertDuration (nsAString const &aDuration)
 
nsString ConvertDateTime (nsAString const &aDateTime)
 
 NS_IMPL_ISUPPORTS2 (sbiTunesImporter, sbILibraryImporter, sbIiTunesXMLParserListener) sbiTunesImporter
 
static PRBool IsSongbirdFolder (sbIStringMap *aProperties)
 
static nsresult FindPlaylistByName (sbILibrary *aLibrary, nsAString const &aPlaylistName, sbIMediaList **aMediaList)
 
static nsresult ComputePlaylistSignature (sbiTunesSignature &aSignature, sbIMediaList *aMediaList)
 
static nsresult IsPlaylistDirty (sbIMediaList *aMediaList, PRBool &aIsDirty)
 
static nsresult AddItemsToPlaylist (sbIMediaList *aMediaList, nsIMutableArray *aItems)
 
static nsresult StorePlaylistSignature (sbIMediaList *aMediaList)
 
static PLDHashOperator EnumReadFunc (nsAString const &aKey, nsString aValue, void *aUserArg)
 
static PLDHashOperator ConvertToPropertyArray (nsAString const &aKey, nsString aValue, void *aUserArg)
 

Variables

char const SB_ITUNES_LIBRARY_IMPORT_PREF_PREFIX [] = "library_import.itunes"
 
char const SB_ITUNES_LIBRARY_IMPORTER_PREF_PREFIX [] = "songbird.library_importer."
 
PropertyMap gPropertyMap []
 

Macro Definition Documentation

#define LOG (   args)    /* nothing */

Definition at line 102 of file sbiTunesImporter.cpp.

#define TRACE (   args)    /* nothing */

Definition at line 101 of file sbiTunesImporter.cpp.

Typedef Documentation

typedef nsString(* ValueConversion)(nsAString const &aValue)

typedef for conversion functions used to convert values from iTunes to Songbird

Definition at line 109 of file sbiTunesImporter.cpp.

Function Documentation

static nsresult AddItemsToPlaylist ( sbIMediaList aMediaList,
nsIMutableArray *  aItems 
)
static

Definition at line 1032 of file sbiTunesImporter.cpp.

static nsresult ComputePlaylistSignature ( sbiTunesSignature aSignature,
sbIMediaList aMediaList 
)
static

Definition at line 962 of file sbiTunesImporter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsString ConvertDateTime ( nsAString const &  aDateTime)

Convert the iTunes date/time value specified by aITunesMetaValue to a Songbird date/time property value and return the result.

Parameters
aDateTimeiTunes date/time value.
Returns
Songbird property value.

Definition at line 165 of file sbiTunesImporter.cpp.

Here is the call graph for this function:

nsString ConvertDuration ( nsAString const &  aDuration)

Convert the iTunes duration value specified by aITunesMetaValue to a Songbird duration property value and return the result.

Parameters
aDurationiTunes duration in seconds.
Returns
Songbird property value.

Definition at line 143 of file sbiTunesImporter.cpp.

nsString ConvertRating ( nsAString const &  aRating)

Convert the iTunes rating value specified by aITunesMetaValue to a Songbird rating property value and return the result. 1 star is the same as 20 in iTunes

Parameters
aRatingiTunes rating
Returns
Songbird property value.

Definition at line 121 of file sbiTunesImporter.cpp.

static PLDHashOperator ConvertToPropertyArray ( nsAString const &  aKey,
nsString  aValue,
void *  aUserArg 
)
static

Definition at line 1730 of file sbiTunesImporter.cpp.

static PLDHashOperator EnumReadFunc ( nsAString const &  aKey,
nsString  aValue,
void *  aUserArg 
)
static

Definition at line 1328 of file sbiTunesImporter.cpp.

static nsresult FindPlaylistByName ( sbILibrary aLibrary,
nsAString const &  aPlaylistName,
sbIMediaList **  aMediaList 
)
static

Definition at line 859 of file sbiTunesImporter.cpp.

Here is the call graph for this function:

static nsresult IsPlaylistDirty ( sbIMediaList aMediaList,
PRBool &  aIsDirty 
)
static

Definition at line 983 of file sbiTunesImporter.cpp.

Here is the call graph for this function:

static PRBool IsSongbirdFolder ( sbIStringMap aProperties)
static

Determines if this is the special Songbird folder for playlists

Definition at line 841 of file sbiTunesImporter.cpp.

NS_IMPL_ISUPPORTS2 ( sbiTunesImporter  ,
sbILibraryImporter  ,
sbIiTunesXMLParserListener   
)

Definition at line 255 of file sbiTunesImporter.cpp.

static nsresult StorePlaylistSignature ( sbIMediaList aMediaList)
static

Definition at line 1093 of file sbiTunesImporter.cpp.

Here is the call graph for this function:

Variable Documentation

PropertyMap gPropertyMap[]
Initial value:
= {
{ SB_PROPERTY_ITUNES_GUID, "Persistent ID", 0 },
{ SB_PROPERTY_ALBUMARTISTNAME, "Album Artist", 0 },
{ SB_PROPERTY_ALBUMNAME, "Album", 0 },
{ SB_PROPERTY_ARTISTNAME, "Artist", 0 },
{ SB_PROPERTY_BITRATE, "Bit Rate", 0 },
{ SB_PROPERTY_BPM, "BPM", 0 },
{ SB_PROPERTY_COMMENT, "Comments", 0 },
{ SB_PROPERTY_COMPOSERNAME, "Composer", 0 },
{ SB_PROPERTY_DISCNUMBER, "Disc Number", 0 },
{ SB_PROPERTY_GENRE, "Genre", 0},
{ SB_PROPERTY_PLAYCOUNT, "Play Count", 0 },
{ SB_PROPERTY_SAMPLERATE, "Sample Rate", 0 },
{ SB_PROPERTY_SKIPCOUNT, "Skip Count", 0 },
{ SB_PROPERTY_TOTALDISCS, "Disc Count", 0 },
{ SB_PROPERTY_TOTALTRACKS, "Track Count", 0 },
{ SB_PROPERTY_TRACKNAME, "Name", 0 },
{ SB_PROPERTY_TRACKNUMBER, "Track Number", 0 },
{ SB_PROPERTY_YEAR, "Year", 0 },
}
#define SB_PROPERTY_TOTALDISCS
nsString ConvertDuration(nsAString const &aDuration)
#define SB_PROPERTY_PLAYCOUNT
#define SB_PROPERTY_SAMPLERATE
#define SB_PROPERTY_ALBUMARTISTNAME
#define SB_PROPERTY_RATING
#define SB_PROPERTY_LASTPLAYTIME
#define SB_PROPERTY_TOTALTRACKS
#define SB_PROPERTY_BITRATE
#define SB_PROPERTY_GENRE
#define SB_PROPERTY_DURATION
#define SB_PROPERTY_DISCNUMBER
nsString ConvertRating(nsAString const &aRating)
#define SB_PROPERTY_ARTISTNAME
nsString ConvertDateTime(nsAString const &aDateTime)
#define SB_PROPERTY_BPM
#define SB_PROPERTY_ALBUMNAME
#define SB_PROPERTY_COMPOSERNAME
#define SB_PROPERTY_YEAR
#define SB_PROPERTY_LASTSKIPTIME
#define SB_PROPERTY_TRACKNAME
#define SB_PROPERTY_COMMENT
#define SB_PROPERTY_ITUNES_GUID
#define SB_PROPERTY_SKIPCOUNT
#define SB_PROPERTY_TRACKNUMBER

Mapping between Songbird properties and iTunes

Definition at line 230 of file sbiTunesImporter.cpp.

char const SB_ITUNES_LIBRARY_IMPORT_PREF_PREFIX[] = "library_import.itunes"

Definition at line 81 of file sbiTunesImporter.cpp.

char const SB_ITUNES_LIBRARY_IMPORTER_PREF_PREFIX[] = "songbird.library_importer."

Definition at line 82 of file sbiTunesImporter.cpp.