Compare commits

...

2 Commits

Author SHA1 Message Date
Annika Backstrom 1f9a0ea586 Add header link to site root 2019-12-17 13:55:31 -05:00
Annika Backstrom 38f832e8d8 Add script to migrate from file to sqlite backend
This is the script I used to convert all existing media from the file
backend to the sqlite backend. I'm saving it for posterity.

It outputs shell commands to stdout, and SQL commands to stderr. These
can be piped to different files, examined, and run independently, e.g.

    $ ./file-to-sqlite.sh 1>files.sh 2>files.sql
    $ sh files.sh
    $ sqlite3 jukebox.sqlite3 files.sql
2019-12-17 13:50:11 -05:00
3 changed files with 19 additions and 2 deletions

14
archive/file-to-sqlite.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
ls media/*\ -\ *.mp3 | while read line ; do
UUID=$(./jukebox/node_modules/.bin/uuid v4)
echo "mv \"$line\" \"media/$UUID\""
FILE=$(basename "$line" ".mp3")
set -- $FILE
TAG=${@:1:1}
LABEL=${@:3}
echo "INSERT INTO tags (tag) VALUES (\"$TAG\");" 1>>/dev/stderr;
echo "INSERT INTO library (tag, label, uuid) VALUES (\"$TAG\", \"$LABEL\", \"$UUID\");" 1>>/dev/stderr;
done

View File

@ -10,7 +10,10 @@ body {
h1 {
font-size: 2rem;
margin: 0.5em 0;
color: hsl(182.8, 70.2%, 42.2%)
}
h1 a, h1 a:active, h1 a:visited, h1 a:hover {
color: hsl(182.8, 70.2%, 42.2%);
text-decoration: none;
}
h2 {
margin-bottom: 0.5ex;

View File

@ -9,7 +9,7 @@
<body>
<div class=header>
<h1 class=page-title>jukebox.stop.wtf</h1>
<h1 class=page-title><a href="/">jukebox.stop.wtf</a></h1>
</div>
<div class="main-content">
{{{body}}}