summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2007-04-27 15:57:44 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2007-04-27 15:57:44 +0000
commit79d85519cbaa60dd781d0182605440f5dde6860c (patch)
tree2300fb9d8eae3ca9c64a5f074baded5fb6bbdf72
parent31b1a8d568191883048d9273fae547825928c294 (diff)
downloadlibgpod-tmz-79d85519cbaa60dd781d0182605440f5dde6860c.tar.gz
libgpod-tmz-79d85519cbaa60dd781d0182605440f5dde6860c.tar.xz
libgpod-tmz-79d85519cbaa60dd781d0182605440f5dde6860c.zip
* src/itdb.h
src/itdb_itunesdb.c src/itdb_playlist.c src/itdb_private.h: namespace cleanup. Applications supporting smart playlists will have to be adapted. The following changes were implemented to make sure all exported symbols start with ITDB or Itdb: structs: SPLPref -> Itdb_SPLPref SPLRules -> Itdb_SPLRules SPLRule -> Itdb_SPLRule SPL_* -> ITDB_SPL_* enums, #defines: LIMITTYPE_* -> ITDB_LIMITTYPE_* LIMITSORT_* -> ITDB_LIMITSORT_* SPLMATCH_* -> ITDB_SPLMATCH_* SPLACTION_* -> ITDB_SPLACTION_* SPLFIELD_* -> ITDB_SPLFIELD_* SPLDATE_IDENTIFIER -> ITDB_SPL_DATE_IDENTIFIER splft_* -> ITDB_SPLFT_* splat_* -> ITDB_SPLAT_* enum SPLAction -> ItdbSPLAction enum SPLActionType -> ItdbSPLActionType enum SPLField -> ItdbSPLField enum SPLFieldType -> ItdbSPLFieldType enum ItdbLimitType (new) enum ItdbLimitSort (new) enum ItdbSPLMatch (new) removed SPL_MAXSTRINGLENGTH (use ITDB_SPL_STRING_MAXLEN) git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1418 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog31
-rw-r--r--src/itdb.h290
-rw-r--r--src/itdb_itunesdb.c79
-rw-r--r--src/itdb_playlist.c656
-rw-r--r--src/itdb_private.h4
5 files changed, 543 insertions, 517 deletions
diff --git a/ChangeLog b/ChangeLog
index 62fbf65..cb6895c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
2007-04-27 Jorg Schuler <jcsjcs at users.sourceforge.net>
+ * src/itdb.h
+ src/itdb_itunesdb.c
+ src/itdb_playlist.c
+ src/itdb_private.h: namespace cleanup. Applications supporting
+ smart playlists will have to be adapted. The following changes
+ were implemented to make sure all exported symbols start with
+ ITDB or Itdb:
+
+ structs:
+ SPLPref -> Itdb_SPLPref
+ SPLRules -> Itdb_SPLRules
+ SPLRule -> Itdb_SPLRule
+ SPL_* -> ITDB_SPL_*
+ enums, #defines:
+ LIMITTYPE_* -> ITDB_LIMITTYPE_*
+ LIMITSORT_* -> ITDB_LIMITSORT_*
+ SPLMATCH_* -> ITDB_SPLMATCH_*
+ SPLACTION_* -> ITDB_SPLACTION_*
+ SPLFIELD_* -> ITDB_SPLFIELD_*
+ SPLDATE_IDENTIFIER -> ITDB_SPL_DATE_IDENTIFIER
+ splft_* -> ITDB_SPLFT_*
+ splat_* -> ITDB_SPLAT_*
+ enum SPLAction -> ItdbSPLAction
+ enum SPLActionType -> ItdbSPLActionType
+ enum SPLField -> ItdbSPLField
+ enum SPLFieldType -> ItdbSPLFieldType
+ enum ItdbLimitType (new)
+ enum ItdbLimitSort (new)
+ enum ItdbSPLMatch (new)
+ removed SPL_MAXSTRINGLENGTH (use ITDB_SPL_STRING_MAXLEN)
+
* docs/reference/tmpl/device.sgml
docs/reference/tmpl/itunesdb-time.sgml
docs/reference/tmpl/libgpod-unused.sgml
diff --git a/src/itdb.h b/src/itdb.h
index 447bb42..e557e6e 100644
--- a/src/itdb.h
+++ b/src/itdb.h
@@ -56,9 +56,9 @@ typedef gpointer (* ItdbUserDataDuplicateFunc) (gpointer userdata);
typedef struct _Itdb_Device Itdb_Device;
typedef struct _Itdb_Artwork Itdb_Artwork;
typedef struct _Itdb_Thumb Itdb_Thumb;
-typedef struct _SPLPref SPLPref;
-typedef struct _SPLRule SPLRule;
-typedef struct _SPLRules SPLRules;
+typedef struct _Itdb_SPLPref Itdb_SPLPref;
+typedef struct _Itdb_SPLRule Itdb_SPLRule;
+typedef struct _Itdb_SPLRules Itdb_SPLRules;
typedef struct _Itdb_iTunesDB Itdb_iTunesDB;
typedef struct _Itdb_PhotoDB Itdb_PhotoDB;
typedef struct _Itdb_Playlist Itdb_Playlist;
@@ -137,33 +137,34 @@ struct _Itdb_IpodInfo {
/* 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
in his impressive C++ class. Contact him for a complete
- copy. Further, all enums and #defines below, SPLRule, SPLRules, and
- SPLPref may also be used under a FreeBSD license. */
+ copy. Further, all enums and #defines below, Itdb_SPLRule, Itdb_SPLRules, and
+ Itdb_SPLPref may also be used under a FreeBSD license. */
-#define SPL_STRING_MAXLEN 255
+#define ITDB_SPL_STRING_MAXLEN 255
+#define ITDB_SPL_DATE_IDENTIFIER (G_GINT64_CONSTANT (0x2dae2dae2dae2daeU))
/* Definitions for smart playlists */
-enum { /* types for match_operator */
- SPLMATCH_AND = 0, /* AND rule - all of the rules must be true in
+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 */
- SPLMATCH_OR = 1 /* OR rule */
-};
+ ITDB_SPLMATCH_OR = 1 /* OR rule */
+} ItdbSPLMatch;
/* Limit Types.. like limit playlist to 100 minutes or to 100 songs */
-enum {
- LIMITTYPE_MINUTES = 0x01,
- LIMITTYPE_MB = 0x02,
- LIMITTYPE_SONGS = 0x03,
- LIMITTYPE_HOURS = 0x04,
- LIMITTYPE_GB = 0x05
-};
+typedef enum {
+ ITDB_LIMITTYPE_MINUTES = 0x01,
+ ITDB_LIMITTYPE_MB = 0x02,
+ ITDB_LIMITTYPE_SONGS = 0x03,
+ ITDB_LIMITTYPE_HOURS = 0x04,
+ ITDB_LIMITTYPE_GB = 0x05
+} ItdbLimitType;
/* Limit Sorts.. Like which songs to pick when using a limit type
- Special note: the values for LIMITSORT_LEAST_RECENTLY_ADDED,
- LIMITSORT_LEAST_OFTEN_PLAYED, LIMITSORT_LEAST_RECENTLY_PLAYED, and
- LIMITSORT_LOWEST_RATING are really 0x10, 0x14, 0x15, 0x17, with the
+ Special note: the values for ITDB_LIMITSORT_LEAST_RECENTLY_ADDED,
+ ITDB_LIMITSORT_LEAST_OFTEN_PLAYED, ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED, and
+ ITDB_LIMITSORT_LOWEST_RATING are really 0x10, 0x14, 0x15, 0x17, with the
'limitsort_opposite' flag set. This is the same value as the
- "positive" value (i.e. LIMITSORT_LEAST_RECENTLY_ADDED), and is
+ "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 with the high bit set.
@@ -171,21 +172,21 @@ enum {
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 frickin' annoying. */
-enum {
- LIMITSORT_RANDOM = 0x02,
- LIMITSORT_SONG_NAME = 0x03,
- LIMITSORT_ALBUM = 0x04,
- LIMITSORT_ARTIST = 0x05,
- LIMITSORT_GENRE = 0x07,
- LIMITSORT_MOST_RECENTLY_ADDED = 0x10,
- LIMITSORT_LEAST_RECENTLY_ADDED = 0x80000010, /* See note above */
- LIMITSORT_MOST_OFTEN_PLAYED = 0x14,
- LIMITSORT_LEAST_OFTEN_PLAYED = 0x80000014, /* See note above */
- LIMITSORT_MOST_RECENTLY_PLAYED = 0x15,
- LIMITSORT_LEAST_RECENTLY_PLAYED = 0x80000015,/* See note above */
- LIMITSORT_HIGHEST_RATING = 0x17,
- LIMITSORT_LOWEST_RATING = 0x80000017, /* See note above */
-};
+typedef enum {
+ ITDB_LIMITSORT_RANDOM = 0x02,
+ ITDB_LIMITSORT_SONG_NAME = 0x03,
+ ITDB_LIMITSORT_ALBUM = 0x04,
+ ITDB_LIMITSORT_ARTIST = 0x05,
+ ITDB_LIMITSORT_GENRE = 0x07,
+ ITDB_LIMITSORT_MOST_RECENTLY_ADDED = 0x10,
+ ITDB_LIMITSORT_LEAST_RECENTLY_ADDED = 0x80000010, /* See note above */
+ ITDB_LIMITSORT_MOST_OFTEN_PLAYED = 0x14,
+ ITDB_LIMITSORT_LEAST_OFTEN_PLAYED = 0x80000014, /* See note above */
+ ITDB_LIMITSORT_MOST_RECENTLY_PLAYED = 0x15,
+ ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED = 0x80000015,/* See note above */
+ ITDB_LIMITSORT_HIGHEST_RATING = 0x17,
+ ITDB_LIMITSORT_LOWEST_RATING = 0x80000017, /* See note above */
+} ItdbLimitSort;
/* Smartlist Actions - Used in the rules.
Note by Otto (Samuel Wood):
@@ -206,145 +207,140 @@ Note by Otto (Samuel Wood):
bit 9 = "in the last"
*/
typedef enum {
- SPLACTION_IS_INT = 0x00000001, /* "Is Set" in iTunes */
- SPLACTION_IS_GREATER_THAN = 0x00000010, /* "Is After" in iTunes */
- SPLACTION_IS_LESS_THAN = 0x00000040, /* "Is Before" in iTunes */
- SPLACTION_IS_IN_THE_RANGE = 0x00000100,
- SPLACTION_IS_IN_THE_LAST = 0x00000200,
- SPLACTION_BINARY_AND = 0x00000400,
+ ITDB_SPLACTION_IS_INT = 0x00000001, /* "Is Set" in iTunes */
+ ITDB_SPLACTION_IS_GREATER_THAN = 0x00000010, /* "Is After" in iTunes */
+ ITDB_SPLACTION_IS_LESS_THAN = 0x00000040, /* "Is Before" in iTunes */
+ ITDB_SPLACTION_IS_IN_THE_RANGE = 0x00000100,
+ ITDB_SPLACTION_IS_IN_THE_LAST = 0x00000200,
+ ITDB_SPLACTION_BINARY_AND = 0x00000400,
- SPLACTION_IS_STRING = 0x01000001,
- SPLACTION_CONTAINS = 0x01000002,
- SPLACTION_STARTS_WITH = 0x01000004,
- SPLACTION_ENDS_WITH = 0x01000008,
+ ITDB_SPLACTION_IS_STRING = 0x01000001,
+ ITDB_SPLACTION_CONTAINS = 0x01000002,
+ ITDB_SPLACTION_STARTS_WITH = 0x01000004,
+ ITDB_SPLACTION_ENDS_WITH = 0x01000008,
- SPLACTION_IS_NOT_INT = 0x02000001, /* "Is Not Set" in iTunes */
+ ITDB_SPLACTION_IS_NOT_INT = 0x02000001, /* "Is Not Set" in iTunes */
/* Note: Not available in iTunes 4.5 (untested on iPod) */
- SPLACTION_IS_NOT_GREATER_THAN = 0x02000010,
+ ITDB_SPLACTION_IS_NOT_GREATER_THAN = 0x02000010,
/* Note: Not available in iTunes 4.5 (untested on iPod) */
- 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) */
- SPLACTION_IS_NOT_IN_THE_RANGE = 0x02000100,
+ ITDB_SPLACTION_IS_NOT_IN_THE_RANGE = 0x02000100,
- SPLACTION_IS_NOT_IN_THE_LAST = 0x02000200,
- SPLACTION_IS_NOT = 0x03000001,
- SPLACTION_DOES_NOT_CONTAIN = 0x03000002,
+ ITDB_SPLACTION_IS_NOT_IN_THE_LAST = 0x02000200,
+ ITDB_SPLACTION_IS_NOT = 0x03000001,
+ ITDB_SPLACTION_DOES_NOT_CONTAIN = 0x03000002,
/* Note: Not available in iTunes 4.5 (seems to work on iPod) */
- 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) */
- SPLACTION_DOES_NOT_END_WITH = 0x03000008,
-} SPLAction;
+ ITDB_SPLACTION_DOES_NOT_END_WITH = 0x03000008,
+} ItdbSPLAction;
typedef enum
{
- splft_string = 1,
- splft_int,
- splft_boolean,
- splft_date,
- splft_playlist,
- splft_unknown,
- splft_binary_and
-} SPLFieldType;
+ ITDB_SPLFT_STRING = 1,
+ ITDB_SPLFT_INT,
+ ITDB_SPLFT_BOOLEAN,
+ ITDB_SPLFT_DATE,
+ ITDB_SPLFT_PLAYLIST,
+ ITDB_SPLFT_UNKNOWN,
+ ITDB_SPLFT_BINARY_AND
+} ItdbSPLFieldType;
typedef enum
{
- splat_string = 1,
- splat_int,
- splat_date,
- splat_range_int,
- splat_range_date,
- splat_inthelast,
- splat_playlist,
- splat_none,
- splat_invalid,
- splat_unknown,
- splat_binary_and
-} SPLActionType;
+ ITDB_SPLAT_STRING = 1,
+ ITDB_SPLAT_INT,
+ ITDB_SPLAT_DATE,
+ ITDB_SPLAT_RANGE_INT,
+ ITDB_SPLAT_RANGE_DATE,
+ ITDB_SPLAT_INTHELAST,
+ ITDB_SPLAT_PLAYLIST,
+ ITDB_SPLAT_NONE,
+ ITDB_SPLAT_INVALID,
+ ITDB_SPLAT_UNKNOWN,
+ ITDB_SPLAT_BINARY_AND
+} 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
range... iTunes might not like it, but the iPod shouldn't care. */
-enum {
- SPLACTION_LAST_DAYS_VALUE = 86400, /* nr of secs in 24 hours */
- SPLACTION_LAST_WEEKS_VALUE = 604800, /* nr of secs in 7 days */
- SPLACTION_LAST_MONTHS_VALUE = 2628000,/* nr of secs in 30.4167
+typedef enum {
+ 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_MONTHS_VALUE = 2628000,/* nr of secs in 30.4167
days ~= 1 month */
-} ;
+} ItdbSPLActionLast;
#if 0
// Hey, why limit ourselves to what iTunes can do? If the iPod can deal with it, excellent!
-#define SPLACTION_LAST_HOURS_VALUE 3600 // number of seconds in 1 hour
-#define SPLACTION_LAST_MINUTES_VALUE 60 // number of seconds in 1 minute
-#define SPLACTION_LAST_YEARS_VALUE 31536000 // number of seconds in 365 days
+#define ITDB_SPLACTION_LAST_HOURS_VALUE 3600 // number of seconds in 1 hour
+#define ITDB_SPLACTION_LAST_MINUTES_VALUE 60 // number of seconds in 1 minute
+#define ITDB_SPLACTION_LAST_YEARS_VALUE 31536000 // number of seconds in 365 days
/* fun ones.. Near as I can tell, all of these work. It's open like that. :)*/
-#define SPLACTION_LAST_LUNARCYCLE_VALUE 2551443 // a "lunar cycle" is the time it takes the moon to circle the earth
-#define SPLACTION_LAST_SIDEREAL_DAY 86164 // a "sidereal day" is time in one revolution of earth on its axis
-#define SPLACTION_LAST_SWATCH_BEAT 86 // a "swatch beat" is 1/1000th of a day.. search for "internet time" on google
-#define SPLACTION_LAST_MOMENT 90 // a "moment" is 1/40th of an hour, or 1.5 minutes
-#define SPLACTION_LAST_OSTENT 600 // an "ostent" is 1/10th of an hour, or 6 minutes
-#define SPLACTION_LAST_FORTNIGHT 1209600 // a "fortnight" is 14 days
-#define SPLACTION_LAST_VINAL 1728000 // a "vinal" is 20 days
-#define SPLACTION_LAST_QUARTER 7889231 // a "quarter" is a quarter year
-#define SPLACTION_LAST_SOLAR_YEAR 31556926 // a "solar year" is the time it takes the earth to go around the sun
-#define SPLACTION_LAST_SIDEREAL_YEAR 31558150 // a "sidereal year" is the time it takes the earth to reach the same point in space again, compared to the stars
+#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_SIDEREAL_DAY 86164 // a "sidereal day" is time in one revolution of earth on its axis
+#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_OSTENT 600 // an "ostent" is 1/10th of an hour, or 6 minutes
+#define ITDB_SPLACTION_LAST_FORTNIGHT 1209600 // a "fortnight" is 14 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_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 "sidereal year" is the time it takes the earth to reach the same point in space again, compared to the stars
#endif
/* Smartlist fields - Used for rules. */
typedef enum {
- SPLFIELD_SONG_NAME = 0x02, /* String */
- SPLFIELD_ALBUM = 0x03, /* String */
- SPLFIELD_ARTIST = 0x04, /* String */
- SPLFIELD_BITRATE = 0x05, /* Int (e.g. from/to = 128) */
- SPLFIELD_SAMPLE_RATE = 0x06, /* Int (e.g. from/to = 44100) */
- SPLFIELD_YEAR = 0x07, /* Int (e.g. from/to = 2004) */
- SPLFIELD_GENRE = 0x08, /* String */
- SPLFIELD_KIND = 0x09, /* String */
- SPLFIELD_DATE_MODIFIED = 0x0a,/* Int/Mac Timestamp (e.g. from/to =
+ ITDB_SPLFIELD_SONG_NAME = 0x02, /* String */
+ ITDB_SPLFIELD_ALBUM = 0x03, /* String */
+ ITDB_SPLFIELD_ARTIST = 0x04, /* String */
+ ITDB_SPLFIELD_BITRATE = 0x05, /* Int (e.g. from/to = 128) */
+ ITDB_SPLFIELD_SAMPLE_RATE = 0x06, /* Int (e.g. from/to = 44100) */
+ ITDB_SPLFIELD_YEAR = 0x07, /* Int (e.g. from/to = 2004) */
+ ITDB_SPLFIELD_GENRE = 0x08, /* String */
+ ITDB_SPLFIELD_KIND = 0x09, /* String */
+ ITDB_SPLFIELD_DATE_MODIFIED = 0x0a,/* Int/Mac Timestamp (e.g. from/to =
bcf93280 == is before 6/19/2004)*/
- SPLFIELD_TRACKNUMBER = 0x0b, /* Int (e.g. from = 1, to = 2) */
- SPLFIELD_SIZE = 0x0c, /* Int (e.g. from/to = 0x00600000
+ ITDB_SPLFIELD_TRACKNUMBER = 0x0b, /* Int (e.g. from = 1, to = 2) */
+ ITDB_SPLFIELD_SIZE = 0x0c, /* Int (e.g. from/to = 0x00600000
for 6MB) */
- SPLFIELD_TIME = 0x0d, /* Int (e.g. from/to = 83999 for
+ ITDB_SPLFIELD_TIME = 0x0d, /* Int (e.g. from/to = 83999 for
1:23/83 seconds) */
- SPLFIELD_COMMENT = 0x0e, /* String */
- SPLFIELD_DATE_ADDED = 0x10, /* Int/Mac Timestamp (e.g. from/to =
+ ITDB_SPLFIELD_COMMENT = 0x0e, /* String */
+ ITDB_SPLFIELD_DATE_ADDED = 0x10, /* Int/Mac Timestamp (e.g. from/to =
bcfa83ff == is after 6/19/2004) */
- SPLFIELD_COMPOSER = 0x12, /* String */
- SPLFIELD_PLAYCOUNT = 0x16, /* Int (e.g. from/to = 1) */
- SPLFIELD_LAST_PLAYED = 0x17, /* Int/Mac Timestamp (e.g. from =
+ ITDB_SPLFIELD_COMPOSER = 0x12, /* String */
+ ITDB_SPLFIELD_PLAYCOUNT = 0x16, /* Int (e.g. from/to = 1) */
+ ITDB_SPLFIELD_LAST_PLAYED = 0x17, /* Int/Mac Timestamp (e.g. from =
bcfa83ff (6/19/2004) to =
0xbcfbd57f (6/20/2004)) */
- SPLFIELD_DISC_NUMBER = 0x18, /* Int (e.g. from/to = 1) */
- SPLFIELD_RATING = 0x19, /* Int/Stars Rating (e.g. from/to =
+ ITDB_SPLFIELD_DISC_NUMBER = 0x18, /* Int (e.g. from/to = 1) */
+ ITDB_SPLFIELD_RATING = 0x19, /* Int/Stars Rating (e.g. from/to =
60 (3 stars)) */
- SPLFIELD_COMPILATION = 0x1f, /* Int (e.g. is set ->
- SPLACTION_IS_INT/from=1,
+ ITDB_SPLFIELD_COMPILATION = 0x1f, /* Int (e.g. is set ->
+ ITDB_SPLACTION_IS_INT/from=1,
is not set ->
- SPLACTION_IS_NOT_INT/from=1) */
- SPLFIELD_BPM = 0x23, /* Int (e.g. from/to = 60) */
- SPLFIELD_GROUPING = 0x27, /* String */
- SPLFIELD_PLAYLIST = 0x28, /* FIXME - Unknown...not parsed
+ 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"... */
- SPLFIELD_VIDEO_KIND = 0x3c, /* Logic Int */
- SPLFIELD_TVSHOW = 0x3e, /* String */
- SPLFIELD_SEASON_NR = 0x3f, /* Int */
- SPLFIELD_SKIPCOUNT = 0x44, /* Int */
- SPLFIELD_LAST_SKIPPED = 0x45, /* Int/Mac Timestamp */
- SPLFIELD_ALBUMARTIST = 0x47 /* String */
-} SPLField;
-
-#define SPLDATE_IDENTIFIER (G_GINT64_CONSTANT (0x2dae2dae2dae2daeU))
-
-/* Maximum string length that iTunes writes to the database */
-#define SPL_MAXSTRINGLENGTH 255
-
-struct _SPLPref
+ 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/Mac Timestamp */
+ ITDB_SPLFIELD_ALBUMARTIST = 0x47 /* String */
+} ItdbSPLField;
+
+struct _Itdb_SPLPref
{
guint8 liveupdate; /* "live Updating" check box */
guint8 checkrules; /* "Match X of the following
@@ -358,7 +354,7 @@ struct _SPLPref
box */
};
-struct _SPLRule
+struct _Itdb_SPLRule
{
guint32 field;
guint32 action;
@@ -387,11 +383,11 @@ struct _SPLRule
};
-struct _SPLRules
+struct _Itdb_SPLRules
{
guint32 unk004;
- guint32 match_operator; /* "All" (logical AND): SPLMATCH_AND,
- "Any" (logical OR): SPLMATCH_OR */
+ guint32 match_operator; /* "All" (logical AND): Itdb_SPLMATCH_AND,
+ "Any" (logical OR): Itdb_SPLMATCH_OR */
GList *rules;
};
@@ -558,8 +554,8 @@ struct _Itdb_Playlist
guint64 id; /* playlist ID */
guint32 sortorder; /* How to sort playlist -- see below */
guint32 podcastflag; /* ITDB_PL_FLAG_NORM/_PODCAST */
- SPLPref splpref; /* smart playlist prefs */
- SPLRules splrules; /* rules for smart playlists */
+ Itdb_SPLPref splpref; /* smart playlist prefs */
+ Itdb_SPLRules splrules; /* rules for smart playlists */
gpointer reserved1; /* reserved for MHOD100 implementation */
gpointer reserved2; /* reserved for MHOD100 implementation */
/* below is for use by application */
@@ -1010,15 +1006,15 @@ gboolean itdb_playlist_is_podcasts (Itdb_Playlist *pl);
void itdb_playlist_set_podcasts (Itdb_Playlist *pl);
/* smart playlist functions */
-SPLFieldType itdb_splr_get_field_type (const SPLRule *splr);
-SPLActionType itdb_splr_get_action_type (const SPLRule *splr);
-void itdb_splr_validate (SPLRule *splr);
-void itdb_splr_remove (Itdb_Playlist *pl, SPLRule *splr);
-SPLRule *itdb_splr_new (void);
-void itdb_splr_add (Itdb_Playlist *pl, SPLRule *splr, gint pos);
-SPLRule *itdb_splr_add_new (Itdb_Playlist *pl, gint pos);
+ItdbSPLFieldType itdb_splr_get_field_type (const Itdb_SPLRule *splr);
+ItdbSPLActionType itdb_splr_get_action_type (const Itdb_SPLRule *splr);
+void itdb_splr_validate (Itdb_SPLRule *splr);
+void itdb_splr_remove (Itdb_Playlist *pl, Itdb_SPLRule *splr);
+Itdb_SPLRule *itdb_splr_new (void);
+void itdb_splr_add (Itdb_Playlist *pl, Itdb_SPLRule *splr, gint pos);
+Itdb_SPLRule *itdb_splr_add_new (Itdb_Playlist *pl, gint pos);
void itdb_spl_copy_rules (Itdb_Playlist *dest, Itdb_Playlist *src);
-gboolean itdb_splr_eval (SPLRule *splr, Itdb_Track *track);
+gboolean itdb_splr_eval (Itdb_SPLRule *splr, Itdb_Track *track);
void itdb_spl_update (Itdb_Playlist *spl);
void itdb_spl_update_all (Itdb_iTunesDB *itdb);
void itdb_spl_update_live (Itdb_iTunesDB *itdb);
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 61bfb71..248f3e0 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -88,10 +88,6 @@
void itunesdb_convert_filename_fs2ipod(gchar *ipod_file);
void itunesdb_convert_filename_ipod2fs(gchar *ipod_file);
- guint32 itunesdb_time_get_mac_time (void);
- time_t itunesdb_time_mac_to_host (guint32 mactime);
- guint32 itunesdb_time_host_to_mac (time_t time);
-
void itunesdb_rename_files (const gchar *dirname);
(Renames/removes some files on the iPod (Playcounts, OTG
@@ -255,8 +251,8 @@ struct _MHODData
gchar *string;
gchar *chapterdata_raw;
Itdb_Track *chapterdata_track; /* for writing chapterdata */
- SPLPref *splpref;
- SPLRules *splrules;
+ Itdb_SPLPref *splpref;
+ Itdb_SPLRules *splrules;
GList *mhod52coltracks;
} data;
union
@@ -1278,7 +1274,7 @@ static gint32 get_mhod_type (FContents *cts, glong seek, guint32 *ml)
/* Returns the contents of the mhod at position @mhod_seek. This can
be a simple string or something more complicated as in the case for
- SPLPREF OR SPLRULES.
+ Itdb_SPLPREF OR Itdb_SPLRULES.
*mhod_len is set to the total length of the mhod (-1 in case an
*error occured).
@@ -1423,7 +1419,7 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
case MHOD_ID_SPLPREF: /* Settings for smart playlist */
if (!check_seek (cts, seek, 14))
return result; /* *ml==-1, result.valid==FALSE */
- result.data.splpref = g_new0 (SPLPref, 1);
+ result.data.splpref = g_new0 (Itdb_SPLPref, 1);
result.data.splpref->liveupdate = get8int (cts, seek);
result.data.splpref->checkrules = get8int (cts, seek+1);
result.data.splpref->checklimits = get8int (cts, seek+2);
@@ -1446,7 +1442,7 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
guint32 numrules;
if (!check_seek (cts, seek, 136))
return result; /* *ml==-1, result.valid==FALSE */
- result.data.splrules = g_new0 (SPLRules, 1);
+ result.data.splrules = g_new0 (Itdb_SPLRules, 1);
result.data.splrules->unk004 = get32bint (cts, seek+4);
numrules = get32bint (cts, seek+8);
result.data.splrules->match_operator = get32bint (cts, seek+12);
@@ -1455,9 +1451,9 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
for (i=0; i<numrules; ++i)
{
guint32 length;
- SPLFieldType ft;
+ ItdbSPLFieldType ft;
gunichar2 *string_utf16;
- SPLRule *splr = g_new0 (SPLRule, 1);
+ Itdb_SPLRule *splr = g_new0 (Itdb_SPLRule, 1);
result.data.splrules->rules = g_list_append (
result.data.splrules->rules, splr);
if (!check_seek (cts, seek, 56))
@@ -1477,7 +1473,7 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
ft = itdb_splr_get_field_type (splr);
switch (ft)
{
- case splft_string:
+ case ITDB_SPLFT_STRING:
string_utf16 = g_new0 (gunichar2, (length+2)/2);
if (!seek_get_n_bytes (cts, (gchar *)string_utf16,
seek+4, length))
@@ -1490,12 +1486,12 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
string_utf16, -1, NULL, NULL, NULL);
g_free (string_utf16);
break;
- case splft_int:
- case splft_date:
- case splft_boolean:
- case splft_playlist:
- case splft_unknown:
- case splft_binary_and:
+ case ITDB_SPLFT_INT:
+ case ITDB_SPLFT_DATE:
+ case ITDB_SPLFT_BOOLEAN:
+ case ITDB_SPLFT_PLAYLIST:
+ case ITDB_SPLFT_UNKNOWN:
+ case ITDB_SPLFT_BINARY_AND:
if (length != 0x44)
{
g_warning (_("Length of smart playlist rule field (%d) not as expected. Trying to continue anyhow.\n"), length);
@@ -1508,17 +1504,19 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
splr->tovalue = get64bint (cts, seek+28);
splr->todate = get64bint (cts, seek+36);
splr->tounits = get64bint (cts, seek+44);
- /* SPLFIELD_PLAYLIST seems to use these unknowns*/
+ /* ITDB_SPLFIELD_PLAYLIST seems to use these unknowns*/
splr->unk052 = get32bint (cts, seek+52);
splr->unk056 = get32bint (cts, seek+56);
splr->unk060 = get32bint (cts, seek+60);
splr->unk064 = get32bint (cts, seek+64);
splr->unk068 = get32bint (cts, seek+68);
- if (ft == splft_date) {
- SPLActionType at;
+ if (ft == ITDB_SPLFT_DATE) {
+ ItdbSPLActionType at;
at = itdb_splr_get_action_type (splr);
- if ((at == splat_range_date) || (at == splat_date)) {
+ if ((at == ITDB_SPLAT_RANGE_DATE) ||
+ (at == ITDB_SPLAT_DATE))
+ {
Itdb_iTunesDB *itdb = fimp->itdb;
splr->fromvalue = itdb_time_mac_to_time_t (itdb,
splr->fromvalue);
@@ -2027,7 +2025,7 @@ static glong get_playlist (FImport *fimp, glong mhyp_seek)
{
plitem->is_spl = TRUE;
memcpy (&plitem->splpref, mhod.data.splpref,
- sizeof (SPLPref));
+ sizeof (Itdb_SPLPref));
g_free (mhod.data.splpref);
mhod.valid = FALSE;
}
@@ -2039,7 +2037,7 @@ static glong get_playlist (FImport *fimp, glong mhyp_seek)
{
plitem->is_spl = TRUE;
memcpy (&plitem->splrules, mhod.data.splrules,
- sizeof (SPLRules));
+ sizeof (Itdb_SPLRules));
g_free (mhod.data.splrules);
mhod.valid = FALSE;
}
@@ -3681,8 +3679,8 @@ static void mhod52_free_collate_keys (GList *coltracks)
type: see enum of MHMOD_IDs;
data: utf8 string for text items
position indicator for MHOD_ID_PLAYLIST
- SPLPref for MHOD_ID_SPLPREF
- SPLRules for MHOD_ID_SPLRULES */
+ Itdb_SPLPref for MHOD_ID_SPLPREF
+ Itdb_SPLRules for MHOD_ID_SPLRULES */
static void mk_mhod (FExport *fexp, MHODData *mhod)
{
WContents *cts = fexp->wcontents;
@@ -3834,8 +3832,8 @@ static void mk_mhod (FExport *fexp, MHODData *mhod)
/* end of header, now follow the rules */
for (gl=mhod->data.splrules->rules; gl; gl=gl->next)
{
- SPLRule *splr = gl->data;
- SPLFieldType ft;
+ Itdb_SPLRule *splr = gl->data;
+ ItdbSPLFieldType ft;
gint len;
gunichar2 *entry_utf16;
g_return_if_fail (splr);
@@ -3847,7 +3845,7 @@ static void mk_mhod (FExport *fexp, MHODData *mhod)
put32_n0 (cts, 11); /* unknown */
switch (ft)
{
- case splft_string:
+ case ITDB_SPLFT_STRING:
/* write string-type rule */
entry_utf16 = NULL;
/* splr->string may be NULL */
@@ -3860,25 +3858,26 @@ static void mk_mhod (FExport *fexp, MHODData *mhod)
put_data (cts, (gchar *)entry_utf16, 2*len);
g_free (entry_utf16);
break;
- case splft_date:
- case splft_int:
- case splft_boolean:
- case splft_playlist:
- case splft_unknown:
- case splft_binary_and: {
+ case ITDB_SPLFT_DATE:
+ case ITDB_SPLFT_INT:
+ case ITDB_SPLFT_BOOLEAN:
+ case ITDB_SPLFT_PLAYLIST:
+ case ITDB_SPLFT_UNKNOWN:
+ case ITDB_SPLFT_BINARY_AND: {
guint64 fromvalue;
guint64 tovalue;
fromvalue = splr->fromvalue;
tovalue = splr->tovalue;
- if (ft == splft_date) {
- SPLActionType at;
+ if (ft == ITDB_SPLFT_DATE) {
+ ItdbSPLActionType at;
at = itdb_splr_get_action_type (splr);
- if ((at == splat_range_date) || (at == splat_date)) {
+ if ((at == ITDB_SPLAT_RANGE_DATE) ||
+ (at == ITDB_SPLAT_DATE))
+ {
Itdb_iTunesDB *itdb = fexp->itdb;
- fromvalue = itdb_time_time_t_to_mac (itdb,
- fromvalue);
+ fromvalue = itdb_time_time_t_to_mac (itdb, fromvalue);
tovalue = itdb_time_time_t_to_mac (itdb, tovalue);
}
}
diff --git a/src/itdb_playlist.c b/src/itdb_playlist.c
index dc38d9e..2d56a23 100644
--- a/src/itdb_playlist.c
+++ b/src/itdb_playlist.c
@@ -47,31 +47,31 @@
* Return value: TRUE if @action is known. Otherwise a warning is displayed
* and FALSE is returned.
**/
-gboolean itdb_spl_action_known (SPLAction action)
+gboolean itdb_spl_action_known (ItdbSPLAction action)
{
gboolean result = FALSE;
switch (action)
{
- case SPLACTION_IS_INT:
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- case SPLACTION_IS_IN_THE_RANGE:
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_STRING:
- case SPLACTION_CONTAINS:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- case SPLACTION_IS_NOT_INT:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- case SPLACTION_IS_NOT:
- case SPLACTION_DOES_NOT_CONTAIN:
- case SPLACTION_BINARY_AND:
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ case ITDB_SPLACTION_BINARY_AND:
result = TRUE;
}
if (result == FALSE)
@@ -83,232 +83,232 @@ gboolean itdb_spl_action_known (SPLAction action)
/**
* itdb_splr_get_field_type:
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
*
* Gets the type of the field of the @splr rule
*
- * Return value: an #SPLFieldType corresponding to @splr field type
+ * Return value: an #Itdb_SPLFieldType corresponding to @splr field type
* (string, int, date, ...)
**/
-SPLFieldType itdb_splr_get_field_type (const SPLRule *splr)
+ItdbSPLFieldType itdb_splr_get_field_type (const Itdb_SPLRule *splr)
{
- g_return_val_if_fail (splr != NULL, splft_unknown);
+ g_return_val_if_fail (splr != NULL, ITDB_SPLFT_UNKNOWN);
- switch((SPLField)splr->field)
+ switch((ItdbSPLField)splr->field)
{
- case SPLFIELD_SONG_NAME:
- case SPLFIELD_ALBUM:
- case SPLFIELD_ALBUMARTIST:
- case SPLFIELD_ARTIST:
- case SPLFIELD_GENRE:
- case SPLFIELD_KIND:
- case SPLFIELD_COMMENT:
- case SPLFIELD_COMPOSER:
- case SPLFIELD_GROUPING:
- case SPLFIELD_TVSHOW:
- return splft_string;
- case SPLFIELD_BITRATE:
- case SPLFIELD_SAMPLE_RATE:
- case SPLFIELD_YEAR:
- case SPLFIELD_TRACKNUMBER:
- case SPLFIELD_SIZE:
- case SPLFIELD_PLAYCOUNT:
- case SPLFIELD_DISC_NUMBER:
- case SPLFIELD_BPM:
- case SPLFIELD_RATING:
- case SPLFIELD_TIME: /* time is the length of the track in
+ case ITDB_SPLFIELD_SONG_NAME:
+ case ITDB_SPLFIELD_ALBUM:
+ case ITDB_SPLFIELD_ALBUMARTIST:
+ case ITDB_SPLFIELD_ARTIST:
+ case ITDB_SPLFIELD_GENRE:
+ case ITDB_SPLFIELD_KIND:
+ case ITDB_SPLFIELD_COMMENT:
+ case ITDB_SPLFIELD_COMPOSER:
+ case ITDB_SPLFIELD_GROUPING:
+ case ITDB_SPLFIELD_TVSHOW:
+ return ITDB_SPLFT_STRING;
+ case ITDB_SPLFIELD_BITRATE:
+ case ITDB_SPLFIELD_SAMPLE_RATE:
+ case ITDB_SPLFIELD_YEAR:
+ case ITDB_SPLFIELD_TRACKNUMBER:
+ case ITDB_SPLFIELD_SIZE:
+ case ITDB_SPLFIELD_PLAYCOUNT:
+ case ITDB_SPLFIELD_DISC_NUMBER:
+ case ITDB_SPLFIELD_BPM:
+ case ITDB_SPLFIELD_RATING:
+ case ITDB_SPLFIELD_TIME: /* time is the length of the track in
milliseconds */
- case SPLFIELD_SEASON_NR:
- case SPLFIELD_SKIPCOUNT:
- return splft_int;
- case SPLFIELD_COMPILATION:
- return splft_boolean;
- case SPLFIELD_DATE_MODIFIED:
- case SPLFIELD_DATE_ADDED:
- case SPLFIELD_LAST_PLAYED:
- case SPLFIELD_LAST_SKIPPED:
- return splft_date;
- case SPLFIELD_PLAYLIST:
- return splft_playlist;
- case SPLFIELD_VIDEO_KIND:
- return splft_binary_and;
+ case ITDB_SPLFIELD_SEASON_NR:
+ case ITDB_SPLFIELD_SKIPCOUNT:
+ return ITDB_SPLFT_INT;
+ case ITDB_SPLFIELD_COMPILATION:
+ return ITDB_SPLFT_BOOLEAN;
+ case ITDB_SPLFIELD_DATE_MODIFIED:
+ case ITDB_SPLFIELD_DATE_ADDED:
+ case ITDB_SPLFIELD_LAST_PLAYED:
+ case ITDB_SPLFIELD_LAST_SKIPPED:
+ return ITDB_SPLFT_DATE;
+ case ITDB_SPLFIELD_PLAYLIST:
+ return ITDB_SPLFT_PLAYLIST;
+ case ITDB_SPLFIELD_VIDEO_KIND:
+ return ITDB_SPLFT_BINARY_AND;
}
- return(splft_unknown);
+ return(ITDB_SPLFT_UNKNOWN);
}
/**
* itdb_splr_get_action_type:
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
*
* Gets the type of the action associated with @splr.
*
* Return value: type (range, date, string...) of the action field
**/
-SPLActionType itdb_splr_get_action_type (const SPLRule *splr)
+ItdbSPLActionType itdb_splr_get_action_type (const Itdb_SPLRule *splr)
{
- SPLFieldType fieldType;
+ ItdbSPLFieldType fieldType;
- g_return_val_if_fail (splr != NULL, splft_unknown);
+ g_return_val_if_fail (splr != NULL, ITDB_SPLAT_INVALID);
fieldType = itdb_splr_get_field_type (splr);
switch(fieldType)
{
- case splft_string:
- switch ((SPLAction)splr->action)
+ case ITDB_SPLFT_STRING:
+ switch ((ItdbSPLAction)splr->action)
{
- case SPLACTION_IS_STRING:
- case SPLACTION_IS_NOT:
- case SPLACTION_CONTAINS:
- case SPLACTION_DOES_NOT_CONTAIN:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- return splat_string;
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- case SPLACTION_IS_INT:
- case SPLACTION_IS_NOT_INT:
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- case SPLACTION_IS_IN_THE_RANGE:
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- case SPLACTION_BINARY_AND:
- return splat_invalid;
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ return ITDB_SPLAT_STRING;
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_BINARY_AND:
+ return ITDB_SPLAT_INVALID;
}
/* Unknown action type */
g_warning ("Unknown action type %d\n\n", splr->action);
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
- case splft_int:
- switch ((SPLAction)splr->action)
+ case ITDB_SPLFT_INT:
+ switch ((ItdbSPLAction)splr->action)
{
- case SPLACTION_IS_INT:
- case SPLACTION_IS_NOT_INT:
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- return splat_int;
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- case SPLACTION_IS_IN_THE_RANGE:
- return splat_range_int;
- case SPLACTION_BINARY_AND:
- case SPLACTION_IS_STRING:
- case SPLACTION_CONTAINS:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- case SPLACTION_IS_NOT:
- case SPLACTION_DOES_NOT_CONTAIN:
- return splat_invalid;
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ return ITDB_SPLAT_INT;
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ return ITDB_SPLAT_RANGE_INT;
+ case ITDB_SPLACTION_BINARY_AND:
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ return ITDB_SPLAT_INVALID;
}
/* Unknown action type */
g_warning ("Unknown action type %d\n\n", splr->action);
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
- case splft_boolean:
- return splat_none;
+ case ITDB_SPLFT_BOOLEAN:
+ return ITDB_SPLAT_NONE;
- case splft_date:
- switch ((SPLAction)splr->action)
+ case ITDB_SPLFT_DATE:
+ switch ((ItdbSPLAction)splr->action)
{
- case SPLACTION_IS_INT:
- case SPLACTION_IS_NOT_INT:
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- return splat_date;
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- return splat_inthelast;
- case SPLACTION_IS_IN_THE_RANGE:
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- return splat_range_date;
- case SPLACTION_IS_STRING:
- case SPLACTION_CONTAINS:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- case SPLACTION_IS_NOT:
- case SPLACTION_DOES_NOT_CONTAIN:
- case SPLACTION_BINARY_AND:
- return splat_invalid;
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ return ITDB_SPLAT_DATE;
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ return ITDB_SPLAT_INTHELAST;
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ return ITDB_SPLAT_RANGE_DATE;
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ case ITDB_SPLACTION_BINARY_AND:
+ return ITDB_SPLAT_INVALID;
}
- case splft_binary_and:
- switch ((SPLAction)splr->action)
+ case ITDB_SPLFT_BINARY_AND:
+ switch ((ItdbSPLAction)splr->action)
{
- case SPLACTION_BINARY_AND:
- return splat_binary_and;
- case SPLACTION_IS_INT:
- case SPLACTION_IS_NOT_INT:
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- case SPLACTION_IS_IN_THE_RANGE:
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- case SPLACTION_IS_STRING:
- case SPLACTION_CONTAINS:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- case SPLACTION_IS_NOT:
- case SPLACTION_DOES_NOT_CONTAIN:
- return splat_invalid;
+ case ITDB_SPLACTION_BINARY_AND:
+ return ITDB_SPLAT_BINARY_AND;
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ return ITDB_SPLAT_INVALID;
}
/* Unknown action type */
g_warning ("Unknown action type %d\n\n", splr->action);
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
- case splft_playlist:
- switch ((SPLAction)splr->action)
+ case ITDB_SPLFT_PLAYLIST:
+ switch ((ItdbSPLAction)splr->action)
{
- case SPLACTION_IS_INT:
- case SPLACTION_IS_NOT_INT:
- return splat_playlist;
- case SPLACTION_IS_GREATER_THAN:
- case SPLACTION_IS_NOT_GREATER_THAN:
- case SPLACTION_IS_LESS_THAN:
- case SPLACTION_IS_NOT_LESS_THAN:
- case SPLACTION_IS_IN_THE_LAST:
- case SPLACTION_IS_NOT_IN_THE_LAST:
- case SPLACTION_IS_IN_THE_RANGE:
- case SPLACTION_IS_NOT_IN_THE_RANGE:
- case SPLACTION_IS_STRING:
- case SPLACTION_CONTAINS:
- case SPLACTION_STARTS_WITH:
- case SPLACTION_DOES_NOT_START_WITH:
- case SPLACTION_ENDS_WITH:
- case SPLACTION_DOES_NOT_END_WITH:
- case SPLACTION_IS_NOT:
- case SPLACTION_DOES_NOT_CONTAIN:
- case SPLACTION_BINARY_AND:
- return splat_invalid;
+ case ITDB_SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
+ return ITDB_SPLAT_PLAYLIST;
+ case ITDB_SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
+ case ITDB_SPLACTION_BINARY_AND:
+ return ITDB_SPLAT_INVALID;
}
/* Unknown action type */
g_warning ("Unknown action type %d\n\n", splr->action);
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
- case splft_unknown:
+ case ITDB_SPLFT_UNKNOWN:
/* Unknown action type */
g_warning ("Unknown action type %d\n\n", splr->action);
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
}
- return splat_unknown;
+ return ITDB_SPLAT_UNKNOWN;
}
/* -------------------------------------------------------------------
@@ -323,17 +323,17 @@ SPLActionType itdb_splr_get_action_type (const SPLRule *splr)
/**
* itdb_splr_eval:
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
* @track: an #Itdb_Track
*
* Evaluates @splr's truth against @track. track-&gt;itdb must be set.
*
* Return value: TRUE if @track matches @splr, FALSE otherwise.
**/
-gboolean itdb_splr_eval (SPLRule *splr, Itdb_Track *track)
+gboolean itdb_splr_eval (Itdb_SPLRule *splr, Itdb_Track *track)
{
- SPLFieldType ft;
- SPLActionType at;
+ ItdbSPLFieldType ft;
+ ItdbSPLActionType at;
gchar *strcomp = NULL;
gint64 intcomp = 0;
gboolean boolcomp = FALSE;
@@ -350,124 +350,124 @@ gboolean itdb_splr_eval (SPLRule *splr, Itdb_Track *track)
ft = itdb_splr_get_field_type (splr);
at = itdb_splr_get_action_type (splr);
- g_return_val_if_fail (at != splat_invalid, FALSE);
+ g_return_val_if_fail (at != ITDB_SPLAT_INVALID, FALSE);
/* find what we need to compare in the track */
switch (splr->field)
{
- case SPLFIELD_SONG_NAME:
+ case ITDB_SPLFIELD_SONG_NAME:
strcomp = track->title;
handled = TRUE;
break;
- case SPLFIELD_ALBUM:
+ case ITDB_SPLFIELD_ALBUM:
strcomp = track->album;
handled = TRUE;
break;
- case SPLFIELD_ARTIST:
+ case ITDB_SPLFIELD_ARTIST:
strcomp = track->artist;
handled = TRUE;
break;
- case SPLFIELD_GENRE:
+ case ITDB_SPLFIELD_GENRE:
strcomp = track->genre;
handled = TRUE;
break;
- case SPLFIELD_KIND:
+ case ITDB_SPLFIELD_KIND:
strcomp = track->filetype;
handled = TRUE;
break;
- case SPLFIELD_COMMENT:
+ case ITDB_SPLFIELD_COMMENT:
strcomp = track->comment;
handled = TRUE;
break;
- case SPLFIELD_COMPOSER:
+ case ITDB_SPLFIELD_COMPOSER:
strcomp = track->composer;
handled = TRUE;
break;
- case SPLFIELD_GROUPING:
+ case ITDB_SPLFIELD_GROUPING:
strcomp = track->grouping;
handled = TRUE;
break;
- case SPLFIELD_BITRATE:
+ case ITDB_SPLFIELD_BITRATE:
intcomp = track->bitrate;
handled = TRUE;
break;
- case SPLFIELD_SAMPLE_RATE:
+ case ITDB_SPLFIELD_SAMPLE_RATE:
intcomp = track->samplerate;
handled = TRUE;
break;
- case SPLFIELD_YEAR:
+ case ITDB_SPLFIELD_YEAR:
intcomp = track->year;
handled = TRUE;
break;
- case SPLFIELD_TRACKNUMBER:
+ case ITDB_SPLFIELD_TRACKNUMBER:
intcomp = track->track_nr;
handled = TRUE;
break;
- case SPLFIELD_SIZE:
+ case ITDB_SPLFIELD_SIZE:
intcomp = track->size;
handled = TRUE;
break;
- case SPLFIELD_PLAYCOUNT:
+ case ITDB_SPLFIELD_PLAYCOUNT:
intcomp = track->playcount;
handled = TRUE;
break;
- case SPLFIELD_DISC_NUMBER:
+ case ITDB_SPLFIELD_DISC_NUMBER:
intcomp = track->cd_nr;
handled = TRUE;
break;
- case SPLFIELD_BPM:
+ case ITDB_SPLFIELD_BPM:
intcomp = track->BPM;
handled = TRUE;
break;
- case SPLFIELD_RATING:
+ case ITDB_SPLFIELD_RATING:
intcomp = track->rating;
handled = TRUE;
break;
- case SPLFIELD_TIME:
+ case ITDB_SPLFIELD_TIME:
intcomp = track->tracklen/1000;
handled = TRUE;
break;
- case SPLFIELD_COMPILATION:
+ case ITDB_SPLFIELD_COMPILATION:
boolcomp = track->compilation;
handled = TRUE;
break;
- case SPLFIELD_DATE_MODIFIED:
+ case ITDB_SPLFIELD_DATE_MODIFIED:
datecomp = track->time_modified;
handled = TRUE;
break;
- case SPLFIELD_DATE_ADDED:
+ case ITDB_SPLFIELD_DATE_ADDED:
datecomp = track->time_added;
handled = TRUE;
break;
- case SPLFIELD_LAST_PLAYED:
+ case ITDB_SPLFIELD_LAST_PLAYED:
datecomp = track->time_played;
handled = TRUE;
break;
- case SPLFIELD_PLAYLIST:
+ case ITDB_SPLFIELD_PLAYLIST:
playcomp = itdb_playlist_by_id (track->itdb, splr->fromvalue);
handled = TRUE;
break;
- case SPLFIELD_ALBUMARTIST:
+ case ITDB_SPLFIELD_ALBUMARTIST:
strcomp = track->albumartist;
handled = TRUE;
break;
- case SPLFIELD_TVSHOW:
+ case ITDB_SPLFIELD_TVSHOW:
strcomp = track->tvshow;
handled = TRUE;
break;
- case SPLFIELD_LAST_SKIPPED:
+ case ITDB_SPLFIELD_LAST_SKIPPED:
datecomp = track->last_skipped;
handled = TRUE;
break;
- case SPLFIELD_SEASON_NR:
+ case ITDB_SPLFIELD_SEASON_NR:
intcomp = track->season_nr;
handled = TRUE;
break;
- case SPLFIELD_SKIPCOUNT:
+ case ITDB_SPLFIELD_SKIPCOUNT:
intcomp = track->skipcount;
handled = TRUE;
break;
- case SPLFIELD_VIDEO_KIND:
+ case ITDB_SPLFIELD_VIDEO_KIND:
intcomp = track->mediatype;
handled = TRUE;
break;
@@ -480,128 +480,128 @@ gboolean itdb_splr_eval (SPLRule *splr, Itdb_Track *track)
/* actually do the comparison to our rule */
switch (ft)
{
- case splft_string:
+ case ITDB_SPLFT_STRING:
if(strcomp && splr->string)
{
gint len1 = strlen (strcomp);
gint len2 = strlen (splr->string);
switch (splr->action)
{
- case SPLACTION_IS_STRING:
+ case ITDB_SPLACTION_IS_STRING:
return (strcmp (strcomp, splr->string) == 0);
- case SPLACTION_IS_NOT:
+ case ITDB_SPLACTION_IS_NOT:
return (strcmp (strcomp, splr->string) != 0);
- case SPLACTION_CONTAINS:
+ case ITDB_SPLACTION_CONTAINS:
return (strstr (strcomp, splr->string) != NULL);
- case SPLACTION_DOES_NOT_CONTAIN:
+ case ITDB_SPLACTION_DOES_NOT_CONTAIN:
return (strstr (strcomp, splr->string) == NULL);
- case SPLACTION_STARTS_WITH:
+ case ITDB_SPLACTION_STARTS_WITH:
return (strncmp (strcomp, splr->string, len2) == 0);
- case SPLACTION_ENDS_WITH:
+ case ITDB_SPLACTION_ENDS_WITH:
if (len2 > len1) return FALSE;
return (strncmp (strcomp+len1-len2,
splr->string, len2) == 0);
- case SPLACTION_DOES_NOT_START_WITH:
+ case ITDB_SPLACTION_DOES_NOT_START_WITH:
return (strncmp (strcomp, splr->string,
strlen (splr->string)) != 0);
- case SPLACTION_DOES_NOT_END_WITH:
+ case ITDB_SPLACTION_DOES_NOT_END_WITH:
if (len2 > len1) return TRUE;
return (strncmp (strcomp+len1-len2,
splr->string, len2) != 0);
};
}
return FALSE;
- case splft_int:
+ case ITDB_SPLFT_INT:
switch(splr->action)
{
- case SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_INT:
return (intcomp == splr->fromvalue);
- case SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
return (intcomp != splr->fromvalue);
- case SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
return (intcomp > splr->fromvalue);
- case SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
return (intcomp < splr->fromvalue);
- case SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
return ((intcomp <= splr->fromvalue &&
intcomp >= splr->tovalue) ||
(intcomp >= splr->fromvalue &&
intcomp <= splr->tovalue));
- case SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
return ((intcomp < splr->fromvalue &&
intcomp < splr->tovalue) ||
(intcomp > splr->fromvalue &&
intcomp > splr->tovalue));
}
return FALSE;
- case splft_binary_and:
+ case ITDB_SPLFT_BINARY_AND:
switch(splr->action)
{
- case SPLACTION_BINARY_AND:
+ case ITDB_SPLACTION_BINARY_AND:
return (intcomp & splr->fromvalue)? TRUE:FALSE;
}
return FALSE;
- case splft_boolean:
+ case ITDB_SPLFT_BOOLEAN:
switch (splr->action)
{
- case SPLACTION_IS_INT: /* aka "is set" */
+ case ITDB_SPLACTION_IS_INT: /* aka "is set" */
return (boolcomp != 0);
- case SPLACTION_IS_NOT_INT: /* aka "is not set" */
+ case ITDB_SPLACTION_IS_NOT_INT: /* aka "is not set" */
return (boolcomp == 0);
}
return FALSE;
- case splft_date:
+ case ITDB_SPLFT_DATE:
switch (splr->action)
{
- case SPLACTION_IS_INT:
+ case ITDB_SPLACTION_IS_INT:
return (datecomp == splr->fromvalue);
- case SPLACTION_IS_NOT_INT:
+ case ITDB_SPLACTION_IS_NOT_INT:
return (datecomp != splr->fromvalue);
- case SPLACTION_IS_GREATER_THAN:
+ case ITDB_SPLACTION_IS_GREATER_THAN:
return (datecomp > splr->fromvalue);
- case SPLACTION_IS_LESS_THAN:
+ case ITDB_SPLACTION_IS_LESS_THAN:
return (datecomp < splr->fromvalue);
- case SPLACTION_IS_NOT_GREATER_THAN:
+ case ITDB_SPLACTION_IS_NOT_GREATER_THAN:
return (datecomp <= splr->fromvalue);
- case SPLACTION_IS_NOT_LESS_THAN:
+ case ITDB_SPLACTION_IS_NOT_LESS_THAN:
return (datecomp >= splr->fromvalue);
- case SPLACTION_IS_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_IN_THE_LAST:
time (&t);
t += (splr->fromdate * splr->fromunits);
mactime = itdb_time_host_to_mac (t);
return (datecomp > mactime);
- case SPLACTION_IS_NOT_IN_THE_LAST:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_LAST:
time (&t);
t += (splr->fromdate * splr->fromunits);
mactime = itdb_time_host_to_mac (t);
return (datecomp <= mactime);
- case SPLACTION_IS_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_IN_THE_RANGE:
return ((datecomp <= splr->fromvalue &&
datecomp >= splr->tovalue) ||
(datecomp >= splr->fromvalue &&
datecomp <= splr->tovalue));
- case SPLACTION_IS_NOT_IN_THE_RANGE:
+ case ITDB_SPLACTION_IS_NOT_IN_THE_RANGE:
return ((datecomp < splr->fromvalue &&
datecomp < splr->tovalue) ||
(datecomp > splr->fromvalue &&
datecomp > splr->tovalue));
}
return FALSE;
- case splft_playlist:
+ case ITDB_SPLFT_PLAYLIST:
/* if we didn't find the playlist, just exit instead of
dealing with it */
if (playcomp == NULL) return FALSE;
switch(splr->action)
{
- case SPLACTION_IS_INT: /* is this track in this playlist? */
+ case ITDB_SPLACTION_IS_INT: /* is this track in this playlist? */
return (itdb_playlist_contains_track (playcomp, track));
- case SPLACTION_IS_NOT_INT:/* NOT in this playlist? */
+ case ITDB_SPLACTION_IS_NOT_INT:/* NOT in this playlist? */
return (!itdb_playlist_contains_track (playcomp, track));
}
return FALSE;
- case splft_unknown:
- g_return_val_if_fail (ft != splft_unknown, FALSE);
+ case ITDB_SPLFT_UNKNOWN:
+ g_return_val_if_fail (ft != ITDB_SPLFT_UNKNOWN, FALSE);
return FALSE;
default: /* new type: warning to change this code */
g_return_val_if_fail (FALSE, FALSE);
@@ -741,7 +741,7 @@ void itdb_spl_update (Itdb_Playlist *spl)
gboolean matchrules;
GList *gl;
- if (spl->splrules.match_operator == SPLMATCH_AND)
+ if (spl->splrules.match_operator == ITDB_SPLMATCH_AND)
matchrules = TRUE;
else matchrules = FALSE;
/* assume everything matches with no rules */
@@ -749,9 +749,9 @@ void itdb_spl_update (Itdb_Playlist *spl)
/* match all rules */
for (gl=spl->splrules.rules; gl; gl=gl->next)
{
- SPLRule* splr = gl->data;
+ Itdb_SPLRule* splr = gl->data;
gboolean ruletruth = itdb_splr_eval (splr, t);
- if (spl->splrules.match_operator == SPLMATCH_AND)
+ if (spl->splrules.match_operator == ITDB_SPLMATCH_AND)
{
if (!ruletruth)
{ /* one rule did not match -- we can stop */
@@ -759,7 +759,7 @@ void itdb_spl_update (Itdb_Playlist *spl)
break;
}
}
- else if (spl->splrules.match_operator == SPLMATCH_OR)
+ else if (spl->splrules.match_operator == ITDB_SPLMATCH_OR)
{
if (ruletruth)
{ /* one rule matched -- we can stop */
@@ -798,50 +798,50 @@ void itdb_spl_update (Itdb_Playlist *spl)
/* first, we sort the list */
switch(spl->splpref.limitsort)
{
- case LIMITSORT_RANDOM:
+ case ITDB_LIMITSORT_RANDOM:
sel_tracks = randomize_glist (sel_tracks);
break;
- case LIMITSORT_SONG_NAME:
+ case ITDB_LIMITSORT_SONG_NAME:
sel_tracks = g_list_sort (sel_tracks, (GCompareFunc)compTitle);
break;
- case LIMITSORT_ALBUM:
+ case ITDB_LIMITSORT_ALBUM:
sel_tracks = g_list_sort (sel_tracks, (GCompareFunc)compAlbum);
break;
- case LIMITSORT_ARTIST:
+ case ITDB_LIMITSORT_ARTIST:
sel_tracks = g_list_sort (sel_tracks, (GCompareFunc)compArtist);
break;
- case LIMITSORT_GENRE:
+ case ITDB_LIMITSORT_GENRE:
sel_tracks = g_list_sort (sel_tracks, (GCompareFunc)compGenre);
break;
- case LIMITSORT_MOST_RECENTLY_ADDED:
+ case ITDB_LIMITSORT_MOST_RECENTLY_ADDED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compMostRecentlyAdded);
break;
- case LIMITSORT_LEAST_RECENTLY_ADDED:
+ case ITDB_LIMITSORT_LEAST_RECENTLY_ADDED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compLeastRecentlyAdded);
break;
- case LIMITSORT_MOST_OFTEN_PLAYED:
+ case ITDB_LIMITSORT_MOST_OFTEN_PLAYED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compMostOftenPlayed);
break;
- case LIMITSORT_LEAST_OFTEN_PLAYED:
+ case ITDB_LIMITSORT_LEAST_OFTEN_PLAYED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compLeastOftenPlayed);
break;
- case LIMITSORT_MOST_RECENTLY_PLAYED:
+ case ITDB_LIMITSORT_MOST_RECENTLY_PLAYED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compMostRecentlyPlayed);
break;
- case LIMITSORT_LEAST_RECENTLY_PLAYED:
+ case ITDB_LIMITSORT_LEAST_RECENTLY_PLAYED:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compLeastRecentlyPlayed);
break;
- case LIMITSORT_HIGHEST_RATING:
+ case ITDB_LIMITSORT_HIGHEST_RATING:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compHighestRating);
break;
- case LIMITSORT_LOWEST_RATING:
+ case ITDB_LIMITSORT_LOWEST_RATING:
sel_tracks = g_list_sort (sel_tracks,
(GCompareFunc)compLowestRating);
break;
@@ -865,19 +865,19 @@ void itdb_spl_update (Itdb_Playlist *spl)
/* get the next song's value to add to running total */
switch (spl->splpref.limittype)
{
- case LIMITTYPE_MINUTES:
+ case ITDB_LIMITTYPE_MINUTES:
currentvalue = (double)(t->tracklen)/(60*1000);
break;
- case LIMITTYPE_HOURS:
+ case ITDB_LIMITTYPE_HOURS:
currentvalue = (double)(t->tracklen)/(60*60*1000);
break;
- case LIMITTYPE_MB:
+ case ITDB_LIMITTYPE_MB:
currentvalue = (double)(t->size)/(1024*1024);
break;
- case LIMITTYPE_GB:
+ case ITDB_LIMITTYPE_GB:
currentvalue = (double)(t->size)/(1024*1024*1024);
break;
- case LIMITTYPE_SONGS:
+ case ITDB_LIMITTYPE_SONGS:
currentvalue = 1;
break;
default:
@@ -956,46 +956,46 @@ void itdb_spl_update_live (Itdb_iTunesDB *itdb)
/**
* itdb_splr_validate:
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
*
* Validates a rule
**/
-void itdb_splr_validate (SPLRule *splr)
+void itdb_splr_validate (Itdb_SPLRule *splr)
{
- SPLActionType at;
+ ItdbSPLActionType at;
g_return_if_fail (splr != NULL);
at = itdb_splr_get_action_type (splr);
- g_return_if_fail (at != splat_unknown);
+ g_return_if_fail (at != ITDB_SPLAT_UNKNOWN);
switch (at)
{
- case splat_int:
- case splat_playlist:
- case splat_date:
- case splat_binary_and:
+ case ITDB_SPLAT_INT:
+ case ITDB_SPLAT_PLAYLIST:
+ case ITDB_SPLAT_DATE:
+ case ITDB_SPLAT_BINARY_AND:
splr->fromdate = 0;
splr->fromunits = 1;
splr->tovalue = splr->fromvalue;
splr->todate = 0;
splr->tounits = 1;
break;
- case splat_range_int:
- case splat_range_date:
+ case ITDB_SPLAT_RANGE_INT:
+ case ITDB_SPLAT_RANGE_DATE:
splr->fromdate = 0;
splr->fromunits = 1;
splr->todate = 0;
splr->tounits = 1;
break;
- case splat_inthelast:
- splr->fromvalue = SPLDATE_IDENTIFIER;
- splr->tovalue = SPLDATE_IDENTIFIER;
+ case ITDB_SPLAT_INTHELAST:
+ splr->fromvalue = ITDB_SPL_DATE_IDENTIFIER;
+ splr->tovalue = ITDB_SPL_DATE_IDENTIFIER;
splr->tounits = 1;
break;
- case splat_none:
- case splat_string:
+ case ITDB_SPLAT_NONE:
+ case ITDB_SPLAT_STRING:
splr->fromvalue = 0;
splr->fromdate = 0;
splr->fromunits = 0;
@@ -1003,8 +1003,8 @@ void itdb_splr_validate (SPLRule *splr)
splr->todate = 0;
splr->tounits = 0;
break;
- case splat_invalid:
- case splat_unknown:
+ case ITDB_SPLAT_INVALID:
+ case ITDB_SPLAT_UNKNOWN:
g_return_if_fail (FALSE);
break;
}
@@ -1014,11 +1014,11 @@ void itdb_splr_validate (SPLRule *splr)
/**
* itdb_splr_free:
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
*
* Frees the memory used by @splr
**/
-void itdb_splr_free (SPLRule *splr)
+void itdb_splr_free (Itdb_SPLRule *splr)
{
if (splr)
{
@@ -1030,12 +1030,12 @@ void itdb_splr_free (SPLRule *splr)
/**
* itdb_splr_remove:
* @pl: an #Itdb_Playlist
- * @splr: an SPLRule
+ * @splr: an Itdb_SPLRule
*
* Removes the smart playlist rule @splr from playlist @pl. The memory used by
* @splr is freed.
**/
-void itdb_splr_remove (Itdb_Playlist *pl, SPLRule *splr)
+void itdb_splr_remove (Itdb_Playlist *pl, Itdb_SPLRule *splr)
{
g_return_if_fail (pl);
g_return_if_fail (splr);
@@ -1047,14 +1047,14 @@ void itdb_splr_remove (Itdb_Playlist *pl, SPLRule *splr)
/**
* itdb_splr_add:
* @pl: an #Itdb_Playlist
- * @splr: an #SPLRule
+ * @splr: an #Itdb_SPLRule
* @pos: position of the rule
*
* Adds the smart rule @splr to @pl at position @pos. If @pos is -1, @splr gets
* appended to the end. After this call, @splr memory is managed by @pl, so
* you no longer need to call itdb_splr_free()
**/
-void itdb_splr_add (Itdb_Playlist *pl, SPLRule *splr, gint pos)
+void itdb_splr_add (Itdb_Playlist *pl, Itdb_SPLRule *splr, gint pos)
{
g_return_if_fail (pl);
g_return_if_fail (splr);
@@ -1069,15 +1069,15 @@ void itdb_splr_add (Itdb_Playlist *pl, SPLRule *splr, gint pos)
*
* Creates a new default smart rule
*
- * Return value: a new #SPLRule that must be freed with itdb_splr_free() when
+ * Return value: a new #Itdb_SPLRule that must be freed with itdb_splr_free() when
* no longer needed
**/
-SPLRule *itdb_splr_new (void)
+Itdb_SPLRule *itdb_splr_new (void)
{
- SPLRule *splr = g_new0 (SPLRule, 1);
+ Itdb_SPLRule *splr = g_new0 (Itdb_SPLRule, 1);
- splr->field = SPLFIELD_ARTIST;
- splr->action = SPLACTION_CONTAINS;
+ splr->field = ITDB_SPLFIELD_ARTIST;
+ splr->action = ITDB_SPLACTION_CONTAINS;
splr->fromvalue = 0;
splr->fromdate = 0;
splr->fromunits = 0;
@@ -1097,12 +1097,12 @@ SPLRule *itdb_splr_new (void)
* Creates a new smart rule and inserts it at position @pos in @pl. If @pos is
* -1, the new rule gets appended to the end.
*
- * Return value: pointer to the newly created #SPLRule. Its memory is handled
+ * Return value: pointer to the newly created #Itdb_SPLRule. Its memory is handled
* by @pl though, so you don't need to explicitly call itdb_splr_free() on it
**/
-SPLRule *itdb_splr_add_new (Itdb_Playlist *pl, gint pos)
+Itdb_SPLRule *itdb_splr_add_new (Itdb_Playlist *pl, gint pos)
{
- SPLRule *splr;
+ Itdb_SPLRule *splr;
g_return_val_if_fail (pl, NULL);
@@ -1111,14 +1111,14 @@ SPLRule *itdb_splr_add_new (Itdb_Playlist *pl, gint pos)
return splr;
}
-/* Duplicate SPLRule @splr */
-static SPLRule *splr_duplicate (SPLRule *splr)
+/* Duplicate Itdb_SPLRule @splr */
+static Itdb_SPLRule *splr_duplicate (Itdb_SPLRule *splr)
{
- SPLRule *dup = NULL;
+ Itdb_SPLRule *dup = NULL;
if (splr)
{
- dup = g_malloc (sizeof (SPLRule));
- memcpy (dup, splr, sizeof (SPLRule));
+ dup = g_malloc (sizeof (Itdb_SPLRule));
+ memcpy (dup, splr, sizeof (Itdb_SPLRule));
/* Now copy the strings */
dup->string = g_strdup (splr->string);
@@ -1163,7 +1163,7 @@ Itdb_Playlist *itdb_playlist_duplicate (Itdb_Playlist *pl)
/* Copy rules */
for (gl=pl->splrules.rules; gl; gl=gl->next)
{
- SPLRule *splr_dup = splr_duplicate (gl->data);
+ Itdb_SPLRule *splr_dup = splr_duplicate (gl->data);
pl_dup->splrules.rules = g_list_append (
pl_dup->splrules.rules, splr_dup);
}
@@ -1203,14 +1203,14 @@ void itdb_spl_copy_rules (Itdb_Playlist *dest, Itdb_Playlist *src)
g_list_free (dest->splrules.rules);
/* copy general spl settings */
- memcpy (&dest->splpref, &src->splpref, sizeof (SPLPref));
- memcpy (&dest->splrules, &src->splrules, sizeof (SPLRules));
+ memcpy (&dest->splpref, &src->splpref, sizeof (Itdb_SPLPref));
+ memcpy (&dest->splrules, &src->splrules, sizeof (Itdb_SPLRules));
dest->splrules.rules = NULL;
/* Copy rules */
for (gl=src->splrules.rules; gl; gl=gl->next)
{
- SPLRule *splr_dup = splr_duplicate (gl->data);
+ Itdb_SPLRule *splr_dup = splr_duplicate (gl->data);
dest->splrules.rules = g_list_append (
dest->splrules.rules, splr_dup);
}
@@ -1246,11 +1246,11 @@ Itdb_Playlist *itdb_playlist_new (const gchar *title, gboolean spl)
pl->splpref.liveupdate = TRUE;
pl->splpref.checkrules = TRUE;
pl->splpref.checklimits = FALSE;
- pl->splpref.limittype = LIMITTYPE_HOURS;
- pl->splpref.limitsort = LIMITSORT_RANDOM;
+ pl->splpref.limittype = ITDB_LIMITTYPE_HOURS;
+ pl->splpref.limitsort = ITDB_LIMITSORT_RANDOM;
pl->splpref.limitvalue = 2;
pl->splpref.matchcheckedonly = FALSE;
- pl->splrules.match_operator = SPLMATCH_AND;
+ pl->splrules.match_operator = ITDB_SPLMATCH_AND;
/* add at least one rule */
itdb_splr_add_new (pl, 0);
}
diff --git a/src/itdb_private.h b/src/itdb_private.h
index 8fcbcea..62d3fc3 100644
--- a/src/itdb_private.h
+++ b/src/itdb_private.h
@@ -142,8 +142,8 @@ struct _Itdb_DB{
typedef struct _Itdb_DB Itdb_DB;
-G_GNUC_INTERNAL gboolean itdb_spl_action_known (SPLAction action);
-G_GNUC_INTERNAL void itdb_splr_free (SPLRule *splr);
+G_GNUC_INTERNAL gboolean itdb_spl_action_known (ItdbSPLAction action);
+G_GNUC_INTERNAL void itdb_splr_free (Itdb_SPLRule *splr);
G_GNUC_INTERNAL const gchar *itdb_photodb_get_mountpoint (Itdb_PhotoDB *photodb);
G_GNUC_INTERNAL gchar *db_get_mountpoint (Itdb_DB *db);
G_GNUC_INTERNAL Itdb_Device *db_get_device(Itdb_DB *db);