vimus/.src/FMain.class

57 lines
1.3 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 "playerctl metadata xesam:title" To songTitle
songTitle = Replace$(songTitle, "\n", "")
'Getting the artist name
Shell "playerctl metadata xesam:artist" To songArtist
songArtist = Replace$(songArtist, "\n", "")
'Getting the album name
Shell "playerctl metadata xesam:album" To songAlbum
songAlbum = Replace$(songAlbum, "\n", "")
'Getting the year
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 "playerctl metadata mpris:artUrl" 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)
Catch
End
Public Sub Form_Open()
Timer1.Start
End
Public Sub Form_KeyPress()
If Key.code = Key.F1 Then
AboutDiag.ShowDialog
Endif
End