#include "CommandManager.h"
#include "Command.h"
#include "List.h"

using namespace std;

const std::string PlayScriptCommand::_id = "playScript";

PlayScriptCommand::PlayScriptCommand(std::string filename)
:_filename(filename)
{

}

PlayScriptCommand::PlayScriptCommand(List *command)
{
	command = command->rest();
	_filename = command->firstString();
}

void PlayScriptCommand::execute()
{
	CommandManager::instance()->startPlaying(_filename);
}

std::string PlayScriptCommand::getString()
{
	List *command = new List();
	command->snoc(new Atom(_id));
	command->snoc(new Atom(_filename));
	string commandString = command->getString();
	delete command;

	return commandString;
}