diff --git a/readme.md b/readme.md index dfe04d5..100ae74 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,4 @@ An OBS script to display Spotify track info on macOS ``` {n} = Name {a} = Artist -``` - -If Spotify App is not running, it will also display as paused \ No newline at end of file +``` \ No newline at end of file diff --git a/spotify.lua b/spotify.lua index e6be3ac..6dc6145 100644 --- a/spotify.lua +++ b/spotify.lua @@ -1,6 +1,7 @@ --- Spotify Mac 1.0 --- Display Now Playing Track Info +-- Name: Spotify Mac 1.1 +-- Description: Display Now Playing Track Info -- Author: Ray (rayps.com) +-- Repo: https://github.com/RayPS/obs-spotify-mac/ obs = obslua @@ -11,14 +12,14 @@ interval = 1 function update_text(source) local result = spotify() - local paused = true + local text = "[Spofity not running]" if result ~= "" then result = split(result, ", ") - paused = (result[1] == "paused") + local paused = (result[1] == "paused") + local format = paused and format_paused or format_playing + text = format:gsub("{n}", result[2]):gsub("{a}", result[3]) end - local format = paused and format_paused or format_playing - local text = format:gsub("{n}", result[2]):gsub("{a}", result[3]) local settings = obs.obs_data_create() obs.obs_data_set_string(settings, "text", text) obs.obs_source_update(source, settings) @@ -82,7 +83,7 @@ function script_description()
{n} = Name {a} = Artist
- +