itdb.h   itdb.h 
skipping to change at line 32 skipping to change at line 32
| Lesser General Public License for more details. | Lesser General Public License for more details.
| |
| You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public
| License along with this code; if not, write to the Free Software | License along with this code; if not, write to the Free Software
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
| |
| iTunes and iPod are trademarks of Apple | iTunes and iPod are trademarks of Apple
| |
| This product is not supported/written/published by Apple! | This product is not supported/written/published by Apple!
| |
| $Id: itdb.h 1753 2007-11-04 00:48:12Z jcsjcs $ | $Id: itdb.h 2193 2009-01-03 02:58:02Z tmzullinger $
*/ */
#ifndef __ITUNESDB_H__ #ifndef __ITUNESDB_H__
#define __ITUNESDB_H__ #define __ITUNESDB_H__
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <glib.h> #include <glib.h>
G_BEGIN_DECLS G_BEGIN_DECLS
/* G_GNUC_INTERNAL is defined in glib 2.6 */ /* G_GNUC_INTERNAL is defined in glib 2.6 */
#ifndef G_GNUC_INTERNAL #ifndef G_GNUC_INTERNAL
#define G_GNUC_INTERNAL #define G_GNUC_INTERNAL
#endif #endif
/**
* ItdbUserDataDestroyFunc:
* @userdata: A #gpointer to user data
*
* Function called to free userdata
*/
typedef void (* ItdbUserDataDestroyFunc) (gpointer userdata); typedef void (* ItdbUserDataDestroyFunc) (gpointer userdata);
/**
* ItdbUserDataDuplicateFunc:
* @userdata: A #gpointer to user data
*
* Function called to duplicate userdata
*
* Returns: A #gpointer
*/
typedef gpointer (* ItdbUserDataDuplicateFunc) (gpointer userdata); typedef gpointer (* ItdbUserDataDuplicateFunc) (gpointer userdata);
/* public structures */ /* public structures */
typedef struct _Itdb_Device Itdb_Device; typedef struct _Itdb_Device Itdb_Device;
typedef struct _Itdb_IpodInfo Itdb_IpodInfo; typedef struct _Itdb_IpodInfo Itdb_IpodInfo;
typedef struct _Itdb_Artwork Itdb_Artwork; typedef struct _Itdb_Artwork Itdb_Artwork;
typedef struct _Itdb_ArtworkFormat Itdb_ArtworkFormat;
typedef struct _Itdb_Thumb Itdb_Thumb; typedef struct _Itdb_Thumb Itdb_Thumb;
typedef struct _Itdb_SPLPref Itdb_SPLPref; typedef struct _Itdb_SPLPref Itdb_SPLPref;
typedef struct _Itdb_SPLRule Itdb_SPLRule; typedef struct _Itdb_SPLRule Itdb_SPLRule;
typedef struct _Itdb_SPLRules Itdb_SPLRules; typedef struct _Itdb_SPLRules Itdb_SPLRules;
typedef struct _Itdb_iTunesDB Itdb_iTunesDB; typedef struct _Itdb_iTunesDB Itdb_iTunesDB;
typedef struct _Itdb_PhotoDB Itdb_PhotoDB; typedef struct _Itdb_PhotoDB Itdb_PhotoDB;
typedef struct _Itdb_Playlist Itdb_Playlist; typedef struct _Itdb_Playlist Itdb_Playlist;
typedef struct _Itdb_PhotoAlbum Itdb_PhotoAlbum; typedef struct _Itdb_PhotoAlbum Itdb_PhotoAlbum;
typedef struct _Itdb_Track Itdb_Track; typedef struct _Itdb_Track Itdb_Track;
typedef struct _Itdb_Chapter Itdb_Chapter;
typedef struct _Itdb_Chapterdata Itdb_Chapterdata;
/* ------------------------------------------------------------ *\ /* ------------------------------------------------------------ *\
* *
* iPod model-relevant definitions * iPod model-relevant definitions
* *
\* ------------------------------------------------------------ */ \* ------------------------------------------------------------ */
/**
* Itdb_IpodGeneration:
* @ITDB_IPOD_GENERATION_UNKNOWN: Unknown iPod
* @ITDB_IPOD_GENERATION_FIRST: First Generation iPod
* @ITDB_IPOD_GENERATION_SECOND: Second Generation iPod
* @ITDB_IPOD_GENERATION_THIRD: Third Generation iPod
* @ITDB_IPOD_GENERATION_FOURTH: Fourth Generation iPod
* @ITDB_IPOD_GENERATION_PHOTO: Photo iPod
* @ITDB_IPOD_GENERATION_MOBILE: Mobile iPod
* @ITDB_IPOD_GENERATION_MINI_1: First Generation iPod Mini
* @ITDB_IPOD_GENERATION_MINI_2: Second Generation iPod Mini
* @ITDB_IPOD_GENERATION_SHUFFLE_1: First Generation iPod Shuffle
* @ITDB_IPOD_GENERATION_SHUFFLE_2: Second Generation iPod Shuffle
* @ITDB_IPOD_GENERATION_SHUFFLE_3: Third Generation iPod Shuffle
* @ITDB_IPOD_GENERATION_NANO_1: First Generation iPod Nano
* @ITDB_IPOD_GENERATION_NANO_2: Second Generation iPod Nano
* @ITDB_IPOD_GENERATION_NANO_3: Third Generation iPod Nano
* @ITDB_IPOD_GENERATION_NANO_4: Fourth Generation iPod Nano
* @ITDB_IPOD_GENERATION_VIDEO_1: First Generation iPod Video (aka 5g)
* @ITDB_IPOD_GENERATION_VIDEO_2: Second Generation iPod Video (aka 5.5g)
* @ITDB_IPOD_GENERATION_CLASSIC_1: First Generation iPod Classic
* @ITDB_IPOD_GENERATION_CLASSIC_2: Second Generation iPod Classic
* @ITDB_IPOD_GENERATION_TOUCH_1: First Generation iPod Touch
* @ITDB_IPOD_GENERATION_IPHONE_1: First Generation iPhone
*
* iPod generation information
*
* See http://support.apple.com/kb/HT1353 and http://en.wikipedia.org/wiki/
IPod
* for more details.
*
* Since: 0.4.0
*/
typedef enum { typedef enum {
ITDB_IPOD_GENERATION_UNKNOWN, ITDB_IPOD_GENERATION_UNKNOWN,
ITDB_IPOD_GENERATION_FIRST, ITDB_IPOD_GENERATION_FIRST,
ITDB_IPOD_GENERATION_SECOND, ITDB_IPOD_GENERATION_SECOND,
ITDB_IPOD_GENERATION_THIRD, ITDB_IPOD_GENERATION_THIRD,
ITDB_IPOD_GENERATION_FOURTH, ITDB_IPOD_GENERATION_FOURTH,
ITDB_IPOD_GENERATION_PHOTO, ITDB_IPOD_GENERATION_PHOTO,
ITDB_IPOD_GENERATION_MOBILE, ITDB_IPOD_GENERATION_MOBILE,
ITDB_IPOD_GENERATION_MINI_1, ITDB_IPOD_GENERATION_MINI_1,
ITDB_IPOD_GENERATION_MINI_2, ITDB_IPOD_GENERATION_MINI_2,
ITDB_IPOD_GENERATION_SHUFFLE_1, ITDB_IPOD_GENERATION_SHUFFLE_1,
ITDB_IPOD_GENERATION_SHUFFLE_2, ITDB_IPOD_GENERATION_SHUFFLE_2,
ITDB_IPOD_GENERATION_SHUFFLE_3, ITDB_IPOD_GENERATION_SHUFFLE_3,
ITDB_IPOD_GENERATION_NANO_1, ITDB_IPOD_GENERATION_NANO_1,
ITDB_IPOD_GENERATION_NANO_2, ITDB_IPOD_GENERATION_NANO_2,
ITDB_IPOD_GENERATION_NANO_3, ITDB_IPOD_GENERATION_NANO_3,
ITDB_IPOD_GENERATION_NANO_4,
ITDB_IPOD_GENERATION_VIDEO_1, ITDB_IPOD_GENERATION_VIDEO_1,
ITDB_IPOD_GENERATION_VIDEO_2, ITDB_IPOD_GENERATION_VIDEO_2,
ITDB_IPOD_GENERATION_CLASSIC_1, ITDB_IPOD_GENERATION_CLASSIC_1,
ITDB_IPOD_GENERATION_CLASSIC_2,
ITDB_IPOD_GENERATION_TOUCH_1, ITDB_IPOD_GENERATION_TOUCH_1,
/* The following 2 are no longer in use and should be removed */ ITDB_IPOD_GENERATION_IPHONE_1,
ITDB_IPOD_GENERATION_FIFTH,
ITDB_IPOD_GENERATION_SIXTH,
} Itdb_IpodGeneration; } Itdb_IpodGeneration;
/**
* Itdb_IpodModel:
* @ITDB_IPOD_MODEL_INVALID: Invalid model
* @ITDB_IPOD_MODEL_UNKNOWN: Unknown model
* @ITDB_IPOD_MODEL_COLOR: Color iPod
* @ITDB_IPOD_MODEL_COLOR_U2: Color iPod (U2)
* @ITDB_IPOD_MODEL_REGULAR: Regular iPod
* @ITDB_IPOD_MODEL_REGULAR_U2: Regular iPod (U2)
* @ITDB_IPOD_MODEL_MINI: iPod Mini
* @ITDB_IPOD_MODEL_MINI_BLUE: iPod Mini (Blue)
* @ITDB_IPOD_MODEL_MINI_PINK: iPod Mini (Pink)
* @ITDB_IPOD_MODEL_MINI_GREEN: iPod Mini (Green)
* @ITDB_IPOD_MODEL_MINI_GOLD: iPod Mini (Gold)
* @ITDB_IPOD_MODEL_SHUFFLE: iPod Shuffle
* @ITDB_IPOD_MODEL_NANO_WHITE: iPod Nano (White)
* @ITDB_IPOD_MODEL_NANO_BLACK: iPod Nano (Black)
* @ITDB_IPOD_MODEL_VIDEO_WHITE: iPod Video (White)
* @ITDB_IPOD_MODEL_VIDEO_BLACK: iPod Video (Black)
* @ITDB_IPOD_MODEL_MOBILE_1: Mobile iPod
* @ITDB_IPOD_MODEL_VIDEO_U2: iPod Video (U2)
* @ITDB_IPOD_MODEL_NANO_SILVER: iPod Nano (Silver)
* @ITDB_IPOD_MODEL_NANO_BLUE: iPod Nano (Blue)
* @ITDB_IPOD_MODEL_NANO_GREEN: iPod Nano (Green)
* @ITDB_IPOD_MODEL_NANO_PINK: iPod Nano (Pink)
* @ITDB_IPOD_MODEL_NANO_RED: iPod Nano (Red)
* @ITDB_IPOD_MODEL_NANO_YELLOW: iPod Nano (Yellow)
* @ITDB_IPOD_MODEL_NANO_PURPLE: iPod Nano (Purple)
* @ITDB_IPOD_MODEL_NANO_ORANGE: iPod Nano (Orange)
* @ITDB_IPOD_MODEL_IPHONE_1: iPhone
* @ITDB_IPOD_MODEL_SHUFFLE_SILVER: iPod Shuffle (Silver)
* @ITDB_IPOD_MODEL_SHUFFLE_PINK: iPod Shuffle (Pink)
* @ITDB_IPOD_MODEL_SHUFFLE_BLUE: iPod Shuffle (Blue)
* @ITDB_IPOD_MODEL_SHUFFLE_GREEN: iPod Shuffle (Green)
* @ITDB_IPOD_MODEL_SHUFFLE_ORANGE: iPod Shuffle (Orange)
* @ITDB_IPOD_MODEL_SHUFFLE_PURPLE: iPod Shuffle (Purple)
* @ITDB_IPOD_MODEL_SHUFFLE_RED: iPod Shuffle (Red)
* @ITDB_IPOD_MODEL_CLASSIC_SILVER: iPod Classic (Silver)
* @ITDB_IPOD_MODEL_CLASSIC_BLACK: iPod Classic (Black)
* @ITDB_IPOD_MODEL_TOUCH_BLACK: iPod Touch (Black)
*
* iPod model information
*
* Since: 0.4.0
*/
typedef enum { typedef enum {
ITDB_IPOD_MODEL_INVALID, ITDB_IPOD_MODEL_INVALID,
ITDB_IPOD_MODEL_UNKNOWN, ITDB_IPOD_MODEL_UNKNOWN,
ITDB_IPOD_MODEL_COLOR, ITDB_IPOD_MODEL_COLOR,
ITDB_IPOD_MODEL_COLOR_U2, ITDB_IPOD_MODEL_COLOR_U2,
ITDB_IPOD_MODEL_REGULAR, ITDB_IPOD_MODEL_REGULAR,
ITDB_IPOD_MODEL_REGULAR_U2, ITDB_IPOD_MODEL_REGULAR_U2,
ITDB_IPOD_MODEL_MINI, ITDB_IPOD_MODEL_MINI,
ITDB_IPOD_MODEL_MINI_BLUE, ITDB_IPOD_MODEL_MINI_BLUE,
ITDB_IPOD_MODEL_MINI_PINK, ITDB_IPOD_MODEL_MINI_PINK,
skipping to change at line 125 skipping to change at line 219
ITDB_IPOD_MODEL_NANO_BLACK, ITDB_IPOD_MODEL_NANO_BLACK,
ITDB_IPOD_MODEL_VIDEO_WHITE, ITDB_IPOD_MODEL_VIDEO_WHITE,
ITDB_IPOD_MODEL_VIDEO_BLACK, ITDB_IPOD_MODEL_VIDEO_BLACK,
ITDB_IPOD_MODEL_MOBILE_1, ITDB_IPOD_MODEL_MOBILE_1,
ITDB_IPOD_MODEL_VIDEO_U2, ITDB_IPOD_MODEL_VIDEO_U2,
ITDB_IPOD_MODEL_NANO_SILVER, ITDB_IPOD_MODEL_NANO_SILVER,
ITDB_IPOD_MODEL_NANO_BLUE, ITDB_IPOD_MODEL_NANO_BLUE,
ITDB_IPOD_MODEL_NANO_GREEN, ITDB_IPOD_MODEL_NANO_GREEN,
ITDB_IPOD_MODEL_NANO_PINK, ITDB_IPOD_MODEL_NANO_PINK,
ITDB_IPOD_MODEL_NANO_RED, ITDB_IPOD_MODEL_NANO_RED,
ITDB_IPOD_MODEL_NANO_YELLOW,
ITDB_IPOD_MODEL_NANO_PURPLE,
ITDB_IPOD_MODEL_NANO_ORANGE,
ITDB_IPOD_MODEL_IPHONE_1, ITDB_IPOD_MODEL_IPHONE_1,
ITDB_IPOD_MODEL_SHUFFLE_SILVER, ITDB_IPOD_MODEL_SHUFFLE_SILVER,
ITDB_IPOD_MODEL_SHUFFLE_PINK, ITDB_IPOD_MODEL_SHUFFLE_PINK,
ITDB_IPOD_MODEL_SHUFFLE_BLUE, ITDB_IPOD_MODEL_SHUFFLE_BLUE,
ITDB_IPOD_MODEL_SHUFFLE_GREEN, ITDB_IPOD_MODEL_SHUFFLE_GREEN,
ITDB_IPOD_MODEL_SHUFFLE_ORANGE, ITDB_IPOD_MODEL_SHUFFLE_ORANGE,
ITDB_IPOD_MODEL_SHUFFLE_PURPLE, ITDB_IPOD_MODEL_SHUFFLE_PURPLE,
ITDB_IPOD_MODEL_SHUFFLE_RED,
ITDB_IPOD_MODEL_CLASSIC_SILVER, ITDB_IPOD_MODEL_CLASSIC_SILVER,
ITDB_IPOD_MODEL_CLASSIC_BLACK, ITDB_IPOD_MODEL_CLASSIC_BLACK,
ITDB_IPOD_MODEL_TOUCH_BLACK, ITDB_IPOD_MODEL_TOUCH_BLACK,
} Itdb_IpodModel; } Itdb_IpodModel;
/**
* Itdb_IpodInfo:
* @model_number: The model number. This is abbreviated. If the first
* character is not numeric, it is ommited. e.g.
* "MA350 -> A350", "M9829 -> 9829"
* @capacity: The iPod's capacity in gigabytes
* @ipod_model: The iPod model
* @ipod_generation: The iPod generation
* @musicdirs: The number of music (Fnn) dirs created by iTunes. The
* exact number seems to be version dependent. Therefore,
the
* numbers here represent a mixture of reported values an
d
* common sense. Note: this number does not necessarily
* represent the number of dirs present on a particular i
Pod.
* It is used when setting up a new iPod from scratch.
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
*
* Structure representing information about an iPod
*
* Since: 0.4.0
*/
struct _Itdb_IpodInfo { struct _Itdb_IpodInfo {
/* model_number is abbreviated: if the first character is not
numeric, it is ommited. e.g. "MA350 -> A350", "M9829 -> 9829" */
const gchar *model_number; const gchar *model_number;
const double capacity; /* in GB */ const double capacity;
const Itdb_IpodModel ipod_model; const Itdb_IpodModel ipod_model;
const Itdb_IpodGeneration ipod_generation; const Itdb_IpodGeneration ipod_generation;
/* Number of music (Fnn) dirs created by iTunes. The exact number
seems to be version dependent. Therefore, the numbers here
represent a mixture of reported values and common sense. Note:
this number does not necessarily represent the number of dirs
present on a particular iPod. It is used when setting up a new
iPod from scratch. */
const guint musicdirs; const guint musicdirs;
/* reserved for future use */ /* reserved for future use */
const gint32 reserved_int1; const gint32 reserved_int1;
const gint32 reserved_int2; const gint32 reserved_int2;
gconstpointer reserved1; gconstpointer reserved1;
gconstpointer reserved2; gconstpointer reserved2;
}; };
/* ------------------------------------------------------------ *\ /* ------------------------------------------------------------ *\
* *
* Smart Playlists (Rules) * Smart Playlists (Rules)
* *
\* ------------------------------------------------------------ */ \* ------------------------------------------------------------ */
/* Most of the knowledge about smart playlists has been provided by /* Most of the knowledge about smart playlists has been provided by
Samuel "Otto" Wood (sam dot wood at gmail dot com) who let me dig Samuel "Otto" Wood (sam dot wood at gmail dot com) who let me dig
in his impressive C++ class. Contact him for a complete in his impressive C++ class. Contact him for a complete
copy. Further, all enums and #defines below, Itdb_SPLRule, Itdb_SPLRules , and copy. Further, all enums and #defines below, Itdb_SPLRule, Itdb_SPLRules , and
Itdb_SPLPref may also be used under a FreeBSD license. */ Itdb_SPLPref may also be used under a FreeBSD license. */
/**
* ITDB_SPL_STRING_MAXLEN:
*
* Maximum string length for smart playlists
*
* Since: 0.5.0
*/
#define ITDB_SPL_STRING_MAXLEN 255 #define ITDB_SPL_STRING_MAXLEN 255
/**
* ITDB_SPL_DATE_IDENTIFIER:
*
* Identifier for smart playlist date fields
*
* Since: 0.5.0
*/
#define ITDB_SPL_DATE_IDENTIFIER (G_GINT64_CONSTANT (0x2dae2dae2dae2daeU)) #define ITDB_SPL_DATE_IDENTIFIER (G_GINT64_CONSTANT (0x2dae2dae2dae2daeU))
/* Definitions for smart playlists */ /* Definitions for smart playlists */
typedef enum { /* types for match_operator */
ITDB_SPLMATCH_AND = 0, /* AND rule - all of the rules must be true in /**
order for the combined rule to be applied */ * ItdbSPLMatch:
ITDB_SPLMATCH_OR = 1 /* OR rule */ * @ITDB_SPLMATCH_AND: Logical AND - all of the rules must be true in order
for
* the combined rule to be applied
* @ITDB_SPLMATCH_OR: Logical OR - any of the rules may be true
*
* Types for smart playlist rules match_operator
*/
typedef enum {
ITDB_SPLMATCH_AND = 0,
ITDB_SPLMATCH_OR = 1
} ItdbSPLMatch; } ItdbSPLMatch;
/* Limit Types.. like limit playlist to 100 minutes or to 100 songs */ /**
* ItdbLimitType:
* @ITDB_LIMITTYPE_MINUTES: Limit in minutes
* @ITDB_LIMITTYPE_MB: Limit in megabytes
* @ITDB_LIMITTYPE_SONGS: Limit in number of songs
* @ITDB_LIMITTYPE_HOURS: Limit in hours
* @ITDB_LIMITTYPE_GB: Limit in gigabytes
*
* The type of unit to use when limiting a playlist
*
* Since: 0.5.0
*/
typedef enum { typedef enum {
ITDB_LIMITTYPE_MINUTES = 0x01, ITDB_LIMITTYPE_MINUTES = 0x01,
ITDB_LIMITTYPE_MB = 0x02, ITDB_LIMITTYPE_MB = 0x02,
ITDB_LIMITTYPE_SONGS = 0x03, ITDB_LIMITTYPE_SONGS = 0x03,
ITDB_LIMITTYPE_HOURS = 0x04, ITDB_LIMITTYPE_HOURS = 0x04,
ITDB_LIMITTYPE_GB = 0x05 ITDB_LIMITTYPE_GB = 0x05
} ItdbLimitType; } ItdbLimitType;
/* Limit Sorts.. Like which songs to pick when using a limit type /**
Special note: the values for ITDB_LIMITSORT_LEAST_RECENTLY_ADDED, * ItdbLimitSort:
ITDB_LIMITSORT_LEAST_OFTEN_PLAYED, ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED, * @ITDB_LIMITSORT_RANDOM: Sort randomly
and * @ITDB_LIMITSORT_SONG_NAME: Sort by track name
ITDB_LIMITSORT_LOWEST_RATING are really 0x10, 0x14, 0x15, 0x17, with the * @ITDB_LIMITSORT_ALBUM: Sort by album name
'limitsort_opposite' flag set. This is the same value as the * @ITDB_LIMITSORT_ARTIST: Sort by artist name
"positive" value (i.e. ITDB_LIMITSORT_LEAST_RECENTLY_ADDED), and is * @ITDB_LIMITSORT_GENRE: Sort by genre
really very terribly awfully weird, so we map the values to iPodDB * @ITDB_LIMITSORT_MOST_RECENTLY_ADDED: Sort by most recently added
specific values with the high bit set. * @ITDB_LIMITSORT_LEAST_RECENTLY_ADDED: Sort by least recently added
* @ITDB_LIMITSORT_MOST_OFTEN_PLAYED: Sort by most often played
On writing, we check the high bit and write the limitsort_opposite * @ITDB_LIMITSORT_LEAST_OFTEN_PLAYED: Sort by least often played
from that. That way, we don't have to deal with programs using the * @ITDB_LIMITSORT_MOST_RECENTLY_PLAYED: Sort by most recently played
class needing to set the wrong limit and then make it into the * @ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED: Sort by least recently played
"opposite", which would be frickin' annoying. */ * @ITDB_LIMITSORT_HIGHEST_RATING: Sort by highest rating
* @ITDB_LIMITSORT_LOWEST_RATING: Sort by lowest rating
*
* Which songs to pick when using a limit type
*
* Note: the values for #ITDB_LIMITSORT_LEAST_RECENTLY_ADDED,
* #ITDB_LIMITSORT_LEAST_OFTEN_PLAYED, #ITDB_LIMITSORT_LEAST_RECENTLY_PLAYE
D,
* and #ITDB_LIMITSORT_LOWEST_RATING are really 0x10, 0x14, 0x15, 0x17, wit
h the
* 'limitsort_opposite' flag set. This is the same value as the "positive"
* value (i.e. #ITDB_LIMITSORT_LEAST_RECENTLY_ADDED), and is really very
* terribly awfully weird, so we map the values to iPodDB specific values w
ith
* the high bit set.
*
* On writing, we check the high bit and write the limitsort_opposite from
that.
* That way, we don't have to deal with programs using the class needing to
set
* the wrong limit and then make it into the "opposite", which would be fri
ckin'
* annoying.
*
* Since: 0.5.0
*/
typedef enum { typedef enum {
ITDB_LIMITSORT_RANDOM = 0x02, ITDB_LIMITSORT_RANDOM = 0x02,
ITDB_LIMITSORT_SONG_NAME = 0x03, ITDB_LIMITSORT_SONG_NAME = 0x03,
ITDB_LIMITSORT_ALBUM = 0x04, ITDB_LIMITSORT_ALBUM = 0x04,
ITDB_LIMITSORT_ARTIST = 0x05, ITDB_LIMITSORT_ARTIST = 0x05,
ITDB_LIMITSORT_GENRE = 0x07, ITDB_LIMITSORT_GENRE = 0x07,
ITDB_LIMITSORT_MOST_RECENTLY_ADDED = 0x10, ITDB_LIMITSORT_MOST_RECENTLY_ADDED = 0x10,
ITDB_LIMITSORT_LEAST_RECENTLY_ADDED = 0x80000010, /* See note above */ ITDB_LIMITSORT_LEAST_RECENTLY_ADDED = 0x80000010, /* See note above */
ITDB_LIMITSORT_MOST_OFTEN_PLAYED = 0x14, ITDB_LIMITSORT_MOST_OFTEN_PLAYED = 0x14,
ITDB_LIMITSORT_LEAST_OFTEN_PLAYED = 0x80000014, /* See note above */ ITDB_LIMITSORT_LEAST_OFTEN_PLAYED = 0x80000014, /* See note above */
ITDB_LIMITSORT_MOST_RECENTLY_PLAYED = 0x15, ITDB_LIMITSORT_MOST_RECENTLY_PLAYED = 0x15,
ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED = 0x80000015,/* See note above */ ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED = 0x80000015,/* See note above */
ITDB_LIMITSORT_HIGHEST_RATING = 0x17, ITDB_LIMITSORT_HIGHEST_RATING = 0x17,
ITDB_LIMITSORT_LOWEST_RATING = 0x80000017, /* See note above */ ITDB_LIMITSORT_LOWEST_RATING = 0x80000017, /* See note above */
} ItdbLimitSort; } ItdbLimitSort;
/* Smartlist Actions - Used in the rules. /**
Note by Otto (Samuel Wood): * ItdbSPLAction:
really this is a bitmapped field... * @ITDB_SPLACTION_IS_INT: is integer ("Is Set" in iTunes)
high byte * @ITDB_SPLACTION_IS_GREATER_THAN: is greater than ("Is after" in iTun
bit 0 = "string" values if set, "int" values if not set es)
bit 1 = "not", or to negate the check. * @ITDB_SPLACTION_IS_LESS_THAN: is less than ("Is Before" in iTunes
lower 2 bytes )
bit 0 = simple "IS" query * @ITDB_SPLACTION_IS_IN_THE_RANGE: is in the range
bit 1 = contains * @ITDB_SPLACTION_IS_IN_THE_LAST: is in the last
bit 2 = begins with * @ITDB_SPLACTION_BINARY_AND: binary AND
bit 3 = ends with * @ITDB_SPLACTION_IS_STRING: is a string
bit 4 = greater than * @ITDB_SPLACTION_CONTAINS: contains
bit 5 = unknown, but probably greater than or equal to * @ITDB_SPLACTION_STARTS_WITH: starts with
bit 6 = less than * @ITDB_SPLACTION_ENDS_WITH: ends with
bit 7 = unknown, but probably less than or equal to * @ITDB_SPLACTION_IS_NOT_INT: is not an integer ("Is Not Set" in
bit 8 = a range selection iTunes)
bit 9 = "in the last" * @ITDB_SPLACTION_IS_NOT_GREATER_THAN: is not greater than (not in iTunes)
* @ITDB_SPLACTION_IS_NOT_LESS_THAN: is not less than (not in iTunes)
* @ITDB_SPLACTION_IS_NOT_IN_THE_RANGE: is not in the range (not in iTunes)
* @ITDB_SPLACTION_IS_NOT_IN_THE_LAST: is not in the last
* @ITDB_SPLACTION_IS_NOT: is not
* @ITDB_SPLACTION_DOES_NOT_CONTAIN: does not contain
* @ITDB_SPLACTION_DOES_NOT_START_WITH: does not start with (not in iTunes)
* @ITDB_SPLACTION_DOES_NOT_END_WITH: does not end with (not in iTunes)
*
* Smartlist Actions used in smart playlist rules.
*
* Note by Otto (Samuel Wood):
* <informalexample>
* <programlisting>
* really this is a bitmapped field...
* high byte
* bit 0 = "string" values if set, "int" values if not set
* bit 1 = "not", or to negate the check.
* lower 2 bytes
* bit 0 = simple "IS" query
* bit 1 = contains
* bit 2 = begins with
* bit 3 = ends with
* bit 4 = greater than
* bit 5 = unknown, but probably greater than or equal to
* bit 6 = less than
* bit 7 = unknown, but probably less than or equal to
* bit 8 = a range selection
* bit 9 = "in the last"
* </programlisting>
* </informalexample>
*
* Since: 0.5.0
*/ */
typedef enum { typedef enum {
ITDB_SPLACTION_IS_INT = 0x00000001, /* "Is Set" in iTunes */ ITDB_SPLACTION_IS_INT = 0x00000001,
ITDB_SPLACTION_IS_GREATER_THAN = 0x00000010, /* "Is After" in iTunes */ ITDB_SPLACTION_IS_GREATER_THAN = 0x00000010,
ITDB_SPLACTION_IS_LESS_THAN = 0x00000040, /* "Is Before" in iTunes * ITDB_SPLACTION_IS_LESS_THAN = 0x00000040,
/
ITDB_SPLACTION_IS_IN_THE_RANGE = 0x00000100, ITDB_SPLACTION_IS_IN_THE_RANGE = 0x00000100,
ITDB_SPLACTION_IS_IN_THE_LAST = 0x00000200, ITDB_SPLACTION_IS_IN_THE_LAST = 0x00000200,
ITDB_SPLACTION_BINARY_AND = 0x00000400, ITDB_SPLACTION_BINARY_AND = 0x00000400,
ITDB_SPLACTION_IS_STRING = 0x01000001, ITDB_SPLACTION_IS_STRING = 0x01000001,
ITDB_SPLACTION_CONTAINS = 0x01000002, ITDB_SPLACTION_CONTAINS = 0x01000002,
ITDB_SPLACTION_STARTS_WITH = 0x01000004, ITDB_SPLACTION_STARTS_WITH = 0x01000004,
ITDB_SPLACTION_ENDS_WITH = 0x01000008, ITDB_SPLACTION_ENDS_WITH = 0x01000008,
ITDB_SPLACTION_IS_NOT_INT = 0x02000001, /* "Is Not Set" in iTunes * ITDB_SPLACTION_IS_NOT_INT = 0x02000001,
/
/* Note: Not available in iTunes 4.5 (untested on iPod) */
ITDB_SPLACTION_IS_NOT_GREATER_THAN = 0x02000010, ITDB_SPLACTION_IS_NOT_GREATER_THAN = 0x02000010,
/* Note: Not available in iTunes 4.5 (untested on iPod) */
ITDB_SPLACTION_IS_NOT_LESS_THAN = 0x02000040, ITDB_SPLACTION_IS_NOT_LESS_THAN = 0x02000040,
/* Note: Not available in iTunes 4.5 (seems to work on iPod) */
ITDB_SPLACTION_IS_NOT_IN_THE_RANGE = 0x02000100, ITDB_SPLACTION_IS_NOT_IN_THE_RANGE = 0x02000100,
ITDB_SPLACTION_IS_NOT_IN_THE_LAST = 0x02000200, ITDB_SPLACTION_IS_NOT_IN_THE_LAST = 0x02000200,
ITDB_SPLACTION_IS_NOT = 0x03000001, ITDB_SPLACTION_IS_NOT = 0x03000001,
ITDB_SPLACTION_DOES_NOT_CONTAIN = 0x03000002, ITDB_SPLACTION_DOES_NOT_CONTAIN = 0x03000002,
/* Note: Not available in iTunes 4.5 (seems to work on iPod) */
ITDB_SPLACTION_DOES_NOT_START_WITH = 0x03000004, ITDB_SPLACTION_DOES_NOT_START_WITH = 0x03000004,
/* Note: Not available in iTunes 4.5 (seems to work on iPod) */
ITDB_SPLACTION_DOES_NOT_END_WITH = 0x03000008, ITDB_SPLACTION_DOES_NOT_END_WITH = 0x03000008,
} ItdbSPLAction; } ItdbSPLAction;
/**
* ItdbSPLFieldType:
* @ITDB_SPLFT_STRING: string
* @ITDB_SPLFT_INT: integer
* @ITDB_SPLFT_BOOLEAN: boolean
* @ITDB_SPLFT_DATE: date
* @ITDB_SPLFT_PLAYLIST: playlist
* @ITDB_SPLFT_UNKNOWN: unknown
* @ITDB_SPLFT_BINARY_AND: binary AND
*
* Smart Playlist Field Types
*
* Since: 0.5.0
*/
typedef enum typedef enum
{ {
ITDB_SPLFT_STRING = 1, ITDB_SPLFT_STRING = 1,
ITDB_SPLFT_INT, ITDB_SPLFT_INT,
ITDB_SPLFT_BOOLEAN, ITDB_SPLFT_BOOLEAN,
ITDB_SPLFT_DATE, ITDB_SPLFT_DATE,
ITDB_SPLFT_PLAYLIST, ITDB_SPLFT_PLAYLIST,
ITDB_SPLFT_UNKNOWN, ITDB_SPLFT_UNKNOWN,
ITDB_SPLFT_BINARY_AND ITDB_SPLFT_BINARY_AND
} ItdbSPLFieldType; } ItdbSPLFieldType;
/**
* ItdbSPLActionType:
* @ITDB_SPLAT_STRING: string
* @ITDB_SPLAT_INT: from integer
* @ITDB_SPLAT_DATE: from date ...
* @ITDB_SPLAT_RANGE_INT: an integer range ...
* @ITDB_SPLAT_RANGE_DATE: a date range ...
* @ITDB_SPLAT_INTHELAST: in the last ...
* @ITDB_SPLAT_PLAYLIST: in playlist
* @ITDB_SPLAT_NONE: none
* @ITDB_SPLAT_INVALID: invalid
* @ITDB_SPLAT_UNKNOWN: unknown
* @ITDB_SPLAT_BINARY_AND: is / is not (binary AND)
*
* Smart Playlist Action Types
*
* Since: 0.5.0
*/
typedef enum typedef enum
{ {
ITDB_SPLAT_STRING = 1, ITDB_SPLAT_STRING = 1,
ITDB_SPLAT_INT, ITDB_SPLAT_INT,
ITDB_SPLAT_DATE, ITDB_SPLAT_DATE,
ITDB_SPLAT_RANGE_INT, ITDB_SPLAT_RANGE_INT,
ITDB_SPLAT_RANGE_DATE, ITDB_SPLAT_RANGE_DATE,
ITDB_SPLAT_INTHELAST, ITDB_SPLAT_INTHELAST,
ITDB_SPLAT_PLAYLIST, ITDB_SPLAT_PLAYLIST,
ITDB_SPLAT_NONE, ITDB_SPLAT_NONE,
ITDB_SPLAT_INVALID, ITDB_SPLAT_INVALID,
ITDB_SPLAT_UNKNOWN, ITDB_SPLAT_UNKNOWN,
ITDB_SPLAT_BINARY_AND ITDB_SPLAT_BINARY_AND
} ItdbSPLActionType; } ItdbSPLActionType;
/* These are to pass to AddRule() when you need a unit for the two "in /**
the last" action types Or, in theory, you can use any time * ItdbSPLActionLast:
range... iTunes might not like it, but the iPod shouldn't care. */ * @ITDB_SPLACTION_LAST_DAYS_VALUE: Seconds in 24 hours
* @ITDB_SPLACTION_LAST_WEEKS_VALUE: Seconds in 7 days
* @ITDB_SPLACTION_LAST_MONTHS_VALUE: Seconds in 1 month (approximately)
*
* These are to pass to AddRule() when you need a unit for the two "in the
last"
* action types. In theory, you can use any time range. iTunes might not
* like it, but the iPod shouldn't care.
*
* Since: 0.5.0
*/
typedef enum { typedef enum {
ITDB_SPLACTION_LAST_DAYS_VALUE = 86400, /* nr of secs in 24 hours */ ITDB_SPLACTION_LAST_DAYS_VALUE = 86400, /* nr of secs in 24 hours */
ITDB_SPLACTION_LAST_WEEKS_VALUE = 604800, /* nr of secs in 7 days */ ITDB_SPLACTION_LAST_WEEKS_VALUE = 604800, /* nr of secs in 7 days */
ITDB_SPLACTION_LAST_MONTHS_VALUE = 2628000,/* nr of secs in 30.4167 ITDB_SPLACTION_LAST_MONTHS_VALUE = 2628000,/* nr of secs in 30.4167
days ~= 1 month */ days ~= 1 month */
} ItdbSPLActionLast; } ItdbSPLActionLast;
#if 0 #if 0
// Hey, why limit ourselves to what iTunes can do? If the iPod can deal wit h it, excellent! // Hey, why limit ourselves to what iTunes can do? If the iPod can deal wit h it, excellent!
#define ITDB_SPLACTION_LAST_HOURS_VALUE 3600 // n umber of seconds in 1 hour #define ITDB_SPLACTION_LAST_HOURS_VALUE 3600 // n umber of seconds in 1 hour
#define ITDB_SPLACTION_LAST_MINUTES_VALUE 60 // n umber of seconds in 1 minute #define ITDB_SPLACTION_LAST_MINUTES_VALUE 60 // n umber of seconds in 1 minute
#define ITDB_SPLACTION_LAST_YEARS_VALUE 31536000 // n umber of seconds in 365 days #define ITDB_SPLACTION_LAST_YEARS_VALUE 31536000 // n umber of seconds in 365 days
/* fun ones.. Near as I can tell, all of these work. It's open like that. : )*/ /* fun ones.. Near as I can tell, all of these work. It's open like that. : )*/
#define ITDB_SPLACTION_LAST_LUNARCYCLE_VALUE 2551443 // a "lunar cycle" is the time it takes the moon to circle the earth #define ITDB_SPLACTION_LAST_LUNARCYCLE_VALUE 2551443 // a "lunar cycle" is the time it takes the moon to circle the earth
skipping to change at line 323 skipping to change at line 553
#define ITDB_SPLACTION_LAST_SWATCH_BEAT 86 // a "swatch beat" is 1/1000th of a day.. search for "internet time" on google #define ITDB_SPLACTION_LAST_SWATCH_BEAT 86 // a "swatch beat" is 1/1000th of a day.. search for "internet time" on google
#define ITDB_SPLACTION_LAST_MOMENT 90 // a "moment" is 1/40th of an hour, or 1.5 minutes #define ITDB_SPLACTION_LAST_MOMENT 90 // a "moment" is 1/40th of an hour, or 1.5 minutes
#define ITDB_SPLACTION_LAST_OSTENT 600 // an "ostent" is 1/10th of an hour, or 6 minutes #define ITDB_SPLACTION_LAST_OSTENT 600 // an "ostent" is 1/10th of an hour, or 6 minutes
#define ITDB_SPLACTION_LAST_FORTNIGHT 1209600 // a "fortni ght" is 14 days #define ITDB_SPLACTION_LAST_FORTNIGHT 1209600 // a "fortni ght" is 14 days
#define ITDB_SPLACTION_LAST_VINAL 1728000 // a "vinal" is 20 days #define ITDB_SPLACTION_LAST_VINAL 1728000 // a "vinal" is 20 days
#define ITDB_SPLACTION_LAST_QUARTER 7889231 // a "quarter" is a quarter year #define ITDB_SPLACTION_LAST_QUARTER 7889231 // a "quarter" is a quarter year
#define ITDB_SPLACTION_LAST_SOLAR_YEAR 31556926 // a "solar year" is the time it takes the earth to go around the sun #define ITDB_SPLACTION_LAST_SOLAR_YEAR 31556926 // a "solar year" is the time it takes the earth to go around the sun
#define ITDB_SPLACTION_LAST_SIDEREAL_YEAR 31558150 // a "sidere al year" is the time it takes the earth to reach the same point in space ag ain, compared to the stars #define ITDB_SPLACTION_LAST_SIDEREAL_YEAR 31558150 // a "sidere al year" is the time it takes the earth to reach the same point in space ag ain, compared to the stars
#endif #endif
/* Smartlist fields - Used for rules. */ /**
* ItdbSPLField:
* @ITDB_SPLFIELD_SONG_NAME: Song name (string)
* @ITDB_SPLFIELD_ALBUM: Album (string)
* @ITDB_SPLFIELD_ARTIST: Artist (string)
* @ITDB_SPLFIELD_BITRATE: Bitrate (integer, e.g. from/to = 128)
* @ITDB_SPLFIELD_SAMPLE_RATE: Sample rate (integer, e.g. from/to = 44
100)
* @ITDB_SPLFIELD_YEAR: Year (integer, e.g. from/to = 2004)
* @ITDB_SPLFIELD_GENRE: Genre (string)
* @ITDB_SPLFIELD_KIND: File type (string, e.g. MP3-File)
* @ITDB_SPLFIELD_DATE_MODIFIED: Date modified (integer, e.g.
* from/to = bcf93280 == is before 6/19/20
04)
* @ITDB_SPLFIELD_TRACKNUMBER: Track number (integer, e.g. from/to = 2
)
* @ITDB_SPLFIELD_SIZE: Size (integer, e.g.
* from/to = 0x00600000 for 6MB)
* @ITDB_SPLFIELD_TIME: Time (integer, e.g.
* from/to = 83999 for 1:23/83 seconds)
* @ITDB_SPLFIELD_COMMENT: Comment (string)
* @ITDB_SPLFIELD_DATE_ADDED: Date added (integer, e.g.
* from/to = bcfa83ff == is after 6/19/200
4)
* @ITDB_SPLFIELD_COMPOSER: Composer (string)
* @ITDB_SPLFIELD_PLAYCOUNT: Playcount (integer, e.g. from/to = 1)
* @ITDB_SPLFIELD_LAST_PLAYED: Date last played (integer, e.g.
* from = bcfa83ff (6/19/2004)
* to = 0xbcfbd57f (6/20/2004))
* @ITDB_SPLFIELD_DISC_NUMBER: Disc number (integer, e.g. from/to = 1)
* @ITDB_SPLFIELD_RATING: Rating (integer, e.g.
* from/to = 60 (3 stars))
* @ITDB_SPLFIELD_COMPILATION: Compilation (integer, e.g.
* is set -> ITDB_SPLACTION_IS_INT/from=1,
* not set -> ITDB_SPLACTION_IS_NOT_INT/fr
om=1)
* @ITDB_SPLFIELD_BPM: Beats per minute (integer, e.g.
* from/to = 60)
* @ITDB_SPLFIELD_GROUPING: Grouping (string)
* @ITDB_SPLFIELD_PLAYLIST: FIXME Unknown...not parsed correctly...
* from/to = 0xb6fbad5f for "Purchased Mus
ic".
* Extra data after "to"...
* @ITDB_SPLFIELD_VIDEO_KIND: Logical integer (works on mediatype)
* @ITDB_SPLFIELD_TVSHOW: TV Show (string)
* @ITDB_SPLFIELD_SEASON_NR: Season number (integer)
* @ITDB_SPLFIELD_SKIPCOUNT: Skipcount (integer)
* @ITDB_SPLFIELD_LAST_SKIPPED: Last skipped (integer)
* @ITDB_SPLFIELD_ALBUMARTIST: Album artist (string)
*
* Smart Playlist Fields, used for Smart Playlist Rules (#Itdb_SPLRule).
*
* Since: 0.5.0
*/
typedef enum { typedef enum {
ITDB_SPLFIELD_SONG_NAME = 0x02, /* String */ ITDB_SPLFIELD_SONG_NAME = 0x02,
ITDB_SPLFIELD_ALBUM = 0x03, /* String */ ITDB_SPLFIELD_ALBUM = 0x03,
ITDB_SPLFIELD_ARTIST = 0x04, /* String */ ITDB_SPLFIELD_ARTIST = 0x04,
ITDB_SPLFIELD_BITRATE = 0x05, /* Int (e.g. from/to = 128) */ ITDB_SPLFIELD_BITRATE = 0x05,
ITDB_SPLFIELD_SAMPLE_RATE = 0x06, /* Int (e.g. from/to = 44100) */ ITDB_SPLFIELD_SAMPLE_RATE = 0x06,
ITDB_SPLFIELD_YEAR = 0x07, /* Int (e.g. from/to = 2004) */ ITDB_SPLFIELD_YEAR = 0x07,
ITDB_SPLFIELD_GENRE = 0x08, /* String */ ITDB_SPLFIELD_GENRE = 0x08,
ITDB_SPLFIELD_KIND = 0x09, /* String */ ITDB_SPLFIELD_KIND = 0x09,
ITDB_SPLFIELD_DATE_MODIFIED = 0x0a,/* Int (e.g. from/to = bcf93280 == ITDB_SPLFIELD_DATE_MODIFIED = 0x0a,
is before 6/19/2004)*/ ITDB_SPLFIELD_TRACKNUMBER = 0x0b,
ITDB_SPLFIELD_TRACKNUMBER = 0x0b, /* Int (e.g. from = 1, to = 2) */ ITDB_SPLFIELD_SIZE = 0x0c,
ITDB_SPLFIELD_SIZE = 0x0c, /* Int (e.g. from/to = 0x00600000 ITDB_SPLFIELD_TIME = 0x0d,
for 6MB) */ ITDB_SPLFIELD_COMMENT = 0x0e,
ITDB_SPLFIELD_TIME = 0x0d, /* Int (e.g. from/to = 83999 for ITDB_SPLFIELD_DATE_ADDED = 0x10,
1:23/83 seconds) */ ITDB_SPLFIELD_COMPOSER = 0x12,
ITDB_SPLFIELD_COMMENT = 0x0e, /* String */ ITDB_SPLFIELD_PLAYCOUNT = 0x16,
ITDB_SPLFIELD_DATE_ADDED = 0x10, /* Int (e.g. from/to = bcfa83ff == ITDB_SPLFIELD_LAST_PLAYED = 0x17,
is after 6/19/2004) */ ITDB_SPLFIELD_DISC_NUMBER = 0x18,
ITDB_SPLFIELD_COMPOSER = 0x12, /* String */ ITDB_SPLFIELD_RATING = 0x19,
ITDB_SPLFIELD_PLAYCOUNT = 0x16, /* Int (e.g. from/to = 1) */ ITDB_SPLFIELD_COMPILATION = 0x1f,
ITDB_SPLFIELD_LAST_PLAYED = 0x17, /* Int/ (e.g. from = bcfa83ff (6/19/ ITDB_SPLFIELD_BPM = 0x23,
2004) ITDB_SPLFIELD_GROUPING = 0x27,
to = 0xbcfbd57f (6/20/2004)) */ ITDB_SPLFIELD_PLAYLIST = 0x28,
ITDB_SPLFIELD_DISC_NUMBER = 0x18, /* Int (e.g. from/to = 1) */ ITDB_SPLFIELD_VIDEO_KIND = 0x3c,
ITDB_SPLFIELD_RATING = 0x19, /* Int/Stars Rating (e.g. from/to = ITDB_SPLFIELD_TVSHOW = 0x3e,
60 (3 stars)) */ ITDB_SPLFIELD_SEASON_NR = 0x3f,
ITDB_SPLFIELD_COMPILATION = 0x1f, /* Int (e.g. is set -> ITDB_SPLFIELD_SKIPCOUNT = 0x44,
ITDB_SPLACTION_IS_INT/from=1, ITDB_SPLFIELD_LAST_SKIPPED = 0x45,
is not set -> ITDB_SPLFIELD_ALBUMARTIST = 0x47
ITDB_SPLACTION_IS_NOT_INT/from=1) */
ITDB_SPLFIELD_BPM = 0x23, /* Int (e.g. from/to = 60) */
ITDB_SPLFIELD_GROUPING = 0x27, /* String */
ITDB_SPLFIELD_PLAYLIST = 0x28, /* FIXME - Unknown...not parsed
correctly...from/to = 0xb6fbad5f
for "Purchased Music". Extra
data after "to"... */
ITDB_SPLFIELD_VIDEO_KIND = 0x3c, /* Logic Int */
ITDB_SPLFIELD_TVSHOW = 0x3e, /* String */
ITDB_SPLFIELD_SEASON_NR = 0x3f, /* Int */
ITDB_SPLFIELD_SKIPCOUNT = 0x44, /* Int */
ITDB_SPLFIELD_LAST_SKIPPED = 0x45, /* Int */
ITDB_SPLFIELD_ALBUMARTIST = 0x47 /* String */
} ItdbSPLField; } ItdbSPLField;
/**
* Itdb_SPLPref:
* @liveupdate: Live Updating
* @checkrules: Match this number of rules. If set to 0, ignore ru
les.
* @checklimits: Limit to this number of @limittype. If 0, no limit
s.
* @limittype: an #ItdbLimitType
* @limitsort: an #ItdbLimitSort
* @limitvalue: The value typed next to "Limit type"
* @matchcheckedonly: Match only checked songs
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
*
* Smart Playlist preferences are for various flags that are not strictly s
mart
* playlist "rules."
*
* Since: 0.5.0
*/
struct _Itdb_SPLPref struct _Itdb_SPLPref
{ {
guint8 liveupdate; /* "live Updating" check box */ guint8 liveupdate;
guint8 checkrules; /* "Match X of the following guint8 checkrules;
conditions" check box */ guint8 checklimits;
guint8 checklimits; /* "Limit To..." check box */ guint32 limittype;
guint32 limittype; /* See types defined above */ guint32 limitsort;
guint32 limitsort; /* See types defined above */ guint32 limitvalue;
guint32 limitvalue; /* The value typed next to "Limit guint8 matchcheckedonly;
type" */
guint8 matchcheckedonly; /* "Match only checked songs" check box */
/* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
}; };
/**
* Itdb_SPLRule:
* @field: an #ItdbSPLFieldType
* @action: an #ItdbSPLActionType
* @string: data in UTF8
* @fromvalue: from value
* @fromdate: from date
* @fromunits: from units
* @tovalue: to value
* @todate: to date
* @tounits: to units
* @unk052: Unknown
* @unk056: Unknown
* @unk060: Unknown
* @unk064: Unknown
* @unk068: Unknown
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
*
* Smart Playlist Rule
*
* The from and to fields require some explanation. If @field is a date ty
pe,
* then @value would be set to 0x2dae2dae2dae2dae, @date would be a number,
* (e.g. 2 or -2), and @units would be a time unit in seconds (e.g. one wee
k
* would be 604800). If @field is an integer comparison, like rating = 60
(i.e.
* 3 stars), then @value would be the value we care about (e.g. 60), @date
would
* be 0, and @units would be 1. Binary AND types are similar, @value is th
e
* important part, with @date = 0 and @units = 1. Clear as mud, right?
*
* For more details see <ulink
* url="http://ipodlinux.org/ITunesDB.html&num;Smart_Playlist_Rule_Values">
ipodlinux.org</ulink>.
*
* Since: 0.5.0
*/
struct _Itdb_SPLRule struct _Itdb_SPLRule
{ {
guint32 field; guint32 field;
guint32 action; guint32 action;
gchar *string; /* data in UTF8 */ gchar *string;
/* from and to are pretty stupid.. if it's a date type of field,
then
value = 0x2dae2dae2dae2dae,
date = some number, like 2 or -2
units = unit in seconds, like 604800 = a week
but if this is actually some kind of integer comparison, like
rating = 60 (3 stars)
value = the value we care about
date = 0
units = 1 */
guint64 fromvalue; guint64 fromvalue;
gint64 fromdate; gint64 fromdate;
guint64 fromunits; guint64 fromunits;
guint64 tovalue; guint64 tovalue;
gint64 todate; gint64 todate;
guint64 tounits; guint64 tounits;
guint32 unk052; guint32 unk052;
guint32 unk056; guint32 unk056;
guint32 unk060; guint32 unk060;
guint32 unk064; guint32 unk064;
guint32 unk068; guint32 unk068;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
}; };
/**
* Itdb_SPLRules:
* @unk004: Unknown
* @match_operator: Whether all rules must match (#ITDB_SPLMATCH_AND) or an
y
* rules may match (#ITDB_SPLMATCH_OR)
* @rules: list of #Itdb_SPLRule's
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
*
* Smart Playlist Rules
*
* Since: 0.5.0
*/
struct _Itdb_SPLRules struct _Itdb_SPLRules
{ {
guint32 unk004; guint32 unk004;
guint32 match_operator; /* "All" (logical AND): Itdb_SPLMATCH_AND, guint32 match_operator;
"Any" (logical OR): Itdb_SPLMATCH_OR */
GList *rules; GList *rules;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
}; };
/* ------------------------------------------------------------ *\ /* ------------------------------------------------------------ *\
* *
* iTunesDB, Playlists, Tracks, PhotoDB, Artwork, Thumbnails * Chapters
* *
\* ------------------------------------------------------------ */ \* ------------------------------------------------------------ */
/* one star is how much (track->rating) */ /**
#define ITDB_RATING_STEP 20 * Itdb_Chapter:
* @startpos: The start position of the chapter in ms. The first chapt
/* Types of thumbnails in Itdb_Image */ er
typedef enum { * begins at 1.
ITDB_THUMB_COVER_SMALL = 0, * @chaptertitle: The chapter title in UTF8
ITDB_THUMB_COVER_LARGE, * @reserved_int1: Reserved for future use
ITDB_THUMB_PHOTO_SMALL, * @reserved_int2: Reserved for future use
ITDB_THUMB_PHOTO_LARGE, * @reserved1: Reserved for future use
ITDB_THUMB_PHOTO_FULL_SCREEN, * @reserved2: Reserved for future use
ITDB_THUMB_PHOTO_TV_SCREEN, *
ITDB_THUMB_COVER_XLARGE, /* iPhone: cover flow */ * Structure representing an iTunesDB Chapter
ITDB_THUMB_COVER_MEDIUM, /* iPhone: cover view */ *
ITDB_THUMB_COVER_SMEDIUM, /* iPhone: ?? */ * Since: 0.7.0
ITDB_THUMB_COVER_XSMALL, /* iPhone: ?? */ */
} ItdbThumbType; struct _Itdb_Chapter
{
/* The Itdb_Thumb structure can represent two slightly different guint32 startpos;
thumbnails: gchar *chaptertitle;
/* reserved for future use */
a) a thumbnail before it's transferred to the iPod. gint32 reserved_int1;
gint32 reserved_int2;
offset and size are 0 gpointer reserved1;
gpointer reserved2;
width and height, if unequal 0, will indicate the size on the };
iPod. width and height are set the first time a pixbuf is
requested for this thumbnail.
type is set according to the type this thumbnail represents
filename point to a 'real' image file OR image_data and
image_data_len are set.
b) a thumbnail (big or small) stored on a database in the iPod. In /**
these cases, id corresponds to the ID originally used in the * Itdb_Chapterdata:
database, filename points to a .ithmb file on the iPod * @chapters: A list of chapters (#Itdb_Chapter)
* @unk024: Unknown
* @unk028: Unknown
* @unk032: Unknown
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
*
* Structure representing iTunesDB Chapter data
*
* Since: 0.7.0
*/ */
struct _Itdb_Thumb { struct _Itdb_Chapterdata
ItdbThumbType type; {
gchar *filename; GList *chapters;
guchar *image_data; /* holds the thumbnail data of guint32 unk024;
non-transfered thumbnails when guint32 unk028;
filename == NULL */ guint32 unk032;
gsize image_data_len; /* length of data */
gpointer pixbuf;
gint rotation; /* angle (0, 90, 180, 270) to rotate the imag
e */
guint32 offset;
guint32 size;
gint16 width;
gint16 height;
gint16 horizontal_padding;
gint16 vertical_padding;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
}; };
/* ------------------------------------------------------------ *\
*
* iTunesDB, Playlists, Tracks, PhotoDB, Artwork, Thumbnails
*
\* ------------------------------------------------------------ */
/**
* ITDB_RATING_STEP:
*
* The multiplier for each star in #track->rating
*/
#define ITDB_RATING_STEP 20
/**
* Itdb_Artwork:
* @thumbnail: An #Itdb_Thumb
* @id: Artwork id used by photoalbums. This starts at 0x4
0 and
* is set automatically when the ArtworkDB or PhotoDB
is
* written
* @dbid: The dbid of associated track. Used internally by
* libgpod.
* @unk028: Unknown
* @rating: Rating from iPhoto * 20 (PhotoDB only)
* @unk036: Unknown
* @creation_date: Date the image file was created (PhotoDB only)
* @digitized_date: Date the image was taken (EXIF information, PhotoDB
* only)
* @artwork_size: Size in bytes of the original source image (PhotoDB
* only -- don't touch in case of ArtworkDB!)
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing artwork in an #Itdb_iTunesDB or #Itdb_PhotoDB
*
* Since: 0.3.0
*/
struct _Itdb_Artwork { struct _Itdb_Artwork {
GList *thumbnails; /* list of Itdb_Thumbs */ Itdb_Thumb *thumbnail;
guint32 id; /* Artwork id used by photoalbums, starts at guint32 id;
* 0x40... libgpod will set this on sync. */ guint64 dbid;
gint32 unk028; gint32 unk028;
guint32 rating; /* Rating from iPhoto * 20 (PhotoDB only) */ guint32 rating;
gint32 unk036; gint32 unk036;
time_t creation_date; /* Date the image file was created time_t creation_date;
(creation date of image file (PhotoDB only) */ time_t digitized_date;
time_t digitized_date;/* Date the image was taken (EXIF information, guint32 artwork_size;
PhotoDB only) */
guint32 artwork_size; /* Size in bytes of the original source
image (PhotoDB only -- don't touch in
case of ArtworkDB!) */
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
/* below is for use by application */ /* below is for use by application */
guint64 usertype; guint64 usertype;
gpointer userdata; gpointer userdata;
/* functions called to duplicate/free userdata */ /* functions called to duplicate/free userdata */
ItdbUserDataDuplicateFunc userdata_duplicate; ItdbUserDataDuplicateFunc userdata_duplicate;
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/**
* Itdb_PhotoDB:
* @photos: A list of photos in the database (#Itdb_Artwork)
* @photoalbums: A list of albums in the database (#Itdb_PhotoAlbum)
* @device: iPod device info (#Itdb_Device)
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing an iTunes Photo database
*
* Since: 0.4.0
*/
struct _Itdb_PhotoDB struct _Itdb_PhotoDB
{ {
GList *photos; /* (Itdb_Artwork *) */ GList *photos;
GList *photoalbums; /* (Itdb_PhotoAlbum *) */ GList *photoalbums;
Itdb_Device *device;/* iPod device info */ Itdb_Device *device;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
/* below is for use by application */ /* below is for use by application */
guint64 usertype; guint64 usertype;
gpointer userdata; gpointer userdata;
/* functions called to duplicate/free userdata */ /* functions called to duplicate/free userdata */
ItdbUserDataDuplicateFunc userdata_duplicate; ItdbUserDataDuplicateFunc userdata_duplicate;
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/**
* Itdb_iTunesDB:
* @tracks: A list of tracks in the database (#Itdb_Track)
* @playlists: A list of playlists in the database (#Itdb_Playlist
)
* @filename: The filename of the iTunesDB
* @device: iPod device info (#Itdb_Device)
* @version: The version number of the iTunesDB
* @id: A 64 bit id value for the iTunesDB
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing an iTunes database
*/
struct _Itdb_iTunesDB struct _Itdb_iTunesDB
{ {
GList *tracks; GList *tracks;
GList *playlists; GList *playlists;
gchar *filename; /* filename of iTunesDB */ gchar *filename;
Itdb_Device *device;/* iPod device info */ Itdb_Device *device;
guint32 version; guint32 version;
guint64 id; guint64 id;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
/* below is for use by application */ /* below is for use by application */
guint64 usertype; guint64 usertype;
gpointer userdata; gpointer userdata;
/* functions called to duplicate/free userdata */ /* functions called to duplicate/free userdata */
ItdbUserDataDuplicateFunc userdata_duplicate; ItdbUserDataDuplicateFunc userdata_duplicate;
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/**
* Itdb_PhotoAlbum:
* @photodb: A pointer to the #Itdb_PhotoDB (for convenience)
* @name: The name of photoalbum in UTF8
* @members: A list of photos in album (#Itdb_Artwork)
* @album_type: The album type. 0x01 for master (Photo Library),
* 0x02 for a normal album. (4 and 5 have also been
* seen.)
* @playmusic: Play music during slideshow
* @repeat: Repeat the slideshow
* @random: Show slides in random order
* @show_titles: Show slide captions
* @transition_direction: Transition direction. 0=none, 1=left-to-right,
* 2=right-to-left, 3=top-to-bottom, 4=bottom-to-top
* @slide_duration: Slide duration in seconds
* @transition_duration: Transition duration, in milliseconds
* @song_id: The @dbid2 of a track to play during slideshow
* @unk024: Unknown, seems to be always 0
* @unk028: Unknown, seems to be always 0
* @unk044: Unknown, seems to always be 0
* @unk048: Unknown, seems to always be 0
* @album_id: The id of the album. This is set automatically w
hen
* the PhotoDB is written.
* @prev_album_id: The id of the previous playlist. This is set
* automatically when the PhotoDB is written.
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing an iTunes Photo Album
*
* Since: 0.4.0
*/
struct _Itdb_PhotoAlbum struct _Itdb_PhotoAlbum
{ {
gchar *name; /* name of photoalbum in UTF8 * Itdb_PhotoDB *photodb;
/ gchar *name;
GList *members; /* photos in album (Itdb_Artwork *) * GList *members;
/ guint8 album_type;
guint8 album_type; /* 0x01 for master (Photo Library), guint8 playmusic;
0x02 otherwise (sometimes 4 and 5) */ guint8 repeat;
guint8 playmusic; /* play music during slideshow (from guint8 random;
iPhoto setting) */ guint8 show_titles;
guint8 repeat; /* repeat the slideshow (from iPhoto guint8 transition_direction;
setting) */ gint32 slide_duration;
guint8 random; /* show the slides in random order gint32 transition_duration;
(from iPhoto setting) */ gint64 song_id;
guint8 show_titles; /* show slide captions (from iPhoto gint32 unk024;
setting) */ gint16 unk028;
guint8 transition_direction; /* 0=none, 1=left-to-right, gint32 unk044;
2=right-to-left, 3=top-to-bottom, gint32 unk048;
4=bottom-to-top (from iPhoto setting) */
gint32 slide_duration; /* in seconds (from iPhoto setting) *
/
gint32 transition_duration; /* in milliseconds (from iPhoto setting) *
/
gint64 song_id; /* dbid2 of track in iTunesDB to play
during slideshow (from iPhoto setting)*/
gint32 unk024; /* unknown, seems to be always 0 *
/
gint16 unk028; /* unknown, seems to be always 0 *
/
gint32 unk044; /* unknown, seems to always be 0 *
/
gint32 unk048; /* unknown, seems to always be 0 *
/
/* set automatically at time of writing the PhotoDB */ /* set automatically at time of writing the PhotoDB */
gint32 album_id; gint32 album_id;
gint32 prev_album_id; gint32 prev_album_id;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
/* below is for use by application */ /* below is for use by application */
guint64 usertype; guint64 usertype;
gpointer userdata; gpointer userdata;
/* functions called to duplicate/free userdata */ /* functions called to duplicate/free userdata */
ItdbUserDataDuplicateFunc userdata_duplicate; ItdbUserDataDuplicateFunc userdata_duplicate;
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/**
* Itdb_Playlist:
* @itdb: A pointer to the #Itdb_iTunesDB (for convenience)
* @name: The name of the playlist in UTF8
* @type: The playlist type (normal or master)
* @flag1: Unknown, usually set to 0
* @flag2: Unknown, always set to 0
* @flag3: Unknown, always set to 0
* @num: The number of tracks in the playlist
* @members: A list of tracks in the playlist (#Itdb_Track)
* @is_spl: True if the playlist is a smart playlist, otherwise
* false
* @timestamp: When the playlist was created
* @id: The playlist ID
* @sortorder: The playlist sort order (#ItdbPlaylistSortOrder)
* @podcastflag: This is set to 0 on normal playlists and to 1 for t
he
* Podcast playlist. If set to 1, the playlist will no
t be
* shown under 'Playlists' on the iPod, but as 'Podcas
ts'
* under the Music menu. The actual title of the Playl
ist
* does not matter. If more than one playlist is set t
o 1,
* they don't show up at all.
* @splpref: Smart playlist preferences (#Itdb_SPLPref)
* @splrules: Smart playlist rules (#Itdb_SPLRules)
* @reserved100: Reserved for MHOD100 implementation
* @reserved101: Reserved for MHOD100 implementation
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing an iTunes Playlist
*/
struct _Itdb_Playlist struct _Itdb_Playlist
{ {
Itdb_iTunesDB *itdb; /* pointer to iTunesDB (for convenience) */ Itdb_iTunesDB *itdb;
gchar *name; /* name of playlist in UTF8 */ gchar *name;
guint8 type; /* ITDB_PL_TYPE_NORM/_MPL */ guint8 type;
guint8 flag1; /* unknown, usually set to 0 */ guint8 flag1;
guint8 flag2; /* unknown, always set to 0 */ guint8 flag2;
guint8 flag3; /* unknown, always set to 0 */ guint8 flag3;
gint num; /* number of tracks in playlist */ gint num;
GList *members; /* tracks in playlist (Track *) */ GList *members;
gboolean is_spl; /* smart playlist? */ gboolean is_spl;
time_t timestamp; /* timestamp of playlist creation */ time_t timestamp;
guint64 id; /* playlist ID */ guint64 id;
guint32 sortorder; /* How to sort playlist -- see below */ guint32 sortorder;
guint32 podcastflag; /* ITDB_PL_FLAG_NORM/_PODCAST */ guint32 podcastflag;
Itdb_SPLPref splpref; /* smart playlist prefs */ Itdb_SPLPref splpref;
Itdb_SPLRules splrules; /* rules for smart playlists */ Itdb_SPLRules splrules;
gpointer reserved100; /* reserved for MHOD100 implementation */ gpointer reserved100;
gpointer reserved101; /* reserved for MHOD100 implementation */ gpointer reserved101;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
/* below is for use by application */ /* below is for use by application */
guint64 usertype; guint64 usertype;
gpointer userdata; gpointer userdata;
/* functions called to duplicate/free userdata */ /* functions called to duplicate/free userdata */
ItdbUserDataDuplicateFunc userdata_duplicate; ItdbUserDataDuplicateFunc userdata_duplicate;
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/* /**
Playlist Sort Order * ItdbPlaylistSortOrder:
* @ITDB_PSO_MANUAL: Sort by playlist order (manual sort)
1 - playlist order (manual sort order) * @ITDB_PSO_TITLE: Sort by track title
2 - ??? * @ITDB_PSO_ALBUM: Sort by album
3 - songtitle * @ITDB_PSO_ARTIST: Sort by artist
4 - album * @ITDB_PSO_BIRATE: Sort by bitrate
5 - artist * @ITDB_PSO_GENRE: Sort by genre
6 - bitrate * @ITDB_PSO_FILETYPE: Sort by filetype
7 - genre * @ITDB_PSO_TIME_MODIFIED: Sort by date modified
8 - kind * @ITDB_PSO_TRACK_NR: Sort by track number
9 - date modified * @ITDB_PSO_SIZE: Sort by track size
10 - track nr * @ITDB_PSO_TIME: Sort by track time
11 - size * @ITDB_PSO_YEAR: Sort by year
12 - time * @ITDB_PSO_SAMPLERATE: Sort by samplerate
13 - year * @ITDB_PSO_COMMENT: Sort by comments
14 - sample rate * @ITDB_PSO_TIME_ADDED: Sort by date added
15 - comment * @ITDB_PSO_EQUALIZER: Sort by equilizer
16 - date added * @ITDB_PSO_COMPOSER: Sort by composer
17 - equalizer * @ITDB_PSO_PLAYCOUNT: Sort by playcount
18 - composer * @ITDB_PSO_TIME_PLAYED: Sort by date last played
19 - ??? * @ITDB_PSO_CD_NR: Sort by disc number
20 - play count * @ITDB_PSO_RATING: Sort by rating
21 - last played * @ITDB_PSO_RELEASE_DATE: Sort by release date
22 - disc nr * @ITDB_PSO_BPM: Sort by beats per minute
23 - my rating * @ITDB_PSO_GROUPING: Sort by grouping
24 - release date (I guess, it's the value for the "Podcasts" list) * @ITDB_PSO_CATEGORY: Sort by category
25 - BPM * @ITDB_PSO_DESCRIPTION: Sort by description
26 - grouping *
27 - category * Playlist Sort Order
28 - description *
*/ * Since: 0.1.3
*/
typedef enum typedef enum
{ {
ITDB_PSO_MANUAL = 1, ITDB_PSO_MANUAL = 1,
/* ITDB_PSO_UNKNOWN = 2, */ /* ITDB_PSO_UNKNOWN = 2, */
ITDB_PSO_TITLE = 3, ITDB_PSO_TITLE = 3,
ITDB_PSO_ALBUM = 4, ITDB_PSO_ALBUM = 4,
ITDB_PSO_ARTIST = 5, ITDB_PSO_ARTIST = 5,
ITDB_PSO_BIRATE = 6, ITDB_PSO_BIRATE = 6,
ITDB_PSO_GENRE = 7, ITDB_PSO_GENRE = 7,
ITDB_PSO_FILETYPE = 8, ITDB_PSO_FILETYPE = 8,
skipping to change at line 701 skipping to change at line 1158
ITDB_PSO_TIME_PLAYED = 21, ITDB_PSO_TIME_PLAYED = 21,
ITDB_PSO_CD_NR = 22, ITDB_PSO_CD_NR = 22,
ITDB_PSO_RATING = 23, ITDB_PSO_RATING = 23,
ITDB_PSO_RELEASE_DATE = 24, /* used by podcasts */ ITDB_PSO_RELEASE_DATE = 24, /* used by podcasts */
ITDB_PSO_BPM = 25, ITDB_PSO_BPM = 25,
ITDB_PSO_GROUPING = 26, ITDB_PSO_GROUPING = 26,
ITDB_PSO_CATEGORY = 27, ITDB_PSO_CATEGORY = 27,
ITDB_PSO_DESCRIPTION = 28 ITDB_PSO_DESCRIPTION = 28
} ItdbPlaylistSortOrder; } ItdbPlaylistSortOrder;
/* Mediatype definitions */ /**
* Itdb_Mediatype:
* @ITDB_MEDIATYPE_AUDIO: Audio files
* @ITDB_MEDIATYPE_MOVIE: Movies
* @ITDB_MEDIATYPE_PODCAST: Podcasts
* @ITDB_MEDIATYPE_AUDIOBOOK: Audio books
* @ITDB_MEDIATYPE_MUSICVIDEO: Music videos
* @ITDB_MEDIATYPE_TVSHOW: TV Shows
*
* Mediatype definitions
*
* The mediatype is used to determine what menu a track appears under. For
* example, setting the mediatype to #ITDB_MEDIATYPE_PODCAST makes the trac
k
* appear on the Podcast menu.
*
* Since: 0.5.0
*/
typedef enum typedef enum
{ {
ITDB_MEDIATYPE_AUDIO = 0x0001, ITDB_MEDIATYPE_AUDIO = 0x0001,
ITDB_MEDIATYPE_MOVIE = 0x0002, ITDB_MEDIATYPE_MOVIE = 0x0002,
ITDB_MEDIATYPE_PODCAST = 0x0004, ITDB_MEDIATYPE_PODCAST = 0x0004,
ITDB_MEDIATYPE_AUDIOBOOK = 0x0008, ITDB_MEDIATYPE_AUDIOBOOK = 0x0008,
ITDB_MEDIATYPE_MUSICVIDEO = 0x0020, ITDB_MEDIATYPE_MUSICVIDEO = 0x0020,
ITDB_MEDIATYPE_TVSHOW = 0x0040, ITDB_MEDIATYPE_TVSHOW = 0x0040,
} Itdb_Mediatype; } Itdb_Mediatype;
/* some of the descriptive comments below are copied verbatim from /**
http://ipodlinux.org/ITunesDB. * Itdb_Track:
http://ipodlinux.org/ITunesDB is the best source for information * @itdb: A pointer to the #Itdb_iTunesDB (for conven
about the iTunesDB and related files. */ ience)
* @title: The title of the track in UTF8
* @ipod_path: The file path on the iPod. Directories are
* separated with ":" instead of "/". The pat
h is
* relative to the iPod mountpoint.
* @album: The album name in UTF8
* @artist: The artist name in UTF8
* @genre: The genre in UTF8
* @filetype: A UTF8 string describing the file type. E.
g.
* "MP3-File".
* @comment: A comment in UTF8
* @category: The category ("Technology", "Music", etc.)
* where the podcast was located. (Added in
* dbversion 0x0d)
* @composer: The composer name in UTF8
* @grouping: ??? (UTF8)
* @description: Description text (such as podcast show note
s).
* (Added in dbversion 0x0d)
* @podcasturl: Podcast Enclosure URL in UTF-8 or ASCII.
* (Added in dbversion 0x0d)
* @podcastrss: Podcast RSS URL in UTF-8 or ASCII.
* (Added in dbversion 0x0d)
* @chapterdata: This is an m4a-style entry that is used to
* display subsongs within a mhit. (Added in
* dbversion 0x0d)
* @subtitle: Subtitle (usually the same as Description).
* (Added in dbversion 0x0d)
* @tvshow: Name of the TV show (only used for TV Shows
).
* (Added in dbversion 0x0d?) (Since libgpod-0
.4.2)
* @tvepisode: The episode number (only used for TV Shows)
.
* (Added in dbversion 0x0d?) (Since libgpod-0
.4.2)
* @tvnetwork: The TV network (only used for TV Shows).
* (Added in dbversion 0x0d?) (Since libgpod-0
.4.2)
* @albumartist: The album artist (Added in dbversion 0x13?)
* (Since libgpod-0.4.2)
* @keywords: List of keywords pertaining to the track.
* (Added in dbversion 0x13?) (Since libgpod-0
.4.2)
* @sort_artist: The artist name used for sorting. Artists
with
* names like "The Artist" would have "Artist,
* The" here. If you do not set this field,
* libgpod will pre-sort the lists displayed b
y
* the iPod according to "Artist, The", withou
t
* setting this field.
* (Added in dbversion 0x13?) (Since libgpod-0
.5.0)
* @sort_title: The track title used for sorting. See
* @sort_artist. (Since libgpod-0.5.0)
* @sort_album: The album name used for sorting. See
* @sort_artist. (Since libgpod-0.5.0)
* @sort_albumartist: The album artist used for sorting. See
* @sort_artist. (Since libgpod-0.5.0)
* @sort_composer: The composer used for sorting. See
* @sort_artist. (Since libgpod-0.5.0)
* @sort_tvshow: The name of the TV show used for sorting.
See
* @sort_artist. (Since libgpod-0.5.0)
* @id: Unique ID of track
* @size: The size of the file in bytes
* @tracklen: The length of the track in ms
* @cd_nr: The CD number the track comes from.
* @cds: The total number of CDs.
* @track_nr: The track number.
* @tracks: The total number of tracks.
* @bitrate: The bitrate at which the file is encoded.
* @samplerate: The samplerate of the track (e.g. CD = 4410
0)
* @samplerate_low: In the iTunesDB the samplerate is
* multiplied by 0x10000 -- these are the
* lower 16 bit, which are usually 0
* @year: The year the track was released
* @volume: Volume adjustment field. This is a value f
rom
* -255 to 255 that will be applied to the tra
ck
* on playback.
* @soundcheck: The SoundCheck value to apply to the song,
when
* SoundCheck is switched on in the iPod setti
ngs.
* The value for this field can be determined
by
* the equation: X = 1000 * 10 ^ (-.1 * Y) whe
re Y
* is the adjustment value in dB and X is the
* value that goes into the SoundCheck field.
The
* value 0 is special, the equation is not use
d
* and it is treated as "no Soundcheck" (basic
ally
* the same as the value 1000). This equation
* works perfectly well with ReplayGain derive
d
* data instead of the iTunes SoundCheck deriv
ed
* information.
* @time_added: The time the track was added.
* @time_modified: The time the track was last modified
* @time_played: The time the track was last played
* @bookmark_time: The time, in milliseconds, that the track w
ill
* start playing at. This is used for AudioBoo
k
* filetypes (.aa and .m4b). Note that there
is
* also a bookmark value in the play counts fi
le
* that will be set by the iPod and can be use
d
* instead of this value.
* @rating: The track rating (stars * #ITDB_RATING_STEP
)
* @playcount: The number of times the track has been play
ed
* @playcount2: This also stores the play count of the
* track. It is unclear if this ever differs
* from the above value. During sync, this is
set
* to the same value as @playcount.
* @recent_playcount: The number of times the track was played si
nce
* the last sync.
* @transferred: Whether the file been transferred to iPod.
* @BPM: BPM (beats per minute) of the track
* @app_rating: The last rating set by an application (e.g.
* iTunes). If the rating on the iPod and the
* @rating field above differ, the original
* rating is copied here and the new rating is
* stored in @rating.
* @type1: CBR MP3s and AAC are 0x00, VBR MP3s are 0x0
1
* @type2: MP3s are 0x01, AAC are 0x00
* @compilation: Flag to mark the track as a compilation. T
rue
* if set to 0x1, false if set to 0x0.
* @starttime: The time, in milliseconds, at which the son
g
* will start playing.
* @stoptime: The time, in milliseconds, at which the son
g
* will stop playing.
* @checked: Flag for whether the track is checked. Tru
e if
* set to 0x0, false if set to 0x1
* @dbid: Unique database ID that identifies this son
g
* across the databases on the iPod. For examp
le,
* this id joins an iTunesDB mhit with an
* ArtworkDB mhii.
* @drm_userid: Apple Store/Audible User ID (for DRM'ed fil
es
* only, set to 0 otherwise).
* @visible: If this value is 1, the song is visible on
the
* iPod. All other values cause the file to be
* hidden.
* @filetype_marker: This appears to always be 0 on hard drive b
ased
* iPods, but for the iTunesDB that is written
to
* an iPod Shuffle, iTunes 4.7.1 writes out th
e
* file's type as an ANSI string(!). For examp
le,
* a MP3 file has a filetype of 0x4d503320 ->
* 0x4d = 'M', 0x50 = 'P', 0x33 = '3', 0x20 =
* &lt;space&gt;. This is set to the filename
* extension by libgpod when copying the track
to
* the iPod.
* @artwork_count: The number of album artwork items associate
d
* with this song. libgpod updates this value
* when syncing.
* @artwork_size: The total size of artwork (in bytes) attach
ed
* to this song, when it is converted to JPEG
* format. Observed in dbversion 0x0b and with
* an iPod Photo. libgpod updates this value w
hen
* syncing.
* @samplerate2: The sample rate of the song expressed as an
* IEEE 32 bit floating point number. It is
* uncertain why this is here. libgpod will s
et
* this when adding a track.
* @unk126: Unknown, but always seems to be 0xffff for
* MP3/AAC songs, 0x0 for uncompressed songs
* (like WAVE format), 0x1 for Audible. libgp
od
* will try to set this when adding a new trac
k.
* @unk132: Unknown
* @time_released: The date/time the track was added to the iT
unes
* music store? For podcasts this is the rele
ase
* date that is displayed next to the title in
the
* Podcast playlist.
* @unk144: Unknown, but MP3 songs appear to be always
* 0x000c, AAC songs are always 0x0033, Audibl
e
* files are 0x0029, WAV files are 0x0. libgp
od
* will attempt to set this value when adding
a
* track.
* @explicit_flag: Flag to mark a track as "explicit" in iTune
s.
* True if to 0x1, false if set to 0x0.
* @unk148: Unknown - used for Apple Store DRM songs
* (always 0x01010100?), zero otherwise
* @unk152: Unknown
* @skipcount: The number of times the track has been skip
ped.
* (Added in dbversion 0x0c)
* @recent_skipcount: The number of times the track was skipped s
ince
* the last sync.
* @last_skipped: The time the track was last skipped. (Adde
d in
* dbversion 0x0c)
* @has_artwork: Whether the track has artwork.
* True if set to 0x01, false if set to 0x02.
* @skip_when_shuffling: Flag to skip the track when shuffling. Tru
e if
* set to 0x01, false if set to 0x00. Audioboo
ks
* (.aa and .m4b) always seem to be skipped wh
en
* shuffling, regardless of this flag.
* @remember_playback_position: Flag to remember playback position.
* True when set to 0x01, false when set to 0x
00.
* Audiobooks (.aa and .m4b) always seem to
* remember the playback position, regardless
of
* this flag.
* @flag4: Used for podcasts, 0x00 otherwise. If set
to
* 0x01 the "Now Playing" page will show
* Title/Album, when set to 0x00 it will also
show
* the Artist. When set to 0x02 a sub-page
* (middle button) with further information ab
out
* the track will be shown.
* @dbid2: The purpose of the field is unclear. If no
t
* set, libgpod will set this to the same valu
e as
* @dbid when adding a track. (With iTunes, s
ince
* dbversion 0x12, this field value differs fr
om
* @dbid.)
* @lyrics_flag: Whether the track has lyrics (e.g. it has a
* USLT ID3 tag in an MP3 or a @lyr atom in an
* MP4). True if set to 0x01, false if set to
* 0x00.
* @movie_flag: Whether the track is a movie. True if set
to
* 0x01, false if set to 0x00.
* @mark_unplayed: A value of 0x02 marks a podcast as unplayed
on
* the iPod, with a bullet. Once played it is
set
* to 0x01. Non-podcasts have this set to 0x01
.
* (Added in dbversion 0x0c)
* @unk179: Unknown, always 0x00 so far. (Added in
* dbversion 0x0c)
* @unk180: Unknown. (Added in dbversion 0x0c)
* @pregap: The number of samples of silence before the
* track starts (for gapless playback).
* @samplecount: The number of samples in the track (for gap
less
* playback).
* @unk196: Unknown. (Added in dbversion 0x0c)
* @postgap: The number of samples of silence at the end
of
* the track (for gapless playback).
* @unk204: Unknown. Appears to be 0x1 for files encod
ed
* using the MP3 encoder, 0x0 otherwise. (Add
ed
* in dbversion 0x0c, first values observed in
* 0x0d.)
* @mediatype: The type of file. It must be set to 0x0000
0001
* for audio files, and set to 0x00000002 for
* video files. If set to 0x00, the files sho
w up
* in both, the audio menus ("Songs", "Artists
",
* etc.) and the video menus ("Movies", "Music
* Videos", etc.). It appears to be set to 0x
20
* for music videos, and if set to 0x60 the fi
le
* shows up in "TV Shows" rather than "Movies"
.
* <para>
* The following list summarizes all observed
types:
* </para>
* <itemizedlist>
* <listitem>0x00 00 00 00 - Audio/Video</list
item>
* <listitem>0x00 00 00 01 - Audio</listitem>
* <listitem>0x00 00 00 02 - Video</listitem>
* <listitem>0x00 00 00 04 - Podcast</listitem
>
* <listitem>0x00 00 00 06 - Video Podcast</li
stitem>
* <listitem>0x00 00 00 08 - Audiobook</listit
em>
* <listitem>0x00 00 00 20 - Music Video</list
item>
* <listitem>0x00 00 00 40 - TV Show (shows up
ONLY
* in TV Shows)</listitem>
* <listitem>0x00 00 00 60 - TV Show (shows up
in
* the Music lists as well)</listitem>
* </itemizedlist>
* @season_nr: The season number of the track (only used f
or
* TV Shows).
* @episode_nr: The episode number of the track (only used
for
* TV Shows). Although this is not displayed
on
* the iPod, the episodes are sorted by episod
e
* number.
* @unk220: Unknown. This has something to do with
* protected files. It is set to 0x0 for
* non-protected files.
* @unk224: Unknown. (Added in dbversion 0x0c)
* @unk228: Unknown. (Added in dbversion 0x0c)
* @unk232: Unknown. (Added in dbversion 0x0c)
* @unk236: Unknown. (Added in dbversion 0x0c)
* @unk240: Unknown. (Added in dbversion 0x0c)
* @unk244: Unknown. (Added in dbversion 0x13)
* @gapless_data: The size in bytes from first Synch Frame
* (which is usually the XING frame that
* includes the LAME tag) until the 8th before
* the last frame. The gapless playback does n
ot
* work for MP3 files if this is set to zero.
For
* AAC tracks, this may be zero. (Added in
* dbversion 0x13)
* @unk252: Unknown. (Added in dbversion 0x0c)
* @gapless_track_flag: If set to 1, this track has gapless playbac
k
* data. (Added in dbversion 0x13)
* @gapless_album_flag: If set to 1, this track does not use
* crossfading in iTunes. (Added in dbversion
* 0x13)
* @album_id: The Album ID from the album list (currently
* unused by libgpod)
* @artwork: An #Itdb_Artwork for cover art
* @mhii_link: This is set to the id of the corresponding
* ArtworkDB mhii, used for sparse artwork
* support. (Since libgpod-0.7.0)
* @reserved_int1: Reserved for future use
* @reserved_int2: Reserved for future use
* @reserved_int3: Reserved for future use
* @reserved_int4: Reserved for future use
* @reserved_int5: Reserved for future use
* @reserved_int6: Reserved for future use
* @reserved1: Reserved for future use
* @reserved2: Reserved for future use
* @reserved3: Reserved for future use
* @reserved4: Reserved for future use
* @reserved5: Reserved for future use
* @reserved6: Reserved for future use
* @usertype: For use by application
* @userdata: For use by application
* @userdata_duplicate: A function to duplicate #userdata
* @userdata_destroy: A function to free #userdata
*
* Structure representing a track in an iTunesDB
*
* <note><para>When adding string fields don't forget to add them in
* itdb_track_duplicate() as well.</para></note>
*
* Many of the parameter descriptions are copied verbatim from
* http://ipodlinux.org/ITunesDB, which is the best source for information
about
* the iTunesDB and related files.
*/
struct _Itdb_Track struct _Itdb_Track
{ {
Itdb_iTunesDB *itdb; /* pointer to iTunesDB (for convenience) */ Itdb_iTunesDB *itdb;
gchar *title; /* title (utf8) */ gchar *title;
gchar *ipod_path; /* name of file on iPod: uses ":" instead gchar *ipod_path;
of "/" and is relative to mountpoint */ gchar *album;
gchar *album; /* album (utf8) */ gchar *artist;
gchar *artist; /* artist (utf8) */ gchar *genre;
gchar *genre; /* genre (utf8) */ gchar *filetype;
gchar *filetype; /* eg. "MP3-File"...(utf8) */ gchar *comment;
gchar *comment; /* comment (utf8) */ gchar *category;
gchar *category; /* Category for podcast */ gchar *composer;
gchar *composer; /* Composer (utf8) */ gchar *grouping;
gchar *grouping; /* ? (utf8) */ gchar *description;
gchar *description; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *podcasturl;
gchar *podcasturl; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *podcastrss;
gchar *podcastrss; /* see note for MHOD_ID in itdb_itunesdb.c */ Itdb_Chapterdata *chapterdata;
gpointer chapterdata; /* not yet supported. Help welcome. */ gchar *subtitle;
gchar *subtitle; /* see note for MHOD_ID in itdb_itunesdb.c */ /* the following 5 are new in libgpod 0.4.2... */
/* the following 6 are new in libgpod 0.4.2... */ gchar *tvshow;
gchar *tvshow; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *tvepisode;
gchar *tvepisode; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *tvnetwork;
gchar *tvnetwork; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *albumartist;
gchar *albumartist; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *keywords;
gchar *keywords; /* see note for MHOD_ID in itdb_itunesdb.c */
/* the following 6 are new in libgpod 0.5.0... */ /* the following 6 are new in libgpod 0.5.0... */
/* You can set these strings to override the standard /* You can set these strings to override the standard
sortorder. When set they take precedence over the default sortorder. When set they take precedence over the default
'artist', 'album'... fields. 'artist', 'album'... fields.
For example, in the case of an artist name like "The Artist", For example, in the case of an artist name like "The Artist",
iTunes will set sort_artist to "Artist, The" followed by five iTunes will set sort_artist to "Artist, The" followed by five
0x01 characters. Why five 0x01 characters are added is not 0x01 characters. Why five 0x01 characters are added is not
completely understood. completely understood.
If you do not set the sort_artist field, libgpod will pre-sort If you do not set the sort_artist field, libgpod will pre-sort
the lists displayed by the iPod according to "Artist, The", the lists displayed by the iPod according to "Artist, The",
without setting the field. without setting the field.
*/ */
gchar *sort_artist; /* artist (for sorting) */ gchar *sort_artist;
gchar *sort_title; /* title (for sorting) */ gchar *sort_title;
gchar *sort_album; /* album (for sorting) */ gchar *sort_album;
gchar *sort_albumartist; /* album artist (for sorting) */ gchar *sort_albumartist;
gchar *sort_composer; /* composer (for sorting) */ gchar *sort_composer;
gchar *sort_tvshow; /* tv show (for sorting) */ gchar *sort_tvshow;
/* new fields in libgpod 0.5.0 up to here */ /* end of new fields in libgpod 0.5.0 */
guint32 id; /* unique ID of track */ guint32 id;
gint32 size; /* size of file in bytes */ gint32 size;
gint32 tracklen; /* Length of track in ms */ gint32 tracklen;
gint32 cd_nr; /* CD number */ gint32 cd_nr;
gint32 cds; /* number of CDs */ gint32 cds;
gint32 track_nr; /* track number */ gint32 track_nr;
gint32 tracks; /* number of tracks */ gint32 tracks;
gint32 bitrate; /* bitrate */ gint32 bitrate;
guint16 samplerate; /* samplerate (CD: 44100) */ guint16 samplerate;
guint16 samplerate_low; /* in the iTunesDB the samplerate is guint16 samplerate_low;
multiplied by 0x10000 -- these are the gint32 year;
lower 16 bit, which are usually 0 */ gint32 volume;
gint32 year; /* year */ guint32 soundcheck;
gint32 volume; /* volume adjustment */ time_t time_added;
guint32 soundcheck; /* volume adjustment "soundcheck" */ time_t time_modified;
time_t time_added; /* time when added */ time_t time_played;
time_t time_modified; /* time of last modification */ guint32 bookmark_time;
time_t time_played; /* time of last play */ guint32 rating;
guint32 bookmark_time; /* bookmark set for (AudioBook) in ms */ guint32 playcount;
guint32 rating; /* star rating (stars * RATING_STEP (20)) */ guint32 playcount2;
guint32 playcount; /* number of times track was played */ guint32 recent_playcount;
guint32 playcount2; /* Also stores the play count of the gboolean transferred;
song. Don't know if it ever differs gint16 BPM;
from the above value. During sync itdb guint8 app_rating;
sets playcount2 to the same value as guint8 type1;
playcount. */ guint8 type2;
guint32 recent_playcount; /* times track was played since last sync */
gboolean transferred; /* has file been transferred to iPod? */
gint16 BPM; /* BPM (beats per minute) of this track */
guint8 app_rating; /* star rating set by appl. (not
* iPod). If the rating set on the iPod
and the rating field above differ, the
original rating is copied here and the
new rating is stored above. */
guint8 type1; /* CBR MP3s and AAC are 0x00, VBR MP3s are
0x01 */
guint8 type2; /* MP3s are 0x01, AAC are 0x00 */
guint8 compilation; guint8 compilation;
guint32 starttime; guint32 starttime;
guint32 stoptime; guint32 stoptime;
guint8 checked; /* 0x0: checkmark on track is set 0x1: not set guint8 checked;
*/ guint64 dbid;
guint64 dbid; /* unique database ID */ guint32 drm_userid;
guint32 drm_userid; /* Apple Store/Audible User ID (for DRM'ed guint32 visible;
files only, set to 0 otherwise). */ guint32 filetype_marker;
guint32 visible; /* If this value is 1, the song is visible guint16 artwork_count;
on the iPod. All other values cause guint32 artwork_size;
the file to be hidden. */ float samplerate2;
guint32 filetype_marker; /* This appears to always be 0 on hard guint16 unk126;
drive based iPods, but for the guint32 unk132;
iTunesDB that is written to an iPod time_t time_released;
Shuffle, iTunes 4.7.1 writes out the guint16 unk144;
file's type as an ANSI string(!). For guint16 explicit_flag;
example, a MP3 file has a filetype of guint32 unk148;
0x4d503320 -> 0x4d = 'M', 0x50 = 'P', guint32 unk152;
0x33 = '3', 0x20 = <space>. (set to guint32 skipcount;
the filename extension by itdb when guint32 recent_skipcount;
copying track to iPod) */ guint32 last_skipped;
guint16 artwork_count; /* The number of album artwork items guint8 has_artwork;
associated with this song. libgpod guint8 skip_when_shuffling;
updates this value when syncing */ guint8 remember_playback_position;
guint32 artwork_size; /* The total size of artwork (in bytes) guint8 flag4;
attached to this song, when it is guint64 dbid2;
converted to JPEG format. Observed in guint8 lyrics_flag;
iPodDB version 0x0b and with an iPod guint8 movie_flag;
Photo. libgpod updates this value when guint8 mark_unplayed;
syncing */ guint8 unk179;
float samplerate2; /* The sample rate of the song expressed
as an IEEE 32 bit floating point
number. It's uncertain why this is
here. itdb will set this when adding
a track */
guint16 unk126; /* unknown, but always seems to be 0xffff for
MP3/AAC songs, 0x0 for uncompressed songs
(like WAVE format), 0x1 for Audible. itdb
will try to set this when adding a new track */
guint32 unk132; /* unknown */
time_t time_released;/* date/time added to music store?
For podcasts: release date as displayed next to t
he
title in the Podcast playlist */
guint16 unk144; /* unknown, but MP3 songs appear to be always
0x000c, AAC songs are always 0x0033, Audible
files are 0x0029, WAV files are 0x0. itdb
will attempt to set this value when adding a
track. */
guint16 unk146; /* unknown, but appears to be 1 if played at
least once in iTunes and 0 otherwise. */
guint32 unk148; /* unknown - used for Apple Store DRM songs
(always 0x01010100?), zero otherwise */
guint32 unk152; /* unknown */
guint32 skipcount; /* Number of times the track has been skipped.
Formerly unk156 (added in dbversion 0x0c) */
guint32 recent_skipcount; /* number of times track was skipped since
last sync */
guint32 last_skipped;/* Date/time last skipped. Formerly unk160
(added in dbversion 0x0c) */
guint8 has_artwork; /* 0x01: artwork is present. 0x02: no artwork is
present for this track (used by the iPod to
decide whether to display Artwork or not) */
guint8 skip_when_shuffling;/* "Skip when shuffling" when set to
0x01, set to 0x00 otherwise. .m4b and .aa
files always seem to be skipped when
shuffling, however */
guint8 remember_playback_position;/* "Remember playback position"
when set to 0x01, set to 0x00 otherwise. .m4b
and .aa files always seem to remember the
playback position, however. */
guint8 flag4; /* Used for podcasts, 0x00 otherwise. If set to
0x01 the "Now Playing" page will show
Title/Album, when set to 0x00 it will also
show the Artist. When set to 0x02 a sub-page
(middle button) with further information
about the track will be shown. */
guint64 dbid2; /* not clear. if not set, itdb will set this to
the same value as dbid when adding a
track. (With iTunes, since V0x12, this field
value differs from the dbid one.) */
guint8 lyrics_flag; /* set to 0x01 if lyrics are present in MP3 tag
("ULST"), 0x00 otherwise */
guint8 movie_flag; /* set to 0x01 if it's a movie file, 0x00
otherwise */
guint8 mark_unplayed; /* A value of 0x02 marks a podcast as unplayed
on the iPod (bullet) once played it is set to
0x01. Non-podcasts have this set to 0x01. */
guint8 unk179; /* unknown (always 0x00 so far) */
guint32 unk180; guint32 unk180;
guint32 pregap; /* Number of samples of silence before the songs guint32 pregap;
starts (for gapless playback). */ guint64 samplecount;
guint64 samplecount;/* Number of samples in the song. First observed
in dbversion 0x0d, and only for AAC and WAV
files (for gapless playback). */
guint32 unk196; guint32 unk196;
guint32 postgap; /* Number of samples of silence at the end of guint32 postgap;
the song (for gapless playback). */ guint32 unk204;
guint32 unk204; /* unknown - added in dbversion 0x0c, first guint32 mediatype;
values observed in 0x0d. Observed to be 0x0 guint32 season_nr;
or 0x1. */ guint32 episode_nr;
guint32 mediatype; /* It seems that this field denotes the type of guint32 unk220;
the file on (e.g.) the 5g video iPod. It must
be set to 0x00000001 for audio files, and set
to 0x00000002 for video files. If set to
0x00, the files show up in both, the audio
menus ("Songs", "Artists", etc.) and the
video menus ("Movies", "Music Videos",
etc.). It appears to be set to 0x20 for music
videos, and if set to 0x60 the file shows up
in "TV Shows" rather than "Movies".
The following list summarizes all observed types:
* 0x00 00 00 00 - Audio/Video
* 0x00 00 00 01 - Audio
* 0x00 00 00 02 - Video
* 0x00 00 00 04 - Podcast
* 0x00 00 00 06 - Video Podcast
* 0x00 00 00 08 - Audiobook
* 0x00 00 00 20 - Music Video
* 0x00 00 00 40 - TV Show (shows up ONLY in TV Show
s
* 0x00 00 00 60 - TV Show (shows up in the
Music lists as well) */
guint32 season_nr; /* the season number of the track, for TV shows only.
*/
guint32 episode_nr; /* the episode number of the track, for TV shows
only - although not displayed on the iPod,
the episodes are sorted by episode number. */
guint32 unk220; /* Has something to do with protected files -
set to 0x0 for non-protected files. */
guint32 unk224; guint32 unk224;
guint32 unk228, unk232, unk236, unk240, unk244; guint32 unk228, unk232, unk236, unk240, unk244;
guint32 gapless_data;/* some magic number needed for gapless playback guint32 gapless_data;
(added in dbversion 0x13) It has been observed
that gapless playback does not work if this is
set to zero. This number is related to the the
filesize in bytes, but it is a couple of bytes
less than the filesize. Maybe ID3 tags
etc... taken off? */
guint32 unk252; guint32 unk252;
guint16 gapless_track_flag; /* if 1, this track has gapless playback data guint16 gapless_track_flag;
(added in dbversion 0x13) */ guint16 gapless_album_flag;
guint16 gapless_album_flag; /* if 1, this track does not use crossfading guint16 album_id;
in iTunes (added in dbversion 0x13) */
/* Chapter data: defines where the chapter stops are in the track,
as well as what info should be displayed for each section of
the track. Until it can be parsed and interpreted, the
chapterdata will just be read as a block and written back on
sync. This will be changed at a later time */
void *chapterdata_raw;
guint32 chapterdata_raw_length;
/* This is for Cover Art support */ /* This is for Cover Art support */
struct _Itdb_Artwork *artwork; struct _Itdb_Artwork *artwork;
/* This is for sparse artwork support, new in libgpod-0.7.0 */
guint32 mhii_link;
/* reserved for future use */ /* reserved for future use */
gint32 reserved_int1; gint32 reserved_int1;
gint32 reserved_int2; gint32 reserved_int2;
gint32 reserved_int3; gint32 reserved_int3;
gint32 reserved_int4; gint32 reserved_int4;
gint32 reserved_int5; gint32 reserved_int5;
gint32 reserved_int6; gint32 reserved_int6;
gpointer reserved1; gpointer reserved1;
gpointer reserved2; gpointer reserved2;
gpointer reserved3; gpointer reserved3;
skipping to change at line 988 skipping to change at line 1647
ItdbUserDataDestroyFunc userdata_destroy; ItdbUserDataDestroyFunc userdata_destroy;
}; };
/* (gtkpod note: don't forget to add fields read from the file to /* (gtkpod note: don't forget to add fields read from the file to
* copy_new_info() in file.c!) */ * copy_new_info() in file.c!) */
/* ------------------------------------------------------------ *\ /* ------------------------------------------------------------ *\
* *
* Error codes * Error codes
* *
\* ------------------------------------------------------------ */ \* ------------------------------------------------------------ */
/**
* ItdbFileError:
* @ITDB_FILE_ERROR_SEEK: file corrupt: illegal seek occured
* @ITDB_FILE_ERROR_CORRUPT: file corrupt
* @ITDB_FILE_ERROR_NOTFOUND: file not found
* @ITDB_FILE_ERROR_RENAME: file could not be renamed
* @ITDB_FILE_ERROR_ITDB_CORRUPT: iTunesDB in memory corrupt
*
* Error codes for iTunesDB file
*/
typedef enum typedef enum
{ {
ITDB_FILE_ERROR_SEEK, /* file corrupt: illegal seek occured */ ITDB_FILE_ERROR_SEEK,
ITDB_FILE_ERROR_CORRUPT, /* file corrupt */ ITDB_FILE_ERROR_CORRUPT,
ITDB_FILE_ERROR_NOTFOUND, /* file not found */ ITDB_FILE_ERROR_NOTFOUND,
ITDB_FILE_ERROR_RENAME, /* file could not be renamed */ ITDB_FILE_ERROR_RENAME,
ITDB_FILE_ERROR_ITDB_CORRUPT /* iTunesDB in memory corrupt */ ITDB_FILE_ERROR_ITDB_CORRUPT
} ItdbFileError; } ItdbFileError;
/* Error domain */ /* Error domain */
#define ITDB_FILE_ERROR itdb_file_error_quark () #define ITDB_FILE_ERROR itdb_file_error_quark ()
GQuark itdb_file_error_quark (void); GQuark itdb_file_error_quark (void);
/* ------------------------------------------------------------ *\ /* ------------------------------------------------------------ *\
* *
* Public functions * Public functions
* *
skipping to change at line 1064 skipping to change at line 1734
gchar *itdb_get_artworkdb_path (const gchar *mountpoint); gchar *itdb_get_artworkdb_path (const gchar *mountpoint);
gchar *itdb_get_photodb_path (const gchar *mountpoint); gchar *itdb_get_photodb_path (const gchar *mountpoint);
gchar *itdb_get_path (const gchar *dir, const gchar *file); gchar *itdb_get_path (const gchar *dir, const gchar *file);
/* itdb_device functions */ /* itdb_device functions */
Itdb_Device *itdb_device_new (void); Itdb_Device *itdb_device_new (void);
void itdb_device_free (Itdb_Device *device); void itdb_device_free (Itdb_Device *device);
void itdb_device_set_mountpoint (Itdb_Device *device, const gchar *mp); void itdb_device_set_mountpoint (Itdb_Device *device, const gchar *mp);
gboolean itdb_device_read_sysinfo (Itdb_Device *device); gboolean itdb_device_read_sysinfo (Itdb_Device *device);
gboolean itdb_device_write_sysinfo (Itdb_Device *device, GError **error); gboolean itdb_device_write_sysinfo (Itdb_Device *device, GError **error);
gchar *itdb_device_get_sysinfo (Itdb_Device *device, const gchar *field); gchar *itdb_device_get_sysinfo (const Itdb_Device *device, const gchar *fie ld);
void itdb_device_set_sysinfo (Itdb_Device *device, void itdb_device_set_sysinfo (Itdb_Device *device,
const gchar *field, const gchar *value); const gchar *field, const gchar *value);
const Itdb_IpodInfo *itdb_device_get_ipod_info (Itdb_Device *device); const Itdb_IpodInfo *itdb_device_get_ipod_info (const Itdb_Device *device);
const Itdb_IpodInfo *itdb_info_get_ipod_info_table (void); const Itdb_IpodInfo *itdb_info_get_ipod_info_table (void);
gboolean itdb_device_supports_artwork (Itdb_Device *device); gboolean itdb_device_supports_artwork (const Itdb_Device *device);
gboolean itdb_device_supports_photo (Itdb_Device *device); gboolean itdb_device_supports_video (const Itdb_Device *device);
gboolean itdb_device_supports_photo (const Itdb_Device *device);
const gchar *itdb_info_get_ipod_model_name_string (Itdb_IpodModel model); const gchar *itdb_info_get_ipod_model_name_string (Itdb_IpodModel model);
const gchar *itdb_info_get_ipod_generation_string (Itdb_IpodGeneration gene ration); const gchar *itdb_info_get_ipod_generation_string (Itdb_IpodGeneration gene ration);
/* track functions */ /* track functions */
Itdb_Track *itdb_track_new (void); Itdb_Track *itdb_track_new (void);
void itdb_track_free (Itdb_Track *track); void itdb_track_free (Itdb_Track *track);
void itdb_track_add (Itdb_iTunesDB *itdb, Itdb_Track *track, gint32 pos); void itdb_track_add (Itdb_iTunesDB *itdb, Itdb_Track *track, gint32 pos);
void itdb_track_remove (Itdb_Track *track); void itdb_track_remove (Itdb_Track *track);
void itdb_track_unlink (Itdb_Track *track); void itdb_track_unlink (Itdb_Track *track);
Itdb_Track *itdb_track_duplicate (Itdb_Track *tr); Itdb_Track *itdb_track_duplicate (Itdb_Track *tr);
skipping to change at line 1139 skipping to change at line 1810
/* thumbnails functions for coverart */ /* thumbnails functions for coverart */
/* itdb_track_... */ /* itdb_track_... */
gboolean itdb_track_set_thumbnails (Itdb_Track *track, gboolean itdb_track_set_thumbnails (Itdb_Track *track,
const gchar *filename); const gchar *filename);
gboolean itdb_track_set_thumbnails_from_data (Itdb_Track *track, gboolean itdb_track_set_thumbnails_from_data (Itdb_Track *track,
const guchar *image_data, const guchar *image_data,
gsize image_data_len); gsize image_data_len);
gboolean itdb_track_set_thumbnails_from_pixbuf (Itdb_Track *track, gboolean itdb_track_set_thumbnails_from_pixbuf (Itdb_Track *track,
gpointer pixbuf); gpointer pixbuf);
gboolean itdb_track_has_thumbnails (Itdb_Track *track);
void itdb_track_remove_thumbnails (Itdb_Track *track); void itdb_track_remove_thumbnails (Itdb_Track *track);
gpointer itdb_track_get_thumbnail (Itdb_Track *track, gint width, gint heig ht);
/* photoalbum functions -- see itdb_photoalbum.c for instructions on /* photoalbum functions -- see itdb_photoalbum.c for instructions on
* how to use. */ * how to use. */
Itdb_PhotoDB *itdb_photodb_parse (const gchar *mp, GError **error); Itdb_PhotoDB *itdb_photodb_parse (const gchar *mp, GError **error);
Itdb_Artwork *itdb_photodb_add_photo (Itdb_PhotoDB *db, const gchar *filena me, Itdb_Artwork *itdb_photodb_add_photo (Itdb_PhotoDB *db, const gchar *filena me,
gint position, gint rotation, gint position, gint rotation,
GError **error); GError **error);
Itdb_Artwork *itdb_photodb_add_photo_from_data (Itdb_PhotoDB *db, Itdb_Artwork *itdb_photodb_add_photo_from_data (Itdb_PhotoDB *db,
const guchar *image_data, const guchar *image_data,
gsize image_data_len, gsize image_data_len,
skipping to change at line 1178 skipping to change at line 1850
gboolean itdb_photodb_write (Itdb_PhotoDB *photodb, GError **error); gboolean itdb_photodb_write (Itdb_PhotoDB *photodb, GError **error);
void itdb_photodb_remove_photo (Itdb_PhotoDB *db, void itdb_photodb_remove_photo (Itdb_PhotoDB *db,
Itdb_PhotoAlbum *album, Itdb_PhotoAlbum *album,
Itdb_Artwork *photo); Itdb_Artwork *photo);
void itdb_photodb_photoalbum_remove (Itdb_PhotoDB *db, void itdb_photodb_photoalbum_remove (Itdb_PhotoDB *db,
Itdb_PhotoAlbum *album, Itdb_PhotoAlbum *album,
gboolean remove_pics); gboolean remove_pics);
Itdb_PhotoAlbum *itdb_photodb_photoalbum_by_name(Itdb_PhotoDB *db, Itdb_PhotoAlbum *itdb_photodb_photoalbum_by_name(Itdb_PhotoDB *db,
const gchar *albumname ); const gchar *albumname );
/* itdb_artwork_... -- you probably won't need many of these (probably /* itdb_artwork_... -- you probably won't need many of these (with
* with the exception of itdb_artwork_get_thumb_by_type() and * the exception of itdb_artwork_get_pixbuf() probably). Use the
* itdb_thumb_get_gdk_pixbuf() probably). Use the itdb_photodb_...() * itdb_photodb_...() functions when adding photos, and the
* functions when adding photos, and the itdb_track_...() functions * itdb_track_...() functions when adding coverart to audio. */
* when adding coverart to audio. */
Itdb_Artwork *itdb_artwork_new (void); Itdb_Artwork *itdb_artwork_new (void);
Itdb_Artwork *itdb_artwork_duplicate (Itdb_Artwork *artwork); Itdb_Artwork *itdb_artwork_duplicate (Itdb_Artwork *artwork);
void itdb_artwork_free (Itdb_Artwork *artwork); void itdb_artwork_free (Itdb_Artwork *artwork);
Itdb_Thumb *itdb_artwork_get_thumb_by_type (Itdb_Artwork *artwork, gboolean itdb_artwork_set_thumbnail (Itdb_Artwork *artwork,
ItdbThumbType type);
gboolean itdb_artwork_add_thumbnail (Itdb_Artwork *artwork,
ItdbThumbType type,
const gchar *filename, const gchar *filename,
gint rotation, GError **error); gint rotation, GError **error);
gboolean itdb_artwork_add_thumbnail_from_data (Itdb_Artwork *artwork, gboolean itdb_artwork_set_thumbnail_from_data (Itdb_Artwork *artwork,
ItdbThumbType type,
const guchar *image_data, const guchar *image_data,
gsize image_data_len, gsize image_data_len,
gint rotation, GError **error ); gint rotation, GError **error );
gboolean itdb_artwork_add_thumbnail_from_pixbuf (Itdb_Artwork *artwork, gboolean itdb_artwork_set_thumbnail_from_pixbuf (Itdb_Artwork *artwork,
ItdbThumbType type,
gpointer pixbuf, gpointer pixbuf,
gint rotation, gint rotation,
GError **error); GError **error);
void itdb_artwork_remove_thumbnail (Itdb_Artwork *artwork,
Itdb_Thumb *thumb);
void itdb_artwork_remove_thumbnails (Itdb_Artwork *artwork); void itdb_artwork_remove_thumbnails (Itdb_Artwork *artwork);
/* itdb_thumb_... */
/* the following function returns a pointer to a GdkPixbuf if /* the following function returns a pointer to a GdkPixbuf if
gdk-pixbuf is installed -- a NULL pointer otherwise. */ gdk-pixbuf is installed -- a NULL pointer otherwise. */
gpointer itdb_thumb_get_gdk_pixbuf (Itdb_Device *device, gpointer itdb_artwork_get_pixbuf (Itdb_Device *device, Itdb_Artwork *artwor
Itdb_Thumb *thumb); k,
gint width, gint height);
/* itdb_thumb_... */
Itdb_Thumb *itdb_thumb_duplicate (Itdb_Thumb *thumb); Itdb_Thumb *itdb_thumb_duplicate (Itdb_Thumb *thumb);
gpointer itdb_thumb_to_pixbuf_at_size (Itdb_Device *device, Itdb_Thumb *thu
mb,
gint width, gint height);
GList *itdb_thumb_to_pixbufs (Itdb_Device *device, Itdb_Thumb *thumb);
void itdb_thumb_free (Itdb_Thumb *thumb); void itdb_thumb_free (Itdb_Thumb *thumb);
Itdb_Thumb *itdb_thumb_new (void);
gchar *itdb_thumb_get_filename (Itdb_Device *device, Itdb_Thumb *thumb); /* itdb_chapterdata_... */
Itdb_Chapterdata *itdb_chapterdata_new (void);
void itdb_chapterdata_free (Itdb_Chapterdata *chapterdata);
Itdb_Chapterdata *itdb_chapterdata_duplicate (Itdb_Chapterdata *chapterdata
);
void itdb_chapterdata_remove_chapter (Itdb_Chapterdata *chapterdata, Itdb_C
hapter *chapter);
void itdb_chapterdata_remove_chapters (Itdb_Chapterdata *chapterdata);
Itdb_Chapter *itdb_chapter_new (void);
void itdb_chapter_free (Itdb_Chapter *chapter);
Itdb_Chapter *itdb_chapter_duplicate (Itdb_Chapter *chapter);
gboolean itdb_chapterdata_add_chapter (Itdb_Chapterdata *chapterdata,
gint32 startpos,
gchar *chaptertitle);
#ifndef LIBGPOD_DISABLE_DEPRECATED #ifndef LIBGPOD_DISABLE_DEPRECATED
/* time functions */ /* time functions */
time_t itdb_time_get_mac_time (void); time_t itdb_time_get_mac_time (void);
time_t itdb_time_mac_to_host (time_t time); time_t itdb_time_mac_to_host (time_t time);
time_t itdb_time_host_to_mac (time_t time); time_t itdb_time_host_to_mac (time_t time);
#endif #endif
/* Initialize a blank ipod */ /* Initialize a blank ipod */
gboolean itdb_init_ipod (const gchar *mountpoint, gboolean itdb_init_ipod (const gchar *mountpoint,
 End of changes. 85 change blocks. 
531 lines changed or deleted 1347 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/