Node.title is nil after vlc.sd.add_node({title="Title"})
Posted: 04 Jul 2016 08:26
When executing this dead-simple test script by activating the JTest service discovery (clicking on it), only the A entry will appear on the log, not the B one. The Jamendo SD scripts that shipped with my various VLC installations work fine in this regard and I really can’t spot the error. I verified this result on the nightly build dated to 2016-06-29 and version 2.2.3 or 2.2.4 (shouldn’t really matter, I guess). Any ideas? I already tried asking in IRC a few times and the only guy who responded couldn’t help me. I had it compiled with this online service and because I obtained this code by condensing and adapting the code of the 2.2.4 Jamendo SD script, I guess it might technically still be under the GPL in some way.
First edit: I should probably add that I had nearly zero exposure to Lua before I tried working on the script, however, I have quite a bit of experience in C++ and I’d claim to have decent knowledge of, err, general concepts of programming. I already successfully tweaked the default one to better fit my needs, it only broke when I pulled node creation out from add_playlist directly into main and I just can’t see why.
For reference, the default script, node creation on line 63.
Code: Select all
function descriptor()
return { title = "JTest", capabilities = {} }
end
function activate()
main()
end
function main()
local T = vlc.sd.add_node({title="Jamendo's Finest – Trending tracks playlist"})
if T == nil then return nil end
log("A")
if T.title == nil then return nil end
log("B")
end
function log( msg )
vlc.msg.dbg( "[JAMENDO] " .. msg )
end
I guess that’s all, ask if you need anything else.core debug: adding services_discovery lua{sd='JTest',longname='JTest'}...
core debug: looking for services_discovery module matching "lua": 8 candidates
core debug: set config option: lua-sd to JTest
core debug: set config option: lua-longname to JTest
core debug: using services_discovery module "lua"
core debug: Adding Jamendo's Finest – Trending tracks playlist in (null)
lua debug: [JAMENDO] A
lua debug: LuaSD script loaded: C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\sd\JTest.luac
core debug: meta ok for (null), need to fetch art
core debug: looking for meta fetcher module matching "any": 1 candidates
lua debug: Trying Lua scripts in C:\Users\<Username>\AppData\Roaming\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\fetcher
lua debug: Trying Lua playlist script C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\fetcher\tvrage.luac
lua debug: skipping script (unmatched scope) C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\fetcher\tvrage.luac
core debug: no meta fetcher modules matched
core debug: searching art for Jamendo's Finest – Trending tracks playlist
core debug: looking for art finder module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:\Users\<Username>\AppData\Roaming\vlc\lua\meta\art
lua debug: Trying Lua scripts in C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art
lua debug: Trying Lua playlist script C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\00_musicbrainz.luac
lua debug: skipping script (unmatched scope) C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\01_googleimage.luac
lua debug: skipping script (unmatched scope) C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\02_frenchtv.luac
lua debug: skipping script (unmatched scope) C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\02_frenchtv.luac
lua debug: Trying Lua playlist script C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\03_lastfm.luac
lua debug: skipping script (unmatched scope) C:\Dateisammlung\Programm_Install\vlc-2.2.3\lua\meta\art\03_lastfm.luac
core debug: no art finder modules matched
core debug: art not found for Jamendo's Finest – Trending tracks playlist
First edit: I should probably add that I had nearly zero exposure to Lua before I tried working on the script, however, I have quite a bit of experience in C++ and I’d claim to have decent knowledge of, err, general concepts of programming. I already successfully tweaked the default one to better fit my needs, it only broke when I pulled node creation out from add_playlist directly into main and I just can’t see why.
For reference, the default script, node creation on line 63.