/**
 * osd_userinterface_data_artistMetadata.c: Presents metadata
 * 
 * Copyright: See COPYING file that comes with this distribution
 *
 * Author: Matthias Feistel <hitman_47@users.sourceforge.net>, (C) 2007
 */

#include <vector>
#include <vdr/interface.h>
#include <vdr/menu.h>
#include <vdr/plugin.h>
#include "osd_userinterface_data_artistMetadata.h"
#include "settings.h"
#include "web_metadata.h"

cUserInterface_Data_artistMetadata::cUserInterface_Data_artistMetadata( void ) :
	cMenuText( "", "")
{
	cSettings::GetInstance().SetOsd_Path( "artistMetadata" );
	// OSD-Elemente aufbauen
	BuildItems( );
}

cUserInterface_Data_artistMetadata::~cUserInterface_Data_artistMetadata( )
{
	cSettings::GetInstance().SetOsd_Path( "data" );
}

void cUserInterface_Data_artistMetadata::BuildItems( void )
{
	WebServiceConnector = new cWebServiceConnector();
	cMetaData meta;
	std::string response;

	meta = WebServiceConnector->Meta( );
	
	WebServiceConnector->XmlRpcCall( response, "artistMetadata", meta.mp_MetadataMap[ "artist" ] );
	
	if( WebServiceConnector )
	{
		delete WebServiceConnector;
		WebServiceConnector = 0;
	}
	
	SetText( response.c_str( ) );

	Display( );
}

eOSState cUserInterface_Data_artistMetadata::ProcessKey( eKeys Key )
{
	eOSState state = cMenuText::ProcessKey( Key );
	if( !strcmp( cSettings::GetInstance().GetOsd_Path( ), "artistMetadata" ) )
	{
		switch( Key )
		{
		case kOk:
			return osContinue;
		default:
			break;
		}
	}

	return state;
}
