Cleanup of some global functions in playerctl lib backend (#61)

This commit is contained in:
HumblePresent 2021-05-26 02:10:30 -05:00 committed by GitHub
parent 60c1e4735e
commit ae211c2cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ local interval = 1
-- Track position callback -- Track position callback
local last_position = -1 local last_position = -1
local last_length = -1 local last_length = -1
function position_cb() local function position_cb()
local player = manager.players[1] local player = manager.players[1]
if player then if player then
local position = player:get_position() / 1000000 local position = player:get_position() / 1000000
@ -74,7 +74,7 @@ local last_player = nil
local last_title = "" local last_title = ""
local last_artist = "" local last_artist = ""
local last_artUrl = "" local last_artUrl = ""
function metadata_cb(player, metadata) local function metadata_cb(player, metadata)
if update_on_activity then if update_on_activity then
manager:move_player_to_top(player) manager:move_player_to_top(player)
end end
@ -119,7 +119,7 @@ end
-- Playback status callback -- Playback status callback
-- Reported as PLAYING, PAUSED, or STOPPED -- Reported as PLAYING, PAUSED, or STOPPED
function playback_status_cb(player, status) local function playback_status_cb(player, status)
if update_on_activity then if update_on_activity then
manager:move_player_to_top(player) manager:move_player_to_top(player)
end end
@ -134,7 +134,7 @@ function playback_status_cb(player, status)
end end
-- Determine if player should be managed -- Determine if player should be managed
function name_is_selected(name) local function name_is_selected(name)
if ignore[name.name] then if ignore[name.name] then
return false return false
end end
@ -170,8 +170,8 @@ end
-- priority order -- priority order
local function player_compare_name(name_a, name_b) local function player_compare_name(name_a, name_b)
local any_index = math.huge local any_index = math.huge
local a_match_index = nil local a_match_index = nil
local b_match_index = nil local b_match_index = nil
if name_a == name_b then if name_a == name_b then
return 0 return 0
@ -273,7 +273,7 @@ local function playerctl_enable(args)
-- Grab playerctl library -- Grab playerctl library
Playerctl = require("lgi").Playerctl Playerctl = require("lgi").Playerctl
-- Ensure main event loop has started before starting player manager -- Ensure main event loop has started before starting player manager
gears.timer.delayed_call(start_manager) gears.timer.delayed_call(start_manager)
end end