diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2005-10-02 13:22:11 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2005-10-02 13:22:11 +0000 |
commit | 1e6147b63567fd2c0f424dda4a05323b21991f03 (patch) | |
tree | d85a51229542eb10156c2880c307fff9ff4444ab | |
parent | 88f9ebce8c86fb6bb1c451973b47f045ce9fa079 (diff) | |
download | libgpod-1e6147b63567fd2c0f424dda4a05323b21991f03.tar.gz libgpod-1e6147b63567fd2c0f424dda4a05323b21991f03.tar.xz libgpod-1e6147b63567fd2c0f424dda4a05323b21991f03.zip |
* Makefile.am: added bindings/... to EXTRA_DIST
* src/itdb.h, src/itdb_playlist.h, src/itdb_private.h: made enum
ItdbPlType and enum ItdbPlFlag private and introduced
itdb_playlist_set_mpl/_podcast() in addition to the existing
itdb_playlist_is_mpl/_podcast() which make the public enums
unecessary.
* bumped to version 107
* src/ithumb-writer.c: itdb_write_ithumb_files (): commented out
g_print() statement as this produced an empty line in gtkpod's
warning window.
* src/Makefile.am: GDKPIXPUF dependency solved inside source files
-- db-artwork-writer-dummy.c no longer required. Now compiles
with and without gdkpixbuf.
* configure.ac: fixed error in AC_DEFINE_UNQUOTED(HAVE_GDKPIXBUF).
* tests/test-covers.c: attached Flavio Stanchina size-patch
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1112 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/db-artwork-writer-dummy.c | 34 | ||||
-rw-r--r-- | src/db-artwork-writer.c | 12 | ||||
-rw-r--r-- | src/itdb.h | 32 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 7 | ||||
-rw-r--r-- | src/itdb_playlist.c | 22 | ||||
-rw-r--r-- | src/itdb_private.h | 18 | ||||
-rw-r--r-- | src/ithumb-writer.c | 15 | ||||
-rw-r--r-- | tests/test-covers.c | 39 |
12 files changed, 148 insertions, 80 deletions
@@ -1,3 +1,26 @@ +2005-10-02 Jorg Schuler <jcsjcs at users.sourceforge.net> + + * Makefile.am: added bindings/... to EXTRA_DIST + + * src/itdb.h, src/itdb_playlist.h, src/itdb_private.h: made enum + ItdbPlType and enum ItdbPlFlag private and introduced + itdb_playlist_set_mpl/_podcast() in addition to the existing + itdb_playlist_is_mpl/_podcast() which make the public enums + unecessary. + + * bumped to version 107 + + * src/ithumb-writer.c: itdb_write_ithumb_files (): commented out + g_print() statement as this produced an empty line in gtkpod's + warning window. + + * src/Makefile.am: GDKPIXPUF dependency solved inside source files + -- db-artwork-writer-dummy.c no longer required. Now compiles + with and without gdkpixbuf. + + * configure.ac: fixed error in AC_DEFINE_UNQUOTED(HAVE_GDKPIXBUF). + * tests/test-covers.c: attached Flavio Stanchina size-patch + 2005-09-29 Jorg Schuler <jcsjcs at users.sourceforge.net> * applied Chrisophe's patch to make libgdk optional diff --git a/Makefile.am b/Makefile.am index 76e7436..cdee804 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,11 +3,17 @@ SUBDIRS=src tests po pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgpod-1.0.pc +# the bindings/ below are just a hack until a better way is found EXTRA_DIST = \ intltool-merge.in \ intltool-update.in \ intltool-extract.in \ - libgpod-1.0.pc.in + libgpod-1.0.pc.in \ + bindings/python/examples/play.py \ + bindings/python/examples/tag-genre-from-audioscrobber.py \ + bindings/python/Makefile \ + bindings/python/gpod.i + DISTCLEANFILES = \ intltool-extract \ diff --git a/configure.ac b/configure.ac index 2db2349..8670f7c 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AM_CONFIG_HEADER(config.h) # LIBGPOD_MAJOR_VERSION=0 LIBGPOD_MINOR_VERSION=1 -LIBGPOD_MICRO_VERSION=6 +LIBGPOD_MICRO_VERSION=7 LIBGPOD_INTERFACE_AGE=0 # If you need a modifier for the version number. # Normally empty, but can be used to make "fixup" releases. @@ -57,10 +57,14 @@ LIBGPOD_CFLAGS="$LIBGPOD_CFLAGS -Wall" AC_SUBST(LIBGPOD_CFLAGS) AC_SUBST(LIBGPOD_LIBS) +dnl ************************************************** +dnl * GDKPIXBUF is optional +dnl ************************************************** +AH_TEMPLATE([HAVE_GDKPIXBUF], [Whether gdk-pixbuf is installed, ArtworkDB writing support will be disabled if it can't be found]) PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0, have_gdkpixbuf=yes, have_gdkpibux=no) AM_CONDITIONAL(HAVE_GDKPIXBUF, test x"$have_gdkpixbuf" = xyes) -if test x"have_gdkpixbuf" = xyes; then - AC_DEFINE_UNQUOTED(HAVE_GDKPIXBUF,1, [Whether gdk-pixbuf is installed, ArtworkDB writing support will be disabled if it can't be found]) +if test x"$have_gdkpixbuf" = xyes; then + AC_DEFINE_UNQUOTED(HAVE_GDKPIXBUF, 1) fi AC_SUBST(GDKPIXBUF_CFLAGS) AC_SUBST(GDKPIXBUF_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index ee75854..dff33d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,4 @@ lib_LTLIBRARIES = libgpod.la -if HAVE_GDKPIXBUF -ARTWORKDB_WRITER_FILES= db-artwork-writer.c ithumb-writer.c -else -ARTWORKDB_WRITER_FILES= db-artwork-writer-dummy.c -endif libgpod_la_SOURCES = \ itdb.h \ @@ -19,7 +14,8 @@ libgpod_la_SOURCES = \ db-artwork-debug.h \ db-image-parser.c \ db-image-parser.h \ - $(ARTWORKDB_WRITER_FILES) + db-artwork-writer.c \ + ithumb-writer.c libgpod_la_headers = itdb.h diff --git a/src/db-artwork-writer-dummy.c b/src/db-artwork-writer-dummy.c deleted file mode 100644 index f72b996..0000000 --- a/src/db-artwork-writer-dummy.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2005 Christophe Fergeau - * - * - * The code contained in this file is free software; you can redistribute - * it and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either version - * 2.1 of the License, or (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this code; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * iTunes and iPod are trademarks of Apple - * - * This product is not supported/written/published by Apple! - * - */ - -#include <config.h> - -#include "itdb.h" -#include "db-artwork-parser.h" - -int -ipod_write_artwork_db (Itdb_iTunesDB *db, const char *mount_point) -{ - return -1; -} diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c index c87bffa..ca46417 100644 --- a/src/db-artwork-writer.c +++ b/src/db-artwork-writer.c @@ -23,9 +23,12 @@ */ #include <config.h> +#include "itdb.h" +#include "db-artwork-parser.h" + +#if HAVE_GDKPIXBUF #include "db-artwork-debug.h" -#include "db-artwork-parser.h" #include "db-itunes-parser.h" #include "db-image-parser.h" @@ -774,3 +777,10 @@ ipod_write_artwork_db (Itdb_iTunesDB *db, const char *mount_point) g_free (filename); return 0; } +#else +int +ipod_write_artwork_db (Itdb_iTunesDB *db, const char *mount_point) +{ + return -1; +} +#endif @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-09-26 22:36:42 jcs> +/* Time-stamp: <2005-10-02 18:56:10 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -47,22 +47,6 @@ /* one star is how much (track->rating) */ #define ITDB_RATING_STEP 20 -/* always use itdb_playlist_is_mpl() to check for MPL! */ -enum ItdbPlType { /* types for playlist->type */ - ITDB_PL_TYPE_NORM = 0, /* normal playlist, visible in iPod */ - ITDB_PL_TYPE_MPL = 1 /* master playlist, contains all tracks, - not visible in iPod */ -}; - -/* always use itdb_playlists_is_podcasts() to check for podcasts PL */ -enum ItdbPlFlag { /* types for playlist->podcastflag */ - ITDB_PL_FLAG_NORM = 0, /* normal playlist, visible under - 'Playlists */ - ITDB_PL_FLAG_PODCASTS = 1 /* special podcast playlist visible - under 'Music' */ -}; - - /* 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 @@ -700,16 +684,22 @@ void itdb_playlist_add_track (Itdb_Playlist *pl, Itdb_Playlist *itdb_playlist_by_id (Itdb_iTunesDB *itdb, guint64 id); Itdb_Playlist *itdb_playlist_by_nr (Itdb_iTunesDB *itdb, guint32 num); Itdb_Playlist *itdb_playlist_by_name (Itdb_iTunesDB *itdb, gchar *name); -gboolean itdb_playlist_is_mpl (Itdb_Playlist *pl); -gboolean itdb_playlist_is_podcasts (Itdb_Playlist *pl); -Itdb_Playlist *itdb_playlist_mpl (Itdb_iTunesDB *itdb); -Itdb_Playlist *itdb_playlist_podcasts (Itdb_iTunesDB *itdb); gboolean itdb_playlist_contains_track (Itdb_Playlist *pl, Itdb_Track *track); guint32 itdb_playlist_contain_track_number (Itdb_Track *tr); void itdb_playlist_remove_track (Itdb_Playlist *pl, Itdb_Track *track); guint32 itdb_playlist_tracks_number (Itdb_Playlist *pl); void itdb_playlist_randomize (Itdb_Playlist *pl); +/* playlist functions for master playlist */ +Itdb_Playlist *itdb_playlist_mpl (Itdb_iTunesDB *itdb); +gboolean itdb_playlist_is_mpl (Itdb_Playlist *pl); +void itdb_playlist_set_mpl (Itdb_Playlist *pl); + +/* playlist functions for podcast playlist */ +Itdb_Playlist *itdb_playlist_podcasts (Itdb_iTunesDB *itdb); +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); diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 9616030..f5f1bd6 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-09-26 22:40:51 jcs> +/* Time-stamp: <2005-10-02 20:14:55 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -3565,8 +3565,11 @@ gboolean itdb_write (Itdb_iTunesDB *itdb, const gchar *mp, GError **error) * Errors happening during that operation are considered non fatal since * they shouldn't corrupt the main database. */ + +#if HAVE_GDKPIXBUF ipod_write_artwork_db (itdb, mp); - +#endif + itunes_path = itdb_resolve_path (mp, db); if(!itunes_path) diff --git a/src/itdb_playlist.c b/src/itdb_playlist.c index 96736de..4838377 100644 --- a/src/itdb_playlist.c +++ b/src/itdb_playlist.c @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-09-29 21:04:45 jcs> +/* Time-stamp: <2005-10-02 18:56:09 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -1235,7 +1235,7 @@ gboolean itdb_playlist_is_mpl (Itdb_Playlist *pl) { g_return_val_if_fail (pl, FALSE); - return (pl->type == ITDB_PL_TYPE_MPL); + return ((pl->type & 0xff) == ITDB_PL_TYPE_MPL); } @@ -1248,6 +1248,24 @@ gboolean itdb_playlist_is_podcasts (Itdb_Playlist *pl) } +/* set playlist to MPL */ +void itdb_playlist_set_mpl (Itdb_Playlist *pl) +{ + g_return_if_fail (pl); + + pl->type = ITDB_PL_TYPE_MPL; +} + + +/* set playlist to Podcasts */ +void itdb_playlist_set_podcasts (Itdb_Playlist *pl) +{ + g_return_if_fail (pl); + + pl->podcastflag = ITDB_PL_FLAG_PODCASTS; +} + + /* return the master playlist of @itdb */ Itdb_Playlist *itdb_playlist_mpl (Itdb_iTunesDB *itdb) { diff --git a/src/itdb_private.h b/src/itdb_private.h index 3e6235e..ab7e312 100644 --- a/src/itdb_private.h +++ b/src/itdb_private.h @@ -1,4 +1,4 @@ -/* Time-stamp: <2005-09-26 22:40:20 jcs> +/* Time-stamp: <2005-10-02 18:34:56 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -36,6 +36,22 @@ #include "itdb.h" +/* always use itdb_playlist_is_mpl() to check for MPL! */ +enum ItdbPlType { /* types for playlist->type */ + ITDB_PL_TYPE_NORM = 0, /* normal playlist, visible in iPod */ + ITDB_PL_TYPE_MPL = 1 /* master playlist, contains all tracks, + not visible in iPod */ +}; + +/* always use itdb_playlists_is_podcasts() to check for podcasts PL */ +enum ItdbPlFlag { /* types for playlist->podcastflag */ + ITDB_PL_FLAG_NORM = 0, /* normal playlist, visible under + 'Playlists */ + ITDB_PL_FLAG_PODCASTS = 1 /* special podcast playlist visible + under 'Music' */ +}; + + /* keeps the contents of one disk file (read) */ typedef struct { diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index 671d96c..98a04fc 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -22,10 +22,14 @@ * */ +#include <config.h> #include "itdb.h" -#include "itdb_private.h" #include "db-image-parser.h" +#ifdef HAVE_GDKPIXBUF + +#include "itdb_private.h" + #include <errno.h> #include <locale.h> #include <string.h> @@ -241,7 +245,7 @@ itdb_write_ithumb_files (Itdb_iTunesDB *db, const char *mount_point) GList *it; iThumbWriter *fullsize_writer; iThumbWriter *nowplaying_writer; - g_print ("%s\n", G_GNUC_FUNCTION); +/* g_print ("%s\n", G_GNUC_FUNCTION);*/ fullsize_writer = ithumb_writer_new (mount_point, ITDB_IMAGE_FULL_SCREEN, @@ -291,3 +295,10 @@ itdb_write_ithumb_files (Itdb_iTunesDB *db, const char *mount_point) return 0; } +#else +G_GNUC_INTERNAL int +itdb_write_ithumb_files (Itdb_iTunesDB *db, const char *mount_point) +{ + return -1; +} +#endif diff --git a/tests/test-covers.c b/tests/test-covers.c index 0d2c940..f480b6a 100644 --- a/tests/test-covers.c +++ b/tests/test-covers.c @@ -41,14 +41,40 @@ ipod_image_to_gdk_pixbuf (Itdb_Image *image) printf ("width: %d height: %d size: %d\n", image->width, image->height, image->size); - if (image->type == ITDB_IMAGE_FULL_SCREEN) { - row_stride = 100; - } else if (image->type == ITDB_IMAGE_NOW_PLAYING) { - row_stride = 42; - } else { - return NULL; +/* +description photo: size width nano: size width +==================== ===== ===== ===== ===== +artwork big 39200 140 20000 100 +artwork small 6272 56 3528 42 +photo full-screen ? ? 46464 176 +photo thumbnail ? ? 3108 42 +*/ + + switch (image->size) + { + case 39200: /* ITDB_IMAGE_FULL_SCREEN */ + row_stride = 140; + break; + + case 46464: /* iPod nano photo database full screen */ + row_stride = 176; + break; + + case 6272: /* ITDB_IMAGE_NOW_PLAYING */ + row_stride = 56; + break; + + case 3108: /* iPod nano photo database thumbnails */ +/* if (width > 42) width = 42; + if (height > 37) height = 37; ??? */ + row_stride = 42; + break; + + default: + return NULL; } + pixels = itdb_image_get_rgb_data (image); if (pixels == NULL) { return NULL; @@ -56,7 +82,6 @@ ipod_image_to_gdk_pixbuf (Itdb_Image *image) result = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, FALSE, 8, image->width, image->height, - /*image->width * 3, */ row_stride * 3, (GdkPixbufDestroyNotify)g_free, NULL); |