package Slim::Schema::ResultSet::Year;

# $Id: Year.pm 8684 2006-07-26 17:15:03Z dsully $

use strict;
use base qw(Slim::Schema::ResultSet::Base);

use Slim::Utils::Prefs;

sub title {
	my $self = shift;

	return 'BROWSE_BY_YEAR';
}

sub allTitle {
	my $self = shift;

	return '';
}

sub browse {
	my $self = shift;
	my $find = shift;
	my $cond = shift;
	my $sort = shift || 'me.id';

	return $self->search($cond, {
		'order_by' => $sort,
	});
}

sub descendAlbum {
	my $self = shift;
	my $find = shift;
	my $cond = shift;
	my $sort = shift;

	return $self->search_related('albums', $cond, { 'order_by' => "concat('0', albums.titlesort), albums.disc" });
}

1;
