feat: store word-by-word and translated lyrics
This commit is contained in:
1 parent
bec757c7a5
commit
e2364b171e
9 files changed
+45
-21
No files matched your search
@@ -0,0 +1,4 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE tracks
|
||||
ADD COLUMN lyric_words text,
|
||||
ADD COLUMN lyric_trans text;
|
||||
@@ -5,7 +5,7 @@ UPDATE rooms SET term = term + 1 WHERE id = @id RETURNING *;
|
||||
SELECT e.entry_id, e.slot, e.source, e.track_id, e.title, e.artist, e.album, e.cover_url, e.cover_key, e.page_url, e.meta_duration_ms,
|
||||
e.by_member_id, e.by_name, e.by_avatar_hash, e.auto, e.likes, e.round, e.added_at, e.started_at,
|
||||
t.title AS track_title, t.artist AS track_artist, t.album AS track_album, t.cover_url AS track_cover_url,
|
||||
t.cover_key AS track_cover_key, t.page_url AS track_page_url, t.duration_ms, t.gain, t.lyric
|
||||
t.cover_key AS track_cover_key, t.page_url AS track_page_url, t.duration_ms, t.gain, t.lyric, t.lyric_words, t.lyric_trans
|
||||
FROM room_entries e
|
||||
LEFT JOIN tracks t ON t.source = e.source AND t.track_id = e.track_id
|
||||
WHERE e.room_id = @room_id
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
-- name: PreparedTrack :one
|
||||
SELECT title, artist, album, cover_url, cover_key, page_url, duration_ms, gain, lyric, media_key, media_size FROM tracks
|
||||
SELECT title, artist, album, cover_url, cover_key, page_url, duration_ms, gain, lyric, lyric_words, lyric_trans, media_key, media_size FROM tracks
|
||||
WHERE source = @source AND track_id = @track_id;
|
||||
|
||||
-- name: SavePreparedTrack :exec
|
||||
-- 准备任务只对未完成的任务去重,同一首歌可能先后准备两次,以后一次的结果为准。
|
||||
INSERT INTO tracks (source, track_id, title, artist, album, cover_url, cover_key, page_url, duration_ms, gain, lyric, media_key, media_size)
|
||||
VALUES (@source, @track_id, @title, @artist, @album, @cover_url, @cover_key, @page_url, @duration_ms, @gain, @lyric, @media_key, @media_size)
|
||||
INSERT INTO tracks (source, track_id, title, artist, album, cover_url, cover_key, page_url, duration_ms, gain, lyric, lyric_words, lyric_trans, media_key, media_size)
|
||||
VALUES (@source, @track_id, @title, @artist, @album, @cover_url, @cover_key, @page_url, @duration_ms, @gain, @lyric, @lyric_words, @lyric_trans, @media_key, @media_size)
|
||||
ON CONFLICT (source, track_id) DO UPDATE SET
|
||||
title = excluded.title, artist = excluded.artist, album = excluded.album, cover_url = excluded.cover_url,
|
||||
cover_key = excluded.cover_key, page_url = excluded.page_url, duration_ms = excluded.duration_ms, gain = excluded.gain,
|
||||
lyric = excluded.lyric, media_key = excluded.media_key, media_size = excluded.media_size,
|
||||
lyric = excluded.lyric, lyric_words = excluded.lyric_words, lyric_trans = excluded.lyric_trans,
|
||||
media_key = excluded.media_key, media_size = excluded.media_size,
|
||||
prepared_at = now();
|
||||
Reference in new issue
Block a user