static void rb_playlist_source_row_deleted (GtkTreeModel *model, GtkTreePath *path, RBPlaylistSource *source) { RhythmDBEntry *entry; RBRefString *location; entry = rhythmdb_query_model_tree_path_to_entry (RHYTHMDB_QUERY_MODEL (model), path); location = rhythmdb_entry_get_refstring (entry, RHYTHMDB_PROP_LOCATION); if (g_hash_table_remove (source->priv->entries, location)) source->priv->dirty = TRUE; rb_refstring_unref (location); rhythmdb_entry_unref (entry); }
static void rb_playlist_source_entry_added_cb (RhythmDB *db, RhythmDBEntry *entry, RBPlaylistSource *source) { RBRefString *location; location = rhythmdb_entry_get_refstring (entry, RHYTHMDB_PROP_LOCATION); if (g_hash_table_lookup (source->priv->entries, location)) { if (_rb_source_check_entry_type (RB_SOURCE (source), entry)) { rhythmdb_query_model_add_entry (source->priv->model, entry, -1); source->priv->dirty = TRUE; } else { g_hash_table_remove (source->priv->entries, location); } } rb_refstring_unref (location); }
RBDAAPRecord * rb_daap_record_new (RhythmDBEntry *entry) { RBDAAPRecord *record = NULL; record = RB_DAAP_RECORD (g_object_new (RB_TYPE_DAAP_RECORD, NULL)); /* When browsing, entry will be NULL because we will pull * the metadata from the DAAP query. When sharing, entry will * point to an existing entry from the Rhythmbox DB. */ if (entry) { gchar *ext; record->priv->filesize = rhythmdb_entry_get_uint64 (entry, RHYTHMDB_PROP_FILE_SIZE); record->priv->location = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_LOCATION); record->priv->title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE); record->priv->artist = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ARTIST); record->priv->album = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ALBUM); /* Since we don't support album id's on Rhythmbox, "emulate" it */ record->priv->albumid = (gintptr) rhythmdb_entry_get_refstring (entry, RHYTHMDB_PROP_ALBUM); record->priv->genre = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_GENRE); /* FIXME: Support transcoding: */ /* FIXME: we should use RHYTHMDB_PROP_MIMETYPE instead */ ext = strrchr (record->priv->location, '.'); if (ext == NULL) { ext = "mp3"; } else { ext++; } record->priv->mediakind = DMAP_MEDIA_KIND_MUSIC; record->priv->real_format = g_strdup (ext); record->priv->format = g_strdup (record->priv->real_format); /* Only support songs */ record->priv->mediakind = 1; record->priv->track = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TRACK_NUMBER); record->priv->duration = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION); record->priv->rating = (gint) rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_RATING); record->priv->year = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_YEAR); record->priv->firstseen = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_FIRST_SEEN); record->priv->mtime = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_MTIME); record->priv->disc = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DISC_NUMBER); record->priv->bitrate = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_BITRATE); } return record; }