<commit_before>--- === hs.spotify ===
---
--- Controls for Spotify music player

local spotify = {}

local alert = require "hs.alert"
local as = require "hs.applescript"

-- Internal function to pass a command to Applescript.
local function tell(cmd)
  local _cmd = 'tell application "Spotify" to ' .. cmd
  local _ok, result = as.applescript(_cmd)
  return result
end

--- hs.spotify.play() -> nil
--- Function
--- Toggles play/pause of current spotify track
function spotify.play()
  tell('playpause')
  alert.show(' ▶', 0.5)
end

--- hs.spotify.pause() -> nil
--- Function
--- Pauses of current spotify track
function spotify.pause()
  tell('pause')
  alert.show(' ◼', 0.5)
end

--- hs.spotify.next() -> nil
--- Function
--- Skips to the next spotify track
function spotify.next()
  tell('next track')
  alert.show(' ⇥', 0.5)
end

--- hs.spotify.previous() -> nil
--- Function
--- Skips to previous spotify track
function spotify.previous()
  tell('previous track')
  alert.show(' ⇤', 0.5)
end

--- hs.spotify.displayCurrentTrack() -> nil
--- Function
--- Displays information for current track
function spotify.displayCurrentTrack()
  artist = tell('artist of the current track')
  album  = tell('album of the current track')
  track  = tell('name of the current track')
  alert.show(track .."\n".. album .."\n".. artist, 1.75)
end

return spotify<commit_msg>Add hs.spotify.getCurrentArtist(), hs.spotify.getCurrentAlbum() and hs.spotify.getCurrentTrack(). Also update hs.spotify docstrings to new format<commit_after>--- === hs.spotify ===
---
--- Controls for Spotify music player

local spotify = {}

local alert = require "hs.alert"
local as = require "hs.applescript"

-- Internal function to pass a command to Applescript.
local function tell(cmd)
  local _cmd = 'tell application "Spotify" to ' .. cmd
  local _ok, result = as.applescript(_cmd)
  return result
end

--- hs.spotify.play()
--- Function
--- Toggles play/pause of current spotify track
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
function spotify.play()
  tell('playpause')
  alert.show(' ▶', 0.5)
end

--- hs.spotify.pause()
--- Function
--- Pauses of current spotify track
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
function spotify.pause()
  tell('pause')
  alert.show(' ◼', 0.5)
end

--- hs.spotify.next()
--- Function
--- Skips to the next spotify track
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
function spotify.next()
  tell('next track')
  alert.show(' ⇥', 0.5)
end

--- hs.spotify.previous()
--- Function
--- Skips to previous spotify track
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
function spotify.previous()
  tell('previous track')
  alert.show(' ⇤', 0.5)
end

--- hs.spotify.displayCurrentTrack()
--- Function
--- Displays information for current track on screen
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
function spotify.displayCurrentTrack()
  artist = tell('artist of the current track')
  album  = tell('album of the current track')
  track  = tell('name of the current track')
  alert.show(track .."\n".. album .."\n".. artist, 1.75)
end

--- hs.spotify.getCurrentArtist()
--- Function
--- Gets the name of the artist of the current track
---
--- Parameters:
---  * None
---
--- Returns:
---  * A string containing the Artist of the current track
function spotify.getCurrentArtist()
    return tell('artist of the current track')
end

--- hs.spotify.getCurrentAlbum()
--- Function
--- Gets the name of the album of the current track
---
--- Parameters:
---  * None
---
--- Returns:
---  * A string containing the Album of the current track
function spotify.getCurrentAlbum()
    return tell('album of the current track')
end

--- hs.spotify.getCurrentTrack()
--- Function
--- Gets the name of the current track
---
--- Parameters:
---  * None
---
--- Returns:
---  * A string containing the name of the current track
function spotify.getCurrentTrack()
    return tell('name of the current track')
end

return spotify
{'fraction_non_alphanumeric': 0.1702074481379655, 'fraction_numerical': 0.005498625343664084, 'mean_word_length': 2.8005698005698005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3072571', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1261, 'n_words': 409}