From b64717766251566bc3bc72646b711023c2773b60 Mon Sep 17 00:00:00 2001 From: gianmarco Date: Thu, 1 Sep 2022 00:19:06 +0200 Subject: [PATCH] Backend changed from DBus to playerctl, small UI tweaks and small change in the README --- .hidden/CHANGELOG | 3 +++ .icon.png | Bin 9187 -> 9187 bytes .project | 22 +++++++++++++++++++++- .src/FMain.class | 13 ++++++++----- .src/FMain.form | 8 ++++---- README.md | 2 -- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.hidden/CHANGELOG b/.hidden/CHANGELOG index 805bb2d..78ab26b 100644 --- a/.hidden/CHANGELOG +++ b/.hidden/CHANGELOG @@ -1,3 +1,6 @@ +* Thu Sep 01 2022 Gianmarco Gargiulo 0.0.2 +- Backend changed from DBus to playerctl and small UI tweaks. + * Sun Aug 14 2022 Gianmarco Gargiulo 0.0.1 - Versione iniziale diff --git a/.icon.png b/.icon.png index 9c4741aac351a578c17abb70ab5ade7e502497db..0de7ac24d6ab23840ec073ab7d6fa084bb25b453 100644 GIT binary patch delta 19 bcmaFt{@8tkEF;?y#;MwT(wmhT4=4cuOJ@d< delta 19 acmaFt{@8tkEF;@%#&&bFvdzkj2b2I%Fb6mQ diff --git a/.project b/.project index 2d9d131..326e98f 100644 --- a/.project +++ b/.project @@ -2,7 +2,7 @@ Title=Vimus Startup=FMain Icon=icon2048.png -Version=0.0.1 +Version=0.0.2 Component=gb.image Component=gb.gui.qt Component=gb.form @@ -10,4 +10,24 @@ Description="A simple song and album visualizer made with Gambas" Authors="Gianmarco Gargiulo" TabSize=2 Language=en_US +Maintainer=Gianmarco Gargiulo +Vendor=gianmarcogg03 +Address=me@gianmarco.ga +Url=https://gianmarco.ga +License=General Public License +PackageName=vimus-0.0.2 +CreateEachDirectory=1 Packager=1 +Systems=archlinux,debian,fedora,suse,ubuntu +Menus=archlinux:"Applications/Sound" +Groups=archlinux:"sound" +Menus=debian:"Applications/Sound" +Groups=debian:"sound" +Menus=fedora:"Audio Video/Music" +Categories=fedora:"AudioVideo;Music" +Groups=fedora:"Applications/Multimedia" +Menus=suse:"Audio Video/Music" +Categories=suse:"AudioVideo;Music" +Groups=suse:"Productivity/Multimedia/Sound/Visualization" +Menus=ubuntu:"Applications/Sound" +Groups=ubuntu:"sound" diff --git a/.src/FMain.class b/.src/FMain.class index 10bc873..3b7e441 100644 --- a/.src/FMain.class +++ b/.src/FMain.class @@ -10,23 +10,26 @@ Public Sub Timer1_Timer() Dim songCover As String 'Getting the title - Shell "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | sed -n '/title/{n;p}' | cut -d '\"' -f 2" To songTitle + Shell "playerctl metadata xesam:title" To songTitle songTitle = Replace$(songTitle, "\n", "") 'Getting the artist name - Shell "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | sed -n '/artist/{n;n;p}' | cut -d '\"' -f 2" To songArtist + Shell "playerctl metadata xesam:artist" To songArtist songArtist = Replace$(songArtist, "\n", "") 'Getting the album name - Shell "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | sed -n '/album/{n;p}' | cut -d '\"' -f 2 | sed '2d'" To songAlbum + Shell "playerctl metadata xesam:album" To songAlbum songAlbum = Replace$(songAlbum, "\n", "") 'Getting the year - Shell "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | sed -n '/year/{n;p}' | cut -d '\"' -f 2 | awk '{ print $3 }'" To songYear + Shell "playerctl metadata year" To songYear + If songYear = "" Then + Shell "playerctl metadata xesam:contentCreated | awk '{print substr ($0, 0, 4)}'" To songYear + Endif songYear = Replace$(songYear, "\n", "") 'Getting the cover art - Shell "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | sed -n '/artUrl/{n;p}' | cut -d '\"' -f 2" To songCover + Shell "playerctl metadata mpris:artUrl" To songCover songCover = Replace$(songCover, "\n", "") songCover = Replace$(songCover, "file://", "") diff --git a/.src/FMain.form b/.src/FMain.form index ff8b94c..2977ebd 100644 --- a/.src/FMain.form +++ b/.src/FMain.form @@ -9,20 +9,20 @@ Arrangement = Arrange.Fill Centered = True { MainPanel Panel - MoveScaled(0,16,177,58) + MoveScaled(0,8,177,73) { CoverPic PictureBox - MoveScaled(70.7143,0,36.5714,36.5714) + MoveScaled(60.4286,0,56,56) Picture = Picture.Load("icon:/256/audio") Stretch = True } { TitleLabel Label - MoveScaled(0,40,178,10) + MoveScaled(0,58,177,9) Font = Font["Bold,+6"] Alignment = Align.Center Text = ("No title") } { ArtistLabel Label - MoveScaled(-3,51,184,6) + MoveScaled(0,67,177,6) Font = Font["+2"] Alignment = Align.Center Text = ("No artist ยท No album (No year)") diff --git a/README.md b/README.md index a4e4f13..251d9e9 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,3 @@ It's really really simple: when you play a song in Clementine (for now it's hard ![Daft Punk's Robot Rock](https://gianmarco.ga/software/img/robotrock.png) ![Thomas Bangalter's Colossus](https://gianmarco.ga/software/img/colossus.png) - -The code itself is very bad and hacky and was done in just a few days, just a bunch of shell commands directing to DBus to get the data Vimus needs to display. Feel free to suggest any changes or to make a pull request to make it simpler and more efficient.