Merge branch 'main' into sdfs

This commit is contained in:
2 * r + 2 * t 2026-03-28 21:58:51 +11:00
commit ab4070aac9
5 changed files with 27 additions and 5 deletions

View file

@ -7,9 +7,8 @@ on:
pull_request:
jobs:
check-format:
check-qml:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/shell-arch-env:latest
@ -24,6 +23,14 @@ jobs:
end
python3 scripts/qml-lint-conventions.py
check-cpp:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/shell-arch-env:latest
steps:
- uses: actions/checkout@v6
- name: Check C++ format
shell: fish {0}
run: |

View file

@ -181,7 +181,7 @@ Item {
anchors.fill: parent
source: Players.active?.trackArtUrl ?? "" // qmllint disable incompatible-type
source: Players.getArtUrl(Players.active)
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: width

View file

@ -106,7 +106,7 @@ Item {
anchors.fill: parent
source: Players.active?.trackArtUrl ?? "" // qmllint disable incompatible-type
source: Players.getArtUrl(Players.active)
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: width

View file

@ -18,7 +18,7 @@ Item {
Image {
anchors.fill: parent
source: Players.active?.trackArtUrl ?? "" // qmllint disable incompatible-type
source: Players.getArtUrl(Players.active)
asynchronous: true
fillMode: Image.PreserveAspectCrop

View file

@ -20,6 +20,21 @@ Singleton {
return alias?.to ?? player.identity;
}
function getArtUrl(player: MprisPlayer): string {
if (!player)
return "";
if (player.trackArtUrl)
return player.trackArtUrl;
const url = player.metadata["xesam:url"] ?? "";
if (url.startsWith("https://www.youtube.com/watch")) {
// Fallback for youtube
const id = url.match(/[?&]v=([\w-]{11})/)?.[1];
return id ? `https://img.youtube.com/vi/${id}/hqdefault.jpg` : "";
}
return "";
}
Connections {
function onPostTrackChanged() {
if (!Config.utilities.toasts.nowPlaying) {