--- /dev/null
+/*****************************************************************************
+ * vlc_art_finder.h
+ *****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_ART_FINDER_H
+#define VLC_ART_FINDER_H 1
+
+typedef struct art_finder_t
+{
+ VLC_COMMON_MEMBERS
+ input_item_t *p_item;
+} art_finder_t;
+
+#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_playlist.h>
+#include <vlc_art_finder.h>
#include <vlc_charset.h>
#include <vlc_url.h>
*****************************************************************************/
static int FindMeta( vlc_object_t *p_this )
{
- input_item_t *p_item = (input_item_t *)p_this->p_private;
+ art_finder_t *p_finder = (art_finder_t *)p_this;
+ input_item_t *p_item = p_finder->p_item;
bool b_have_art = false;
int i;
#include <vlc_input.h>
#include <vlc_playlist.h>
#include <vlc_meta.h>
+#include <vlc_art_finder.h>
#include <vlc_url.h>
#include <vlc_strings.h>
#include <vlc_stream.h>
*****************************************************************************/
int FindArt( vlc_object_t *p_this )
{
+ art_finder_t *p_finder = (art_finder_t *)p_this;
+ input_item_t *p_item = p_finder->p_item;
playlist_t *p_playlist = pl_Hold( p_this );
if( !p_playlist )
return VLC_EGENERIC;
- input_item_t *p_item = (input_item_t *)p_this->p_private;
lua_State *L = vlclua_meta_init( p_this, p_item );
int i_ret = vlclua_scripts_batch_execute( p_this, "meta", &fetch_art, L, p_item );
lua_close( L );
#include <vlc_playlist.h>
#include <vlc_stream.h>
#include <limits.h>
+#include <vlc_art_finder.h>
#include "art.h"
#include "fetcher.h"
static int FindArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
{
int i_ret;
- module_t *p_module;
- char *psz_title, *psz_artist, *psz_album;
- psz_artist = input_item_GetArtist( p_item );
- psz_album = input_item_GetAlbum( p_item );
- psz_title = input_item_GetTitle( p_item );
+ char *psz_artist = input_item_GetArtist( p_item );
+ char *psz_album = input_item_GetAlbum( p_item );
+ char *psz_title = input_item_GetTitle( p_item );
if( !psz_title )
psz_title = input_item_GetName( p_item );
}
/* Fetch the art url */
- p_fetcher->p_private = p_item;
-
- p_module = module_need( p_fetcher, "art finder", NULL, false );
+ i_ret = VLC_EGENERIC;
- if( p_module )
- {
- module_unneed( p_fetcher, p_module );
- i_ret = 1;
- }
- else
+ vlc_object_t *p_parent = VLC_OBJECT(p_fetcher->p_playlist);
+ art_finder_t *p_finder =
+ vlc_custom_create( p_parent, sizeof( *p_finder ), VLC_OBJECT_GENERIC,
+ "art finder" );
+ if( p_finder != NULL)
{
- msg_Dbg( p_fetcher, "unable to find art" );
- i_ret = VLC_EGENERIC;
+ module_t *p_module;
+
+ vlc_object_attach( p_finder, p_parent );
+ p_finder->p_item = p_item;
+
+ p_module = module_need( p_parent, "art finder", NULL, false );
+ if( p_module )
+ {
+ module_unneed( p_finder, p_module );
+ i_ret = 1;
+ }
+ vlc_object_release( p_finder );
}
/* Record this album */