packages feed

lrclib-client 0.3.0 → 0.3.1

raw patch · 10 files changed

+47/−10 lines, 10 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- LrcLib.Types: [queryAlbum] :: SearchQuery -> Maybe Text
- LrcLib.Types: [queryArtist] :: SearchQuery -> Maybe Text
- LrcLib.Types: [queryName] :: SearchQuery -> Text
+ LrcLib.Types: [album] :: SearchQuery -> Maybe Text
+ LrcLib.Types: [artist] :: SearchQuery -> Maybe Text
+ LrcLib.Types: [track] :: SearchQuery -> Text

Files

lrclib-client.cabal view
@@ -1,7 +1,7 @@ cabal-version:      3.0  name:               lrclib-client-version:            0.3.0+version:            0.3.1 synopsis:           A Haskell client for the LrcLib API (lyrics database) description:   This library provides types and functions to interact with the@@ -17,6 +17,7 @@ copyright:          2026 Sand Gurt <x@proggers.ru> category:           Music, Web, API build-type:         Simple+extra-source-files: ./test/*.json, ./test/*.txt  source-repository head   type:             git
src/LrcLib/Client.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-}  -- | Module for calling LRCLIB API (<https://lrclib.net/docs>) module LrcLib.Client@@ -26,6 +25,7 @@ import Data.ByteString.Base16 qualified as B16 import Data.ByteString.Char8 qualified as BC import Data.Either (fromRight)+import Data.Maybe (catMaybes) import Data.Text (Text) import Data.Text qualified as T import Data.Text.Encoding (encodeUtf8)@@ -114,10 +114,9 @@   where     query = case q of       TextQuery t -> [("q", t)]-      TrackQuery {..} ->-        [("track_name", queryName)]-          ++ [("artist_name", artist) | Just artist <- pure queryArtist]-          ++ [("album_name", album) | Just album <- pure queryAlbum]+      TrackQuery {track, artist, album} ->+        ("track_name", track)+          : catMaybes [("artist_name",) <$> artist, ("album_name",) <$> album]  -- | Publish Lyrics ('publish') without requesting and solving challenge -- Calls @\/api\/publish@
src/LrcLib/Types.hs view
@@ -74,9 +74,9 @@ data SearchQuery   = TextQuery Text   | TrackQuery-      { queryName :: Text,-        queryArtist :: Maybe Text,-        queryAlbum :: Maybe Text+      { track :: Text,+        artist :: Maybe Text,+        album :: Maybe Text       }  -- | Response when searching lyrics
test/Main.hs view
@@ -14,7 +14,7 @@ decodeTest :: forall (a :: Type). (FromJSON a, Eq a, Read a, Show a) => FilePath -> TestTree decodeTest file = testCase file $ do   decoded <- fromJust . decode @a <$> BS.readFile (file <> ".json")-  expected <- read @a <$> readFile file+  expected <- read @a <$> readFile (file <> ".txt")   decoded @?= expected  main :: IO ()
+ test/challenge.json view
@@ -0,0 +1,4 @@+{+  "prefix": "VXMwW2qPfW2gkCNSl1i708NJkDghtAyU",+  "target": "000000FF00000000000000000000000000000000000000000000000000000000"+}
+ test/challenge.txt view
@@ -0,0 +1,1 @@+Challenge {prefix = "VXMwW2qPfW2gkCNSl1i708NJkDghtAyU",target = "000000FF00000000000000000000000000000000000000000000000000000000"}
+ test/getUrlSuccess.json view
@@ -0,0 +1,10 @@+{+  "id": 3396226,+  "trackName": "I Want to Live",+  "artistName": "Borislav Slavov",+  "albumName": "Baldur's Gate 3 (Original Game Soundtrack)",+  "duration": 233,+  "instrumental": false,+  "plainLyrics": "I feel your breath upon my neck\n...The clock won't stop and this is what we get\n",+  "syncedLyrics": "[00:17.12] I feel your breath upon my neck\n...[03:20.31] The clock won't stop and this is what we get\n[03:25.72]"+}
+ test/getUrlSuccess.txt view
@@ -0,0 +1,10 @@+TrackData+  { id = 3396226,+    trackName = "I Want to Live",+    artistName = "Borislav Slavov",+    albumName = "Baldur's Gate 3 (Original Game Soundtrack)",+    duration = 233,+    instrumental = False,+    plainLyrics = Just "I feel your breath upon my neck\n...The clock won't stop and this is what we get\n",+    syncedLyrics = Just "[00:17.12] I feel your breath upon my neck\n...[03:20.31] The clock won't stop and this is what we get\n[03:25.72]"+  }
+ test/search.json view
@@ -0,0 +1,1 @@+[{"id":2753829,"name":"Bang Bang","trackName":"Bang Bang","artistName":"Green Day","albumName":"Bang Bang","duration":205.0,"instrumental":false,"plainLyrics":"This is definitely not the first video to surface of an execution\nThe blue stash of men\nThey claimed responsibility for the executions\nDescribed as severely mentally disturbed\nIt appears to show another hostage executed by the terrorist group\nDeserve to be annihilated\n\nI get my kicks, and I wanna start a rager\nI wanna dance like I'm on the video\nI've got a fever for the violent behavior\nI'm sweating bullets like a modern Romeo\n\nBang! Bang! Gimme fame!\nShoot me up to entertain (ah-ah)\nI am a semi-automatic lonely boy\nYou're dead! I'm well fed!\nGive me death or gimme head (ah-ah)\nDaddy's little psycho, and Mommy's little soldier\n\nI testify like a lullaby of memories\nBroadcasting live, and it's on my radio\nI've got my photobomb\nI've got my Vietnam\nI love a lie just like anybody else\n\nBang! Bang! Gimme fame!\nShoot me up to entertain (ah-ah)\nI am a semi-automatic lonely boy\nYou're dead! I'm well fed!\nGive me death or gimme head (ah-ah)\nBroadcasting from my room, and playing with my toys\n\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier\n\nI wanna be like the soldiers on the screen\nIt's my private movie (holy war)\nOh baby, baby, this is viva vendetta\nOh, this is love, or it's world war zero\n\nAh ah ah\nAh ah ah\n\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier","syncedLyrics":"[00:01.26] This is definitely not the first video to surface of an execution\n[00:05.20] The blue stash of men\n[00:07.29] They claimed responsibility for the executions\n[00:09.65] Described as severely mentally disturbed\n[00:12.68] It appears to show another hostage executed by the terrorist group\n[00:16.59] Deserve to be annihilated\n[00:20.66] \n[00:41.75] I get my kicks, and I wanna start a rager\n[00:45.94] I wanna dance like I'm on the video\n[00:49.84] I've got a fever for the violent behavior\n[00:53.34] I'm sweating bullets like a modern Romeo\n[00:57.64] Bang! Bang! Gimme fame!\n[00:58.68] Shoot me up to entertain (ah-ah)\n[01:01.04] I am a semi-automatic lonely boy\n[01:04.61] You're dead! I'm well fed!\n[01:06.37] Give me death or gimme head (ah-ah)\n[01:08.42] Daddy's little psycho, and Mommy's little soldier\n[01:12.69] \n[01:20.32] I testify like a lullaby of memories\n[01:23.84] Broadcasting live, and it's on my radio\n[01:27.26] I've got my photobomb\n[01:28.97] I've got my Vietnam\n[01:30.99] I love a lie just like anybody else\n[01:35.08] Bang! Bang! Gimme fame!\n[01:36.32] Shoot me up to entertain (ah-ah)\n[01:38.62] I am a semi-automatic lonely boy\n[01:42.48] You're dead! I'm well fed!\n[01:44.28] Give me death or gimme head (ah-ah)\n[01:46.20] Broadcasting from my room, and playing with my toys\n[01:50.30] I wanna be a celebrity martyr (ah-ah)\n[01:54.16] The leading man in my own private drama\n[01:57.23] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[01:59.16] The hero of the hour\n[02:00.82] Daddy's little psycho, and Mommy's little soldier\n[02:05.52] \n[02:20.95] I wanna be like the soldiers on the screen\n[02:24.45] It's my private movie (holy war)\n[02:28.69] Oh baby, baby, this is viva vendetta\n[02:31.78] Oh, this is love, or it's world war zero\n[02:36.42] \n[02:39.36] Ah ah ah\n[02:46.67] Ah ah ah\n[02:50.21] \n[02:54.26] I wanna be a celebrity martyr (ah-ah)\n[02:57.92] The leading man in my own private drama\n[03:01.51] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[03:03.25] The hero of the hour\n[03:05.04] Daddy's little psycho, and Mommy's little soldier\n[03:09.38] I wanna be a celebrity martyr (ah-ah)\n[03:12.55] The leading man in my own private drama\n[03:16.79] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[03:18.02] The hero of the hour\n[03:20.18] Daddy's little psycho, and Mommy's little soldier\n[03:22.96] "}]
+ test/search.txt view
@@ -0,0 +1,11 @@+[ TrackData+  { id = 2753829,+    trackName = "Bang Bang",+    artistName = "Green Day",+    albumName = "Bang Bang",+    duration = 205,+    instrumental = False,+    plainLyrics = Just "This is definitely not the first video to surface of an execution\nThe blue stash of men\nThey claimed responsibility for the executions\nDescribed as severely mentally disturbed\nIt appears to show another hostage executed by the terrorist group\nDeserve to be annihilated\n\nI get my kicks, and I wanna start a rager\nI wanna dance like I'm on the video\nI've got a fever for the violent behavior\nI'm sweating bullets like a modern Romeo\n\nBang! Bang! Gimme fame!\nShoot me up to entertain (ah-ah)\nI am a semi-automatic lonely boy\nYou're dead! I'm well fed!\nGive me death or gimme head (ah-ah)\nDaddy's little psycho, and Mommy's little soldier\n\nI testify like a lullaby of memories\nBroadcasting live, and it's on my radio\nI've got my photobomb\nI've got my Vietnam\nI love a lie just like anybody else\n\nBang! Bang! Gimme fame!\nShoot me up to entertain (ah-ah)\nI am a semi-automatic lonely boy\nYou're dead! I'm well fed!\nGive me death or gimme head (ah-ah)\nBroadcasting from my room, and playing with my toys\n\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier\n\nI wanna be like the soldiers on the screen\nIt's my private movie (holy war)\nOh baby, baby, this is viva vendetta\nOh, this is love, or it's world war zero\n\nAh ah ah\nAh ah ah\n\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier\nI wanna be a celebrity martyr (ah-ah)\nThe leading man in my own private drama\nHoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\nThe hero of the hour\nDaddy's little psycho, and Mommy's little soldier",+    syncedLyrics = Just "[00:01.26] This is definitely not the first video to surface of an execution\n[00:05.20] The blue stash of men\n[00:07.29] They claimed responsibility for the executions\n[00:09.65] Described as severely mentally disturbed\n[00:12.68] It appears to show another hostage executed by the terrorist group\n[00:16.59] Deserve to be annihilated\n[00:20.66] \n[00:41.75] I get my kicks, and I wanna start a rager\n[00:45.94] I wanna dance like I'm on the video\n[00:49.84] I've got a fever for the violent behavior\n[00:53.34] I'm sweating bullets like a modern Romeo\n[00:57.64] Bang! Bang! Gimme fame!\n[00:58.68] Shoot me up to entertain (ah-ah)\n[01:01.04] I am a semi-automatic lonely boy\n[01:04.61] You're dead! I'm well fed!\n[01:06.37] Give me death or gimme head (ah-ah)\n[01:08.42] Daddy's little psycho, and Mommy's little soldier\n[01:12.69] \n[01:20.32] I testify like a lullaby of memories\n[01:23.84] Broadcasting live, and it's on my radio\n[01:27.26] I've got my photobomb\n[01:28.97] I've got my Vietnam\n[01:30.99] I love a lie just like anybody else\n[01:35.08] Bang! Bang! Gimme fame!\n[01:36.32] Shoot me up to entertain (ah-ah)\n[01:38.62] I am a semi-automatic lonely boy\n[01:42.48] You're dead! I'm well fed!\n[01:44.28] Give me death or gimme head (ah-ah)\n[01:46.20] Broadcasting from my room, and playing with my toys\n[01:50.30] I wanna be a celebrity martyr (ah-ah)\n[01:54.16] The leading man in my own private drama\n[01:57.23] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[01:59.16] The hero of the hour\n[02:00.82] Daddy's little psycho, and Mommy's little soldier\n[02:05.52] \n[02:20.95] I wanna be like the soldiers on the screen\n[02:24.45] It's my private movie (holy war)\n[02:28.69] Oh baby, baby, this is viva vendetta\n[02:31.78] Oh, this is love, or it's world war zero\n[02:36.42] \n[02:39.36] Ah ah ah\n[02:46.67] Ah ah ah\n[02:50.21] \n[02:54.26] I wanna be a celebrity martyr (ah-ah)\n[02:57.92] The leading man in my own private drama\n[03:01.51] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[03:03.25] The hero of the hour\n[03:05.04] Daddy's little psycho, and Mommy's little soldier\n[03:09.38] I wanna be a celebrity martyr (ah-ah)\n[03:12.55] The leading man in my own private drama\n[03:16.79] Hoorah! (Bang! Bang!) Hoorah! (Bang! Bang!)\n[03:18.02] The hero of the hour\n[03:20.18] Daddy's little psycho, and Mommy's little soldier\n[03:22.96] "+  }+]