diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2026-01-15 20:27:18 -0500 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2026-01-15 20:27:18 -0500 |
| commit | 9a51a080b0d70e3f907c13014ea6d6911f48b09d (patch) | |
| tree | b0f335ba429248819ee9a04ea45c6e1f345987d0 /.config/quickshell/Services/Song.qml | |
| parent | 53008538e5bef961e9ceb5abc5c5ee05a559e97d (diff) | |
update qs config
Diffstat (limited to '.config/quickshell/Services/Song.qml')
| -rw-r--r-- | .config/quickshell/Services/Song.qml | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/.config/quickshell/Services/Song.qml b/.config/quickshell/Services/Song.qml index a4dc969..7c632be 100644 --- a/.config/quickshell/Services/Song.qml +++ b/.config/quickshell/Services/Song.qml @@ -8,8 +8,12 @@ Singleton { id: root property string file property string artist + property string album property string title - property string coverPath: "/home/samn/Music/cover.jpg" + readonly property string coverPath: "/home/samn/Music/cover.jpg" + + signal songChanged() + signal coverLoaded() Process { id: songProc @@ -17,15 +21,25 @@ Singleton { running: true stdout: StdioCollector { onStreamFinished: { + if (!this.text) { + root.file = "" + root.artist = "" + root.album = "" + root.title = "" + return + } + var oldFile = root.file var obj = JSON.parse(this.text); root.file = obj.file root.artist = obj.metadata.artist + root.album = obj.metadata.album root.title = obj.metadata.title if (obj.file !== oldFile) { - coverProc.exec(["ffmpeg", "-y", "-i", "/home/samn/Music/" + obj.file, "-an", "-c:v", "copy", "/home/samn/Music/cover.jpg"]) + root.songChanged() + coverProc.exec(["ffmpeg", "-y", "-i", "/home/samn/Music/" + obj.file, "-an", "-c:v", "copy", root.coverPath]) } } } @@ -34,6 +48,7 @@ Singleton { Process { id: coverProc running: false + onExited: root.coverLoaded() } Timer { |
