commit 4d167cd06cb70705f69df454f6a67c1bc3d98aaa
Author: Christophe Fergeau <[email protected]>
Date:   Mon Nov 16 20:51:49 2009 +0100

    mhsd type 5 is not a list of purchases
    
    It was initially thought that mhsd type 5 contains some smart
    playlists to easily group various purchased items in iTunes,
    but further investigation proved that wrong. Rename all occurrences
    of "purchase" to "mhsd5" to avoid confusion :)

 src/itdb_itunesdb.c |   18 +++++++++---------
 src/itdb_playlist.c |    6 +++---
 src/itdb_private.h  |   28 ++++++++++++++--------------
 3 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index ad4569b..83ecbe2 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -2037,7 +2037,7 @@ static glong get_playlist (FImport *fimp, guint 
mhsd_type, glong mhyp_seek)
   plitem->podcastflag = get16lint (cts, mhyp_seek+42);
   plitem->sortorder = get32lint (cts, mhyp_seek+44);
   if (header_len >= 0x6C) {
-      plitem->priv->purchase_type = get16lint (cts, mhyp_seek+0x50);
+      plitem->priv->mhsd5_type = get16lint (cts, mhyp_seek+0x50);
   }
 
   mhod_seek = mhyp_seek + header_len;
@@ -2157,7 +2157,7 @@ static glong get_playlist (FImport *fimp, guint 
mhsd_type, glong mhyp_seek)
 
   /* add new playlist */
   if (mhsd_type == 5) {
-      itdb_playlist_add_to_purchases (fimp->itdb, plitem, -1);
+      itdb_playlist_add_mhsd5_playlist (fimp->itdb, plitem, -1);
   } else {
       itdb_playlist_add (fimp->itdb, plitem, -1);
   }
@@ -5200,11 +5200,11 @@ static gboolean write_playlist (FExport *fexp,
     if (mhsd_type == 5) {
         put32_n0 (cts, 8);            /* ?                         */
         /* +0x50 */
-        put16lint (cts, pl->priv->purchase_type);
-        put16lint (cts, pl->priv->purchase_type); /* same as 0x50 ? */
+        put16lint (cts, pl->priv->mhsd5_type);
+        put16lint (cts, pl->priv->mhsd5_type); /* same as 0x50 ? */
         /* +0x54 */
-        if ((pl->priv->purchase_type == ITDB_PLAYLIST_PURCHASE_MOVIE_RENTALS)
-             || (pl->priv->purchase_type == ITDB_PLAYLIST_PURCHASE_RINGTONES)){
+        if ((pl->priv->mhsd5_type == ITDB_PLAYLIST_MHSD5_MOVIE_RENTALS)
+             || (pl->priv->mhsd5_type == ITDB_PLAYLIST_MHSD5_RINGTONES)){
             put32lint (cts, 1); /* unknown, 1 for Movie rentals + Ringtones */
         } else {
             put32lint (cts, 0); /* 0 otherwise */
@@ -5292,7 +5292,7 @@ static gboolean write_mhsd_playlists (FExport *fexp, 
guint32 mhsd_type)
     mhlp_seek = cts->pos;
     mk_mhlp (fexp);
     if (mhsd_type == 5) {
-        playlists = fexp->itdb->priv->purchase_playlists;
+        playlists = fexp->itdb->priv->mhsd5_playlists;
     } else {
         playlists = fexp->itdb->playlists;
     }
@@ -5648,12 +5648,12 @@ static gboolean itdb_write_file_internal (Itdb_iTunesDB 
*itdb,
        goto err;
     }
 
-    /* write purchase playlists (mhsd type 5) */
+    /* write mhsd5 playlists */
     if (!fexp->error && !write_mhsd_playlists (fexp, 5)) {
        g_set_error (&fexp->error,
                     ITDB_FILE_ERROR,
                     ITDB_FILE_ERROR_ITDB_CORRUPT,
-                    _("Error writing purchase playlists (mhsd type 5)"));
+                    _("Error writing mhsd5 playlists"));
        goto err;
     }
 
diff --git a/src/itdb_playlist.c b/src/itdb_playlist.c
index d8dc5b9..7a115b9 100644
--- a/src/itdb_playlist.c
+++ b/src/itdb_playlist.c
@@ -1307,10 +1307,10 @@ static void itdb_playlist_add_internal (Itdb_iTunesDB 
*itdb, Itdb_Playlist *pl,
     *playlists = g_list_insert (*playlists, pl, pos);
 }
 
-void itdb_playlist_add_to_purchases (Itdb_iTunesDB *itdb, Itdb_Playlist *pl,
-                                     gint32 pos)
+void itdb_playlist_add_mhsd5_playlist (Itdb_iTunesDB *itdb, Itdb_Playlist *pl,
+                                       gint32 pos)
 {
-    itdb_playlist_add_internal (itdb, pl, pos, 
&itdb->priv->purchase_playlists);
+    itdb_playlist_add_internal (itdb, pl, pos, &itdb->priv->mhsd5_playlists);
 }
 
 /**
diff --git a/src/itdb_private.h b/src/itdb_private.h
index 2009f56..0532fe3 100644
--- a/src/itdb_private.h
+++ b/src/itdb_private.h
@@ -164,20 +164,20 @@ struct _Itdb_Item_Id {
 };
 typedef struct _Itdb_Item_Id Itdb_Item_Id;
 
-enum _Itdb_Playlist_Purchase_Type {
-    ITDB_PLAYLIST_PURCHASE_NONE          = 0,
-    ITDB_PLAYLIST_PURCHASE_MOVIES        = 2,
-    ITDB_PLAYLIST_PURCHASE_TV_SHOWS      = 3,
-    ITDB_PLAYLIST_PURCHASE_MUSIC         = 4,
-    ITDB_PLAYLIST_PURCHASE_AUDIOBOOKS    = 5,
-    ITDB_PLAYLIST_PURCHASE_RINGTONES     = 6,
-    ITDB_PLAYLIST_PURCHASE_MOVIE_RENTALS = 7
+enum _Itdb_Playlist_Mhsd5_Type {
+    ITDB_PLAYLIST_MHSD5_NONE          = 0,
+    ITDB_PLAYLIST_MHSD5_MOVIES        = 2,
+    ITDB_PLAYLIST_MHSD5_TV_SHOWS      = 3,
+    ITDB_PLAYLIST_MHSD5_MUSIC         = 4,
+    ITDB_PLAYLIST_MHSD5_AUDIOBOOKS    = 5,
+    ITDB_PLAYLIST_MHSD5_RINGTONES     = 6,
+    ITDB_PLAYLIST_MHSD5_MOVIE_RENTALS = 7
 };
-typedef enum _Itdb_Playlist_Purchase_Type Itdb_Playlist_Purchase_Type;
+typedef enum _Itdb_Playlist_Mhsd5_Type Itdb_Playlist_Mhsd5_Type;
 
 struct _Itdb_iTunesDB_Private
 {
-    GList *purchase_playlists;
+    GList *mhsd5_playlists;
     guint16 unk_0x22;
     guint64 id_0x24;
     guint16 lang;
@@ -198,12 +198,12 @@ struct _Itdb_Track_Private {
 };
 
 struct _Itdb_Playlist_Private {
-    Itdb_Playlist_Purchase_Type purchase_type;
+    Itdb_Playlist_Mhsd5_Type mhsd5_type;
 };
 
-G_GNUC_INTERNAL void itdb_playlist_add_to_purchases (Itdb_iTunesDB *itdb,
-                                                     Itdb_Playlist *pl,
-                                                     gint32 pos);
+G_GNUC_INTERNAL void itdb_playlist_add_mhsd5_playlist(Itdb_iTunesDB *itdb,
+                                                      Itdb_Playlist *pl,
+                                                      gint32 pos);
 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);

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to