feat(users/Profpatsch/whatcd-resolver): display all artists

apparently the `torrent_group` json only contains one artist, while
the torrent itself contains a list of them.

This is important, because we need the artist id and the
`torrent_group` does not provide it, only the torrent one.

Change-Id: I3db45f454f14e89ea8c8dafba2065ecd55f5bcda
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11670
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-05-14 20:42:13 +02:00 committed by clbot
parent 7197d28098
commit c1598cd2d2
2 changed files with 29 additions and 8 deletions

View file

@ -496,15 +496,21 @@ getBestTorrentsTable = do
fresh
& foldMap
( \b -> do
let artistLink :: Text = [fmt|/artist?db_id={b.groupId}|]
let artists =
b.artists
<&> ( \a ->
T2
(label @"url" [fmt|/artist?db_id={a.artistId}|])
(label @"content" $ Html.toHtml @Text a.artistName)
)
& mkLinkList
[hsx|
<tr>
<td>{localTorrent b}</td>
<td>{Html.toHtml @Int b.groupId}</td>
<td>
<a href={artistLink}>
{Html.toHtml @Text b.torrentGroupJson.artist}
</a>
{artists}
</td>
<td>{Html.toHtml @Text b.torrentGroupJson.groupName}</td>
<td>{Html.toHtml @Int b.seedingWeight}</td>
@ -532,6 +538,15 @@ getBestTorrentsTable = do
</table>
|]
mkLinkList :: [T2 "url" Text "content" Html] -> Html
mkLinkList xs =
xs
<&> ( \x -> do
[hsx|<a href={x.url}>{x.content}</a>|]
)
& List.intersperse ", "
& mconcat
getTransmissionTorrentsTable ::
(MonadTransmission m, MonadThrow m, MonadLogger m, MonadOtel m) => m Html
getTransmissionTorrentsTable = do