$plugin_purpose{'input-m3u'} =
  "Load list of audio files and meta data from M3U play list";
$plugin_options{'input-m3u'} = [
  ['charset=string', 'Specify charset which EXTINF tags was encoded'],
  ['noextinf', 'Ignore EXTINF tags']];

$input_plugin_hook = sub {
    my ($if, $langs) = @_;
    my $track = [];
    my $title = undef;
    while (<$if>) {
	chomp;
        if (!$plugin{'input-m3u'}{noextinf} &&
	    /^#EXTINF:-?\d+,(.*)/) {
            $title = $1;
	    from_to($title, $plugin{'input-m3u'}{charset},
		langinfo(CODESET())) if $plugin{'input-m3u'}{charset};
            next;
        }
        next if /^(#|$)/;
	my $ti = {FILE=>$_};
	track_info_set_for_langs($ti, $langs, TITLE=>$title)
	  if defined $title;
	push(@$track, $ti);
	$title = undef;
    }
    return $track;
};

1
# vim:ft=perl
