#define MHOD_CATEGORY 9 // iTunes Music Store Podcast category
#define MHOD_COMPOSER 12
#define MHOD_GROUPING 13
#define MHOD_DESCRIPTION 14 // Podcast show notes text - accessible via the center iPod button
#define MHOD_ENCLOSUREURL 15 // Used by iTunes 4.9 for a Podcast's original enclosure URL
#define MHOD_RSSFEEDURL 16 // Used by iTunes 4.9 for a Podcast's RSS 2.0 feed URL
#define MHOD_CHAPTER 17 // M4A-style tagged data that is used to support subsongs/chapters
#define MHOD_SUBTITLE 18
#define MHOD_SHOW 19
#define MHOD_EPISODE 20
#define MHOD_TVNETWORK 21
#define MHOD_ALBUMARTIST 22
#define MHOD_ARTIST_SORT 23
#define MHOD_TITLE_SORT 27
#define MHOD_ALBUM_SORT 28
#define MHOD_ALBUMARTIST_SORT 29
#define MHOD_COMPOSER_SORT 30
#define MHOD_SHOW_SORT 31
#define MHOD_SPLPREF 50
#define MHOD_SPLDATA 51
#define MHOD_LIBRARY 52 // Found in the default hidden playlist
#define MHOD_LIBRARY_LETTER 53 // letter jump table
#define MHOD_PLAYLIST 100
#define MHOD_ALBUMLIST_ALBUM 200
#define MHOD_ALBUMLIST_ARTIST 201
#define MHOD_ALBUMLIST_ARTIST_SORT 202
#define MHOD_ALBUMLIST_PODCASTURL 203
#define MHOD_ALBUMLIST_SHOW 204
// Equalizer defines
#define EQ_NONE -1
#define EQ_ACOUSTIC 100
#define EQ_BASSBOOSTER 101
#define EQ_BASSREDUCER 102
#define EQ_CLASSICAL 103
#define EQ_DANCE 104
#define EQ_DEEP 105
#define EQ_ELECTRONIC 106
#define EQ_FLAT 107
#define EQ_HIPHOP 108
#define EQ_JAZZ 109
#define EQ_LATIN 110
#define EQ_LOUDNESS 111
#define EQ_LOUNGE 112
#define EQ_PIANO 113
#define EQ_POP 114
#define EQ_RNB 115
#define EQ_ROCK 116
#define EQ_SMALLSPEAKERS 117
#define EQ_SPOKENWORD 118
#define EQ_TREBLEBOOSTER 119
#define EQ_TREBLEREDUCER 120
#define EQ_VOCALBOOSTER 121
// Smart Playlist stuff
#define SPLMATCH_AND 0 // AND rule - all of the rules must be true in order for the combined rule to be applied
#define SPLMATCH_OR 1 // OR rule
// Limit Types.. like limit playlist to 100 minutes or to 100 songs
#define LIMITTYPE_MINUTES 0x01
#define LIMITTYPE_MB 0x02
#define LIMITTYPE_SONGS 0x03
#define LIMITTYPE_HOURS 0x04
#define LIMITTYPE_GB 0x05
// 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 'limitsort_opposite' flag set. This is the same value as the
// "positive" value (i.e. 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.
//
// 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 frickin' annoying.
#define LIMITSORT_RANDOM 0x02
#define LIMITSORT_SONG_NAME 0x03
#define LIMITSORT_ALBUM 0x04
#define LIMITSORT_ARTIST 0x05
#define LIMITSORT_GENRE 0x07
#define LIMITSORT_MOST_RECENTLY_ADDED 0x10
#define LIMITSORT_COMPOSER 0x12 // Not used by iTunes, but inferred from the Type 52 MHOD's Composer type
#define LIMITSORT_LEAST_RECENTLY_ADDED 0x80000010 // See note above
#define LIMITSORT_MOST_OFTEN_PLAYED 0x14
#define LIMITSORT_LEAST_OFTEN_PLAYED 0x80000014 // See note above
#define LIMITSORT_MOST_RECENTLY_PLAYED 0x15
#define LIMITSORT_LEAST_RECENTLY_PLAYED 0x80000015 // See note above
#define LIMITSORT_HIGHEST_RATING 0x17
#define LIMITSORT_LOWEST_RATING 0x80000017 // See note above
// Smartlist Actions - Used in the rules.
/*
reallythisisabitmappedfield...
highbyte
bit0="string"valuesifset,"int"valuesifnotset
bit1="not",ortonegatethecheck.
lower2bytes
bit0=simple"IS"query
bit1=contains
bit2=beginswith
bit3=endswith
bit4=greaterthan
bit5=unknown,butprobablygreaterthanorequalto
bit6=lessthan
bit7=unknown,butprobablylessthanorequalto
bit8=arangeselection
bit9="in the last"
*/
#define SPLACTION_IS_INT 0x00000001 // Also called "Is Set" in iTunes
#define SPLACTION_IS_GREATER_THAN 0x00000010 // Also called "Is After" in iTunes
#define SPLACTION_IS_LESS_THAN 0x00000040 // Also called "Is Before" in iTunes
#define SPLACTION_IS_IN_THE_RANGE 0x00000100
#define SPLACTION_IS_IN_THE_LAST 0x00000200
#define SPLACTION_BINARY_AND 0x00000400
#define SPLACTION_IS_STRING 0x01000001
#define SPLACTION_CONTAINS 0x01000002
#define SPLACTION_STARTS_WITH 0x01000004
#define SPLACTION_ENDS_WITH 0x01000008
#define SPLACTION_IS_NOT_INT 0x02000001 // Also called "Is Not Set" in iTunes
#define SPLACTION_IS_NOT_GREATER_THAN 0x02000010 // Note: Not available in iTunes
#define SPLACTION_IS_NOT_LESS_THAN 0x02000040 // Note: Not available in iTunes
#define SPLACTION_IS_NOT_IN_THE_RANGE 0x02000100 // Note: Not available in iTunes
#define SPLACTION_IS_NOT_IN_THE_LAST 0x02000200
#define SPLACTION_UNKNOWN2 0x02000800
#define SPLACTION_IS_NOT 0x03000001
#define SPLACTION_DOES_NOT_CONTAIN 0x03000002
#define SPLACTION_DOES_NOT_START_WITH 0x03000004 // Note: Not available in iTunes
#define SPLACTION_DOES_NOT_END_WITH 0x03000008 // Note: Not available in iTunes
// 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 might.
#define SPLACTION_LAST_DAYS_VALUE 86400 // number of seconds in 24 hours
#define SPLACTION_LAST_WEEKS_VALUE 604800 // number of seconds in 7 days
#define SPLACTION_LAST_MONTHS_VALUE 2628000 // number of seconds in 30.4167 days ~= 1 month
// Hey, why limit ourselves to what iTunes can do? If the iPod can deal with it, excellent!
#define SPLACTION_LAST_SECONDS_RULE 1 // one second
#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
// 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
// Smartlist fields - Used for rules.
#define SPLFIELD_SONG_NAME 0x02 // String
#define SPLFIELD_ALBUM 0x03 // String
#define SPLFIELD_ARTIST 0x04 // String
#define SPLFIELD_BITRATE 0x05 // Int (e.g. from/to = 128)
#define SPLFIELD_SAMPLE_RATE 0x06 // Int (e.g. from/to = 44100)
#define SPLFIELD_YEAR 0x07 // Int (e.g. from/to = 2004)
#define SPLFIELD_GENRE 0x08 // String
#define SPLFIELD_KIND 0x09 // String
#define SPLFIELD_DATE_MODIFIED 0x0a // Int/Mac Timestamp (e.g. from/to = bcf93280 == is before 6/19/2004)
#define SPLFIELD_TRACKNUMBER 0x0b // Int (e.g. from = 1, to = 2)
#define SPLFIELD_SIZE 0x0c // Int (e.g. from/to = 0x00600000 for 6MB)
#define SPLFIELD_TIME 0x0d // Int (e.g. from/to = 83999 for 1:23/83 seconds)
#define SPLFIELD_COMMENT 0x0e // String
#define SPLFIELD_DATE_ADDED 0x10 // Int/Mac Timestamp (e.g. from/to = bcfa83ff == is after 6/19/2004)
#define SPLFIELD_COMPOSER 0x12 // String
#define SPLFIELD_PLAYCOUNT 0x16 // Int (e.g. from/to = 1)
#define SPLFIELD_LAST_PLAYED 0x17 // Int/Mac Timestamp (e.g. from = bcfa83ff (6/19/2004), to = 0xbcfbd57f (6/20/2004))
#define SPLFIELD_DISC_NUMBER 0x18 // Int (e.g. from/to = 1)
uint32_tlastmodifiedtime;// iTunes sets this the UTC time value for the Windows Last Modified timestamp
uint32_tsize;
uint32_tlength;
uint32_ttracknum;
uint32_ttotaltracks;
uint32_tyear;
uint32_tbitrate;
uint16_tsamplerate;
uint16_tsamplerate_fixedpoint;
uint32_tvolume;
uint32_tstarttime;
uint32_tstoptime;
uint32_tsoundcheck;
uint32_tplaycount;
uint32_tplaycount2;// Seems to always be the same as playcount(?!?)
uint32_tlastplayedtime;
uint32_tcdnum;
uint32_ttotalcds;
uint32_tuserID;// Apple Store User ID
uint32_taddedtime;// iTunes sets this to the UTC time value for when the file was added to the iTunes library
uint32_tbookmarktime;
uint64_tdbid;// 64 bit value that identifies this mhit across iPod databases. iTunes increments this by 1 for each additional song. (previously unk7 and unk8)
uint32_tBPM;
uint32_tapp_rating;// The rating set by the application, as opposed to the rating set on the iPod itself
uint8_tchecked;// a "checked" song has the value of 0, a non-checked song is 1
uint16_tunk9;// Seems to always be 0xffff...
uint16_tartworkcount;// Number of artwork files attached to this song
uint32_tartworksize;// Size of all artwork files attached to this song, in bytes. (was unk10);
uint32_tunk11;
floatsamplerate2;
uint32_treleasedtime;
uint32_tunk14;
uint32_tunk15;
uint32_tunk16;
/* --- */
uint32_tskipcount;
uint32_tskippedtime;
uint8_thasArtwork;
uint8_tskipShuffle;
uint8_trememberPosition;
uint8_tunk19;
uint64_tdbid2;// same as dbid?
uint8_tlyrics_flag;
uint8_tmovie_flag;
uint8_tmark_unplayed;
uint8_tunk20;
uint32_tunk21;
uint32_tpregap;
uint64_tsamplecount;
uint32_tunk25;
uint32_tpostgap;
uint32_tunk27;
uint32_tmediatype;
uint32_tseasonNumber;
uint32_tepisodeNumber;
uint32_tunk31;
uint32_tunk32;
uint32_tunk33;
uint32_tunk34;
uint32_tunk35;
uint32_tunk36;
/* --- */
uint32_tunk37;
uint32_tgaplessData;
uint32_tunk39;
uint16_talbumgapless;
uint16_ttrackgapless;
uint32_tunk40;
uint32_tunk41;
uint32_tunk42;
uint32_tunk43;
uint32_tunk44;
uint32_tunk45;
uint32_tunk46;
uint32_talbum_id;
uint32_tunk48;
uint32_tunk49;
uint32_tunk50;
uint32_tunk51;
uint32_tunk52;
uint32_tunk53;
uint32_tunk54;
uint32_tunk55;
uint32_tunk56;
/* --- */
// 22 bytes of unknown (we'll just write back zeroes)
uint32_tmhii_link;// TODO: benski> figure this thing out
// 32 more bytes of unknown (we'll just write back zeroes)
/* benski> this is a hack. i'm putting this in here so we can retrieve album art from the transfer thread and add it in the main thread
itdoesn'treallybelongaspartofthisobject,though!*/
// protect these members, so stuff doesn't fuck up my cache
protected:
std::vector<iPod_mhod*>mhod;
iPod_mhod*mhodcache[25];
};
// MHLP: playlist container - parent of MHYP, child of MHSD
// Important note: Playlist zero must always be the default playlist, containing every
// track in the DB. To do this, always call "GetDefaultPlaylist()" before you create any
// other playlists, if you start from scratch.
// After you're done adding/deleting tracks in the database, and just before you call
// write(), do the following: GetDefaultPlaylist()->PopulatePlaylist(ptr_to_mhlt);