rhythmbox r6079 - in trunk: . plugins/mtpdevice
- From: jmatthew svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r6079 - in trunk: . plugins/mtpdevice
- Date: Sun, 23 Nov 2008 01:55:49 +0000 (UTC)
Author: jmatthew
Date: Sun Nov 23 01:55:49 2008
New Revision: 6079
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6079&view=rev
Log:
2008-11-23 Jonathan Matthew <jonathan d14n org>
* plugins/mtpdevice/rb-mtp-source.c: (rb_mtp_source_new),
(add_mtp_track_to_db), (load_mtp_db_idle_cb), (impl_track_added):
Ignore non-audio items on MTP devices. Fixes #561950.
Modified:
trunk/ChangeLog
trunk/plugins/mtpdevice/rb-mtp-source.c
Modified: trunk/plugins/mtpdevice/rb-mtp-source.c
==============================================================================
--- trunk/plugins/mtpdevice/rb-mtp-source.c (original)
+++ trunk/plugins/mtpdevice/rb-mtp-source.c Sun Nov 23 01:55:49 2008
@@ -291,7 +291,7 @@
mediatype = "audio/flac";
break;
default:
- rb_debug ("unknown libmtp filetype %d supported", types[i]);
+ rb_debug ("unknown libmtp filetype %s supported", LIBMTP_Get_Filetype_Description (types[i]));
mediatype = NULL;
break;
}
@@ -330,15 +330,21 @@
static void
add_mtp_track_to_db (RBMtpSource *source,
+ RhythmDB *db,
LIBMTP_track_t *track)
{
RhythmDBEntry *entry = NULL;
RhythmDBEntryType entry_type;
- RhythmDB *db = NULL;
RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
char *name = NULL;
- db = get_db_for_source (source);
+ /* ignore everything except audio (allow audio/video types too, since they're probably pretty common) */
+ if (!(LIBMTP_FILETYPE_IS_AUDIO (track->filetype) || LIBMTP_FILETYPE_IS_AUDIOVIDEO (track->filetype))) {
+ rb_debug ("ignoring non-audio item %d (filetype %s)",
+ track->item_id,
+ LIBMTP_Get_Filetype_Description (track->filetype));
+ return;
+ }
/* Set URI */
g_object_get (G_OBJECT (source), "entry-type", &entry_type, NULL);
@@ -417,8 +423,6 @@
g_hash_table_insert (priv->entry_map, entry, track);
rhythmdb_commit (RHYTHMDB (db));
-
- g_object_unref (G_OBJECT (db));
}
static gboolean
@@ -438,10 +442,9 @@
tracks = LIBMTP_Get_Tracklisting (priv->device);
#endif
if (tracks != NULL) {
- LIBMTP_track_t *track, *tmp = NULL;
+ LIBMTP_track_t *track;
for (track = tracks; track != NULL; track = track->next) {
- add_mtp_track_to_db (source, track);
- tmp = track;
+ add_mtp_track_to_db (source, db, track);
}
} else {
rb_debug ("No tracks");
@@ -817,8 +820,12 @@
g_file_delete (file, NULL, NULL);
if (track != NULL) {
+ RhythmDB *db;
/*request_artwork (isource, entry, song);*/
- add_mtp_track_to_db (source, track);
+
+ db = get_db_for_source (source);
+ add_mtp_track_to_db (source, db, track);
+ g_object_unref (db);
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]