Add optional no_replace parameter to /publish #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new parameter to the payload for the
/publish
endpoint. The parameter makes it possible to attempt to publish lyrics with the intent to fail if there are already lyrics in the database for that track.The reason for this PR is that I recently purchased and downloaded some music from Bandcamp with plain lyrics embedded in the
UNSYNCEDLYRICS
tag. I would like to write a script to extract these lyrics and add them to lrclib.net in bulk (rather than manually adding each track via lrcget) but a small number of these tracks already have lyrics, a few of which are properly synced. I would obviously prefer not to replace those lyrics, but there are hundreds of tracks involved and I worry I would make a mistake trying to exclude only the relevant tracks. This new parameter would make this script safe to run, as it would prevent overwriting them.Full disclosure: I have tested that the server still can build/launch correctly with these changes, but I made no efforts to actually upload any tracks to the modified server or to otherwise test the PR. The logic involved is fairly simple and self-contained, but I would encourage checking it carefully to make sure I didn't make any mistakes.