vimus/.src/FMain.class

45 lines
2.1 KiB
Plaintext

' Gambas class file
Public Sub Timer1_Timer()
Dim songTitle As String
Dim songArtist As String
Dim songAlbum As String
Dim songYear As String
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
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
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" 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
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
songCover = Replace$(songCover, "\n", "")
songCover = Replace$(songCover, "file://", "")
'Displaying all the data on screen
TitleLabel.Text = songTitle
ArtistLabel.Text = songArtist & " · " & songAlbum & " (" & songYear & ")"
CoverPic.Picture = Picture.Load(songCover)
End
Public Sub Form_Open()
Timer1.Start
End