feat(16-02): add go-flac dependencies and implement FLAC tag writer
- Add go-flac/go-flac/v2, flacvorbis/v2, flacpicture/v2 dependencies - Create tagwriter.go with TagChanges type, field constants, format detection, MIME detection - Create flac.go with writeFlacTags using Vorbis Comments + PICTURE blocks + AtomicWrite - Implement replaceVorbisComment helper for case-insensitive field replacement - Handle cover art add/replace/clear via PICTURE metadata blocks
This commit is contained in:
@@ -9,6 +9,20 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const countArtistCreditReferences = `-- name: CountArtistCreditReferences :one
|
||||
SELECT
|
||||
(SELECT COUNT(*) FROM recordings WHERE artist_credit_id = ?1) +
|
||||
(SELECT COUNT(*) FROM release_groups WHERE album_artist_credit_id = ?1)
|
||||
AS total
|
||||
`
|
||||
|
||||
func (q *Queries) CountArtistCreditReferences(ctx context.Context, artistCreditID int64) (int64, error) {
|
||||
row := q.db.QueryRowContext(ctx, countArtistCreditReferences, artistCreditID)
|
||||
var total int64
|
||||
err := row.Scan(&total)
|
||||
return total, err
|
||||
}
|
||||
|
||||
const createArtistCredit = `-- name: CreateArtistCredit :one
|
||||
INSERT INTO artist_credit (text) VALUES (?)
|
||||
RETURNING id, text
|
||||
|
||||
@@ -10,6 +10,17 @@ import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const countGenreReferences = `-- name: CountGenreReferences :one
|
||||
SELECT COUNT(*) FROM recording_genres WHERE genre_id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) CountGenreReferences(ctx context.Context, genreID int64) (int64, error) {
|
||||
row := q.db.QueryRowContext(ctx, countGenreReferences, genreID)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const createRecordingGenre = `-- name: CreateRecordingGenre :exec
|
||||
INSERT OR IGNORE INTO recording_genres (recording_id, genre_id)
|
||||
VALUES (?, ?)
|
||||
@@ -43,6 +54,15 @@ func (q *Queries) DeleteAllRecordingGenres(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteGenre = `-- name: DeleteGenre :exec
|
||||
DELETE FROM genres WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteGenre(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteGenre, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteRecordingGenres = `-- name: DeleteRecordingGenres :exec
|
||||
DELETE FROM recording_genres
|
||||
WHERE recording_id = ?
|
||||
|
||||
@@ -10,6 +10,17 @@ import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const countRecordingsByArtistCredit = `-- name: CountRecordingsByArtistCredit :one
|
||||
SELECT COUNT(*) FROM recordings WHERE artist_credit_id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) CountRecordingsByArtistCredit(ctx context.Context, artistCreditID int64) (int64, error) {
|
||||
row := q.db.QueryRowContext(ctx, countRecordingsByArtistCredit, artistCreditID)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const createRecording = `-- name: CreateRecording :one
|
||||
INSERT INTO recordings (name, artist_credit_id) VALUES (?, ?)
|
||||
RETURNING id, name, artist_credit_id, track_number, disc_number, year, genre, composer, lyrics, comment
|
||||
|
||||
@@ -10,6 +10,17 @@ import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const countReleaseGroupRecordings = `-- name: CountReleaseGroupRecordings :one
|
||||
SELECT COUNT(*) FROM release_group_recordings WHERE release_group_id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) CountReleaseGroupRecordings(ctx context.Context, releaseGroupID int64) (int64, error) {
|
||||
row := q.db.QueryRowContext(ctx, countReleaseGroupRecordings, releaseGroupID)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const createReleaseGroup = `-- name: CreateReleaseGroup :one
|
||||
INSERT INTO release_groups (name) VALUES (?)
|
||||
RETURNING id, name, cover_art_id, album_artist_credit_id, year, total_tracks, total_discs
|
||||
|
||||
Reference in New Issue
Block a user