ONO::Lib::Audio::Pro::Genres

package ONO::Lib::Audio::Pro::Genres;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# 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.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################

use strict;

###############################################################################
# genres
###############################################################################

sub genres {

#: Return a list of common music genres.

return (
'alte:Alternative',
'avan:Avant-garde',
'blue:Blues',
'cari:Caribbean',
'coun:Country',
'disc:Disco',
'easy:Easy Listening',
'elec:Electronic',
'folk:Folk',
'funk:Funk',
'gara:Garage',
'gosp:Gospel',
'goth:Gothic',
'grun:Grunge',
'hard:Hard Rock',
'heav:Heavy Metal',
'hiph:Hip Hop / Rap',
'indi:Indie',
'indu:Industrial',
'inst:Instrumental',
'jazz:Jazz',
'lati:Latin',
'lofi:Lo-Fi',
'popp:Pop',
'prog:Progressive',
'punk:Punk',
'psyc:Psychedelic',
'rnnb:R&B',
'regg:Reggae',
'rock:Rock',
'rnrl:Rock \'N\' Roll',
'soul:Soul',
'trip:Trip Hop',
'voca:Vocal',
);

}

sub genre_get {

#: Get the name of a specific music genre.

foreach my $genre (&genres) {
if ($genre =~ /^$_[1]:(.*?)$/) {
return $1;
}
}
}

sub genre_select {

#: Select a music genre.

my (
$self,
$selected,
) = @_;

my $GENRES;

foreach my $genre (&genres) {

$genre =~ /^(.*?):(.*?)$/;

my $sel;
if ($selected && $selected eq $1) {
$sel = " selected";
}

$GENRES .= qq~<option value="$1"$sel>$2</option>~;

}

return $GENRES;

}

###############################################################################
# end of script
###############################################################################

1;

__END__