So I saw some Yojimbo scripts over at DF and I remembered I have a Yojimbo script I use quite a bit, to create a setlist in which I keep song lyrics and chords and so on.
The setup required is to change the $htmlfile variable for your location of the created setlist; create a "Music: Setlist" group in Yojimbo (which contains note items with titles for song names, tags for artist names, and the contents in the note [with an optional __BR__ text to force a column break, such as you can see in several of the songs).
And of course, you need Mac::Glue installed, and glues for Safari and Yojimbo created.
And you need a stylesheet, which you can get from the source in the finished file.
#!/usr/bin/perl use warnings; use strict;
use File::Spec::Functions; use Mac::Glue; use URI::file;
our($header, $mid, $footer); init();
my(%setlist); my $artists = $setlist{ARTIST} = {}; my $songs = $setlist{SONG} = {};
my $yojimbo = new Mac::Glue 'Yojimbo'; my $browser = new Mac::Glue 'Safari';
my $set = $yojimbo->obj(collection => 'Music: Setlist'); my $count = my @items = $set->obj('items')->get; for my $item (@items) { my $song = $item->prop('name')->get; my $text = $item->prop('contents')->get; my($artist) = $item->prop(name => of => 'tag')->get;
$text =~ s/(\015\012|\015|\012)/\n/g; my $key; $key = $1 if $text =~ s/^(\[.+\])\s+//s; (my $songlink = $song) =~ s/\W/_/g; (my $artistlink = $artist) =~ s/\W/_/g;
push @{$artists->{$artist}}, $song; $songs->{$song}{artist} = $artist; $songs->{$song}{alink} = $artistlink; $songs->{$song}{text} = $text; $songs->{$song}{key} = $key if $key; $songs->{$song}{link} = $songlink; }
$count += scalar(keys %$artists) * 2;
##########################
my $htmlfile = catfile( '/Users/pudge/MacOS/pudge/work/songs/music', 'setlist.html' ); my $uri = URI::file->new($htmlfile); open my $fh, '>', $htmlfile;
##########################
print $fh $header;
my $c = 0; my $d = 1; for my $artist (sort keys %$artists) { my $artistr = $artists->{$artist}; print $fh qq[\t
|gs;
print $fh qq[\t\t$song]; print $fh qq[ $songr->{key}] if $songr->{key}; print $fh qq[
\n\t\tTop]; print $fh qq[ | $artist]; print $fh qq[\n\n$text\n\n\n
\n\n]; } }
print $fh $footer;
##########################
close $fh; $browser->activate; $browser->open_location($uri->as_string);
##########################
sub init { $header = <Pudge Setlist Pudge Setlist
EOT
$mid = <EOT
EOT
$footer = <__END__
}