Plugin works on Windows but not MacOS X
Posted: 23 Mar 2017 04:12
Hi,
I made a plugin to shuffle and loop a playlist once its played all items. It works fine on Windows, but on Mac OS X, the plugin loads and activate is called correctly, but none of the listeners are called and none of the dbg messages appear in the message log:
My code is here:
I made a plugin to shuffle and loop a playlist once its played all items. It works fine on Windows, but on Mac OS X, the plugin loads and activate is called correctly, but none of the listeners are called and none of the dbg messages appear in the message log:
My code is here:
Code: Select all
function descriptor()
return {
title = "Shuffle Playlist",
version = "1.1.3",
shortdesc = "Shuffle Playlist",
description = "Shuffles playlists once they are finished",
author = "Jonathan Mackenzie",
capabilities = {"input-listener", "playing-listener", "meta-listener"}
}
end
function activate()
vlc.playlist.loop('on')
vlc.playlist.play()
played = {vlc.playlist.current()}
return true
end
function deactivate()
vlc.playlist.loop('off')
vlc.playlist.stop()
vlc.deactivate()
return true
end
function close()
vlc.deactivate()
end
function meta_changed()
-- related to capabilities={"meta-listener"} in descriptor()
-- triggered by available media input meta data?
local current = vlc.playlist.current()
local input = vlc.object.input()
local elapsed = vlc.var.get(input, "time")
local total = vlc.var.get(input, "length")
local diff = total - elapsed
if diff <= 0 then
local found = false
for id,v in pairs(played) do
if v == current then found = true end
end
if found then
--if played[current] == true then
played = {}
vlc.playlist.sort("random")
vlc.msg.dbg("[Shuffle] shuffling")
else
table.insert(played, current)
local out = ""
for id,v in pairs(played) do
out = out ..v.. " "
end
vlc.msg.dbg("[Shuffle] Played: "..out)
end
end
-- vlc.msg.dbg("[Shuffle] ".. elapsed.. "/".. total .. " diff= ".. tostring(total - elapsed))
end
function input_changed()
-- related to capabilities={"input-listener"} in descriptor()
-- triggered by Start/Stop media input event
end
function playing_changed()
-- vlc.msg.dbg("[Shuffle] playing changed to "..vlc.playlist.current())
end