]> git.r.bdr.sh - rbdr/lyricli/blobdiff - Sources/lyricli/sources/spotify_source.swift
Update code, add source management config
[rbdr/lyricli] / Sources / lyricli / sources / spotify_source.swift
index 2cd66f53bf35ba012e157fa446ce935cc1770c99..863a399f2e68bc13cede3bcada3de8005ae264c1 100644 (file)
@@ -20,8 +20,14 @@ class SpotifySource: Source {
     var currentTrack: Track? {
 
         if let spotify: SpotifyApplication = SBApplication(bundleIdentifier: "com.spotify.client") {
+            if let application = spotify as? SBApplication {
+              if !application.isRunning {
+                return nil
+              }
+            }
 
             // Attempt to fetch the title from a song
+
             if let currentTrack = spotify.currentTrack {
                 if let track = currentTrack {
                     if let name = track.name {
@@ -37,4 +43,7 @@ class SpotifySource: Source {
         return nil
     }
 
+    func enable() -> Bool { return true }
+    func disable() -> Bool { return true }
+    func reset() -> Bool { return true }
 }