From Lyriki
Jump to navigation Jump to search

I've begun work on a 'Lyriki Editor' so to speak. I'm not sure what I'm going to write it in yet. Considering that Mono is becoming more supported in the Linux world, I've been heavily considering C#. It's just faster and seems easier to write, but, considering that I'd be learning the language as writing it, and there's not the same amount of resources available for C#, it's still only a consideration.

I've also considered writing it in Java. The main reason for those two languages as choice is just the want to make it a simple binary program that's easily portable. Whilst perl is good and all for me dinking with it, it's been brought up that most people don't have all the needed perl modules installed, and less computer literate users might have real trouble with that.

Intended features for Lyriki Editor

  • Automatic proper formatting of Lyric pages based upon the data given. It will attempt to generate as many pages as it can that do not already exist. IE: If given Artist, Album, Year, AlbumArt, SongTitle, and Lyrics. It will create all 3 related pages should none of them exist. If the Artist page already exists, it will make an attempt to understand what's posted there, and append discography info, so on and so forth. The idea is to make it as easy as possible to get the data onto Lyriki.
  • Clear Prompting, Right now, there's not really a very clear idea of what to do to add pages and what information you need. With the Lyriki Editor, it'll have fields for all required data, and should it need information you haven't entered in order to generate a page, it will ask you to fill in the proper field.
  • Lyriki Browser, able to retrieve and view any information on Lyriki, allowing for editing and re-submission.

Actual work accomplished? Nil ;). Still been fighting over the decision of what to use, and either way. My coding abilities are amatuerish at best. But, feel free to suggest features you'd like to see, etc.

--Nanenj 17:26, 11 January 2006 (PST)

The following is a perl script application I've been working with to remotely retrieve lyrics from Lyriki.

If there's any other developers that wish to release open source code to work with Lyriki, please feel free. Myself in particular am fond of win32 compatible scripting languages such as Perl, Ruby, and Python. Extremely quick and easy to work with, and no complex compilers to mess with. But, of course any contribution as long as the source code is attached is more then welcome.

use Tk;
use Tk::LabEntry;
use LWP::Simple;
$mainwindow = MainWindow->new();
my $menubar = $mainwindow->Frame()->grid(-row => 0, -column => 0, -columnspan => 3, -sticky => 'nw');

my $filemenu = $menubar ->Menubutton(-text => 'File');
$filemenu->command( -label => 'Fetch Lyrics', -command => \&fetchLyrics );
$filemenu->command( -label => 'Exit', -command => sub {exit;} );
$filemenu->pack(-side => 'left');     

my $left = $mainwindow->Frame->grid(-row => 1, -column => 0, -sticky => 'nw');
my $right = $mainwindow->Frame->grid(-row => 1, -column => 1, -sticky => 'nw');
$left->LabEntry(-label => "Artist", -labelPack => [-side => "right", -anchor => "w"], -width => 20, -textvariable => \$Artist)->pack(-side => "top", -anchor => "nw");
$left->LabEntry(-label => "Song", -labelPack => [-side => "right", -anchor => "w"], -width => 20, -textvariable => \$Song)->pack(-side => "top", -anchor => "nw");
$left->Button(-text => 'Fetch Lyrics', -command => \&fetchLyrics )-> pack;

$text = $right->Text(-height => 20, -width => 50, -wrap => "none")->grid(-row =>1, -column =>1);

$scroll_y = $right -> Scrollbar(-orient=>'v', -command => ['yview', $text]);
$scroll_x = $right -> Scrollbar(-orient=>'h', -command => ['xview', $text]);

$text -> configure(-yscrollcommand=>['set', $scroll_y], -xscrollcommand=>['set', $scroll_x]);
$scroll_y -> grid(-row => 1, -column => 2, -sticky => "ns");
$scroll_x -> grid(-row => 2, -column => 1, -sticky => "ew");
while (1)
   eval MainLoop();
sub fetchLyrics
   $URL = "http\:\/\/lyriki\.com\/index\.php\?title\=$Artist\:$Song";
   $LyricsRaw = get($URL);
   $LyricsRaw =~ s/"/'/g;
   $LyricsRaw =~ s/\n/ /g;
   $LyricsRaw =~ s/\s+/ /g;

   if( $LyricsRaw =~ /.*<!-- start content --> (.*) <\/p> <!-- Saved.*/g )
      $Lyrics = $1;
      $Lyrics =~ s/<br \/>/\n/g;
      $Lyrics =~ s/<p>//g;
      $Lyrics =~ s/<\/p>//g;
      $Lyrics =~ s/<a href.*'>//g;
      $Lyrics =~ s/<hr \/>/\n----------\n/g;
      $Lyrics =~ s/<\/a>//g;

      @LyricsClean = split(/\n/, $Lyrics);
      foreach( @LyricsClean )
      $text->insert('end', join("\n",@LyricsClean), 'normal');

See Also