diff options
Diffstat (limited to '')
-rw-r--r-- | src/PlaylistSong.cxx (renamed from src/playlist_song.c) | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/playlist_song.c b/src/PlaylistSong.cxx index a3d9ab4d9..118fb5715 100644 --- a/src/playlist_song.c +++ b/src/PlaylistSong.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,14 +18,20 @@ */ #include "config.h" -#include "playlist_song.h" -#include "database.h" -#include "mapper.h" +#include "PlaylistSong.hxx" +#include "Mapper.hxx" +#include "DatabasePlugin.hxx" +#include "DatabaseGlue.hxx" +#include "ls.hxx" +#include "tag.h" + +extern "C" { #include "song.h" #include "uri.h" #include "path.h" -#include "ls.h" -#include "tag.h" +} + +#include <glib.h> #include <assert.h> #include <string.h> @@ -86,9 +92,7 @@ apply_song_metadata(struct song *dest, const struct song *src) (e.g. last track on a CUE file); fix it up here */ tmp->tag->time = dest->tag->time - src->start_ms / 1000; - if (!song_in_database(dest)) - song_free(dest); - + song_free(dest); return tmp; } @@ -104,10 +108,17 @@ playlist_check_load_song(const struct song *song, const char *uri, bool secure) if (dest == NULL) return NULL; } else { - dest = db_get_song(uri); - if (dest == NULL) + const Database *db = GetDatabase(nullptr); + if (db == nullptr) + return nullptr; + + struct song *tmp = db->GetSong(uri, nullptr); + if (tmp == NULL) /* not found in database */ return NULL; + + dest = song_dup_detached(tmp); + db->ReturnSong(tmp); } return apply_song_metadata(dest, song); |