#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2007 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package RPS::Catalog::Command::SearchTrackAjax;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use RSApache::Response::XML;

use lib '/app/tools/rps/lib';
use RPS::Catalog::SearchResults::Tracks;
use RPS::XMLCommand;
use base 'RPS::XMLCommand';

sub cmd  { return 'search_track_ajax'; }
sub area { return 'catalog'; }

use constant kTemplate => "/app/tools/rps/templates/catalog/index.xsl";

sub execute {
    my ($self) = @_;

    my $response = $self->SUPER::execute();
    return $response if $response;

    my $query   = $self->getParam('query');
    my $limit   = $self->getParam('limit');
    my $albumID = $self->getParam('album_id');

    my $list = RPS::Catalog::SearchResults::Tracks->new( query => $query, limit => $limit, albumID => $albumID );

    $response = RSApache::Response::XML->new($list);

    return $response;
}

1;
