diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-06-17 08:44:07 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2007-06-17 08:44:07 +0000 |
commit | 7805f17f3460425b590b68bf7770b6a45a111f1c (patch) | |
tree | 7313aa65bc5ad474923db2ec3d0003f9a4de0611 | |
parent | c7fe94a0b9b77c65d208d21c94feb8578eff7a50 (diff) | |
download | libgpod-7805f17f3460425b590b68bf7770b6a45a111f1c.tar.gz libgpod-7805f17f3460425b590b68bf7770b6a45a111f1c.tar.xz libgpod-7805f17f3460425b590b68bf7770b6a45a111f1c.zip |
* src/itdb_itunesdb.c
src/itdb.h: libgpod will not change the values for sort_artist.
Furthermore, libgpod reads the stored values of
sort_artist/_album... from the iTunesDB and makes them available
through the Itdb_Track structure. Applications should modify
these values along with the corresponding artist/album... fields
if a particular sort order is required.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1549 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/itdb.h | 31 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 22 |
3 files changed, 38 insertions, 25 deletions
@@ -1,3 +1,13 @@ +2007-06-17 Jorg Schuler <jcsjcs at users.sourceforge.net> + + * src/itdb_itunesdb.c + src/itdb.h: libgpod will not change the values for sort_artist. + Furthermore, libgpod reads the stored values of + sort_artist/_album... from the iTunesDB and makes them available + through the Itdb_Track structure. Applications should modify + these values along with the corresponding artist/album... fields + if a particular sort order is required. + 2007-06-14 Jorg Schuler <jcsjcs at users.sourceforge.net> * po/es.po: new version updated by Alejandro Lamas DaviƱa. @@ -723,27 +723,26 @@ struct _Itdb_Track gchar *albumartist; /* see note for MHOD_ID in itdb_itunesdb.c */ gchar *keywords; /* see note for MHOD_ID in itdb_itunesdb.c */ /* the following 6 are new in libgpod 0.5.0... */ - /* You can set these strings to override the standard sortorder - suggested by libgpod. When set they take precedence over the - default 'artist', 'album'... fields. - - When reading the iTunesDB these fields are discarded, so you will - have to set them again before writing the iTunesDB. - - libgpod will automatically create an entry in the iTunesDB (but - not below) for sort_artist if 'artist' is something like "The - Artist" and sort_artist wasn't set by the application. In that - case 'Artist, The' followed by five 0x01 characters is used for - sorting and written to the iTunesDB. Why five 0x01 characters are - added is not completely understood, but analogous to what iTunes - does. libgpod will _not_ change the six fields below, however. */ - gchar *sort_artist; /* artist name (for sorting) */ + /* You can set these strings to override the standard + sortorder. When set they take precedence over the default + 'artist', 'album'... fields. + + For example, in the case of an artist name like "The Artist", + iTunes will set sort_artist to "Artist, The" followed by five + 0x01 characters. Why five 0x01 characters are added is not + completely understood. + + If you do not set the sort_artist field, libgpod will pre-sort + the lists displayed by the iPod according to "Artist, The", + without setting the field. + */ + gchar *sort_artist; /* artist (for sorting) */ gchar *sort_title; /* title (for sorting) */ gchar *sort_album; /* album (for sorting) */ gchar *sort_albumartist; /* album artist (for sorting) */ gchar *sort_composer; /* composer (for sorting) */ gchar *sort_tvshow; /* tv show (for sorting) */ -/* ... to here */ +/* new fields in libgpod 0.5.0 up to here */ guint32 id; /* unique ID of track */ gint32 size; /* size of file in bytes */ gint32 tracklen; /* Length of track in ms */ diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 779fb88..7803def 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -2371,15 +2371,22 @@ static glong get_mhit (FImport *fimp, glong mhit_seek) track->keywords = entry_utf8; break; case MHOD_ID_SORT_ARTIST: + track->sort_artist = entry_utf8; + break; case MHOD_ID_SORT_TITLE: + track->sort_title = entry_utf8; + break; case MHOD_ID_SORT_ALBUM: + track->sort_album = entry_utf8; + break; case MHOD_ID_SORT_ALBUMARTIST: + track->sort_albumartist = entry_utf8; + break; case MHOD_ID_SORT_COMPOSER: + track->sort_composer = entry_utf8; + break; case MHOD_ID_SORT_TVSHOW: - /* we don't read those -- the application has to set - them before each export / libgpod will create the - sort_artist field before each export if not set */ - g_free (entry_utf8); + track->sort_tvshow = entry_utf8; break; case MHOD_ID_SPLPREF: case MHOD_ID_SPLRULES: @@ -4209,7 +4216,6 @@ static gboolean write_mhsd_tracks (FExport *fexp) guint32 mhod_num = 0; gulong mhit_seek = cts->pos; MHODData mhod; - gchar *str; g_return_val_if_fail (track, FALSE); @@ -4349,14 +4355,12 @@ static gboolean write_mhsd_tracks (FExport *fexp) mk_mhod (fexp, &mhod); ++mhod_num; } - str = get_sort_artist (track); - if (str) + if (track->sort_artist && *track->sort_artist) { mhod.type = MHOD_ID_SORT_ARTIST; - mhod.data.string = str; + mhod.data.string = track->sort_artist; mk_mhod (fexp, &mhod); ++mhod_num; - g_free (str); } if (track->sort_title && *track->sort_title) { |