Lyrics / lyrics-api

Dynamic website for the lyrics database
GNU Affero General Public License v3.0
2 stars 0 forks source link

Add basic instructions for db generation #2

Closed C0rn3j closed 5 years ago

C0rn3j commented 5 years ago

Doesn't have the search.pl instructions as I didn't figure that out yet.

C0rn3j commented 5 years ago

Could you check if my usage of the query string over there is correct? I guessed it'd be & just like normal GET.

defanor commented 5 years ago

Yes, that example works.

C0rn3j commented 5 years ago

https://lyrics.rys.pw/?title=six%20shooter Got it working, but now I need a nap. I guess tomorrow I will butcher a deadbeef plugin that works with wikia.lyrics.com to work with my site instead. I tried just a quick and dirty replace and it gave me an ugly error :D

defanor commented 5 years ago

Nice. And I've got rid of hardcoded paths: now the LYRICS_DB environment variable should be set for search.pl (and optionally the template path can be adjusted), and lyrics-to-sqlite.pl gets invoked with two arguments: the database directory, and the sqlite database file.

C0rn3j commented 5 years ago
[0] % perl lyrics-to-sqlite.pl
Can't locate preprocessing.pm in @INC (you may need to install the preprocessing module) (@INC contains: /usr/lib/perl5/5.28/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.28/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.28/core_perl /usr/share/perl5/core_perl) at lyrics-to-sqlite.pl line 22.
BEGIN failed--compilation aborted at lyrics-to-sqlite.pl line 22.

Am having trouble finding out which module is newly needed, any hints?

"preprocessing.pm" "perl" gives me 8 results on Google.

defanor commented 5 years ago

Am having trouble finding out which module is newly needed, any hints?

preprocessing.pm is included into the repository, it's a module shared between search.pl and lyrics-to-sqlite.pl (and, well, used for preprocessing in both). I think by default it should work if it's available in the current directory, though may be wrong (but works here).

Actually would be nice to use a proper packaging, just will have to find out what it means for Perl (I'm only vaguely recalling some Makefile.pl thing). Going to look it up later today.

C0rn3j commented 5 years ago

I am in the directory with the file actually, doesn't seem to work for me on Arch


c0rn3j@Aleksandra ‹ master ● › : ~/lyrics-api
[0] % ls -lah
total 4.1M
drwxr-xr-x   4 c0rn3j c0rn3j 4.0K Jan 29 13:40 .
drwx--x---+ 87 c0rn3j c0rn3j 4.0K Jan 29 13:57 ..
drwxr-xr-x   2 c0rn3j c0rn3j 4.0K Jan 29 13:40 format
drwxr-xr-x   8 c0rn3j c0rn3j 4.0K Jan 29 13:57 .git
-rw-r--r--   1 c0rn3j c0rn3j  34K Jan 23 23:35 LICENSE
-rw-r--r--   1 c0rn3j c0rn3j 4.0M Jan 24 00:17 lyrics.db
-rwxr-xr-x   1 c0rn3j c0rn3j 2.2K Jan 29 13:40 lyrics-to-sqlite.pl
-rw-r--r--   1 c0rn3j c0rn3j 1.1K Jan 29 13:40 preprocessing.pm
-rw-r--r--   1 c0rn3j c0rn3j  690 Jan 29 13:40 README.md
-rwxr-xr-x   1 c0rn3j c0rn3j 4.4K Jan 29 13:40 search.pl

c0rn3j@Aleksandra ‹ master ● › : ~/lyrics-api
[0] % perl lyrics-to-sqlite.pl
Can't locate preprocessing.pm in @INC (you may need to install the preprocessing module) (@INC contains: /usr/lib/perl5/5.28/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.28/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.28/core_perl /usr/share/perl5/core_perl) at lyrics-to-sqlite.pl line 22.
BEGIN failed--compilation aborted at lyrics-to-sqlite.pl line 22.

c0rn3j@Aleksandra ‹ master ● › : ~/lyrics-api
[0] % ./lyrics-to-sqlite.pl
Can't locate preprocessing.pm in @INC (you may need to install the preprocessing module) (@INC contains: /usr/lib/perl5/5.28/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.28/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.28/core_perl /usr/share/perl5/core_perl) at ./lyrics-to-sqlite.pl line 22.
BEGIN failed--compilation aborted at ./lyrics-to-sqlite.pl line 22.

EDIT: perl -I "." lyrics-to-sqlite.pl works

defanor commented 5 years ago

I am in the pwd with the file actually, doesn't seem to work for me on Arch

As a temporary solution (until we get proper packaging), perhaps setting PERL5LIB or perl -I. would work.

C0rn3j commented 5 years ago

The -I flag is what I found and ended up using. I touched up the docu, should be hopefully good to pull now.

EDIT: Eh the actual server still needs to get the -I flag parsed somehow, ideas? EDIT2: I guess I'll pass the var via /etc/environment or something

defanor commented 5 years ago

Eh the actual server still needs to get the -I flag parsed somehow, ideas?

Wrapping it into a shell script would work, but that's rather awkward. I guess it can be done via environment variables somehow, but probably proper packaging would be easier (and certainly less awkward) than such hacks.

C0rn3j commented 5 years ago

Alright figured a hack out (set variables via nginx) to get things running at least, but I get an error both via the webserver and locally -

fcgiwrap[832]: Could not create file parser context for file "./xhtml.xsl": No such file or directory at /var/www/html/lyrics-api/search.pl line 119.
defanor commented 5 years ago

XSLT_DIR should be set, pointing to the directory with stylesheets. By default it's current working directory, in the repository it's the format directory. Perhaps should be data directory once we'll package it.

C0rn3j commented 5 years ago

Alright, got it working, the examples run and my server is up to date again.

defanor commented 5 years ago

Thanks, merging then. I think proper packaging should be the next step, but it's nice to have the current state documented too.