Lua for Newbies 2
Posted: 07 Dec 2012 09:54
Hi,
I have been using VLC for years and thought that VLC should have a media library as the WMP or Winamp has.
I searched for it and found out that it is not fully featured as in others; if it were VLC would become clumsy and all.
So I thought I may work on it and make an extension sort of thing but for that I needed to learn Lua. I'm reading all i can about Lua especially in VLC forums.
I started by setting a goal of creating a menu entry under "View" and on clicking it a dialog box should appear where there would be entries of media files.
I have reached here in my scripting adventure:
But I cant find my extention title in the view menu.
what else is necessarily required that I should put in to make it appear in the view menu.
Am I doing something very foolish? I think I am.
Please guide me.
One more thing : I was thinking since my extension mainly deals with the visual part, should it be placed in the lua/intf folder? or lua/extensions is ok?
I have been using VLC for years and thought that VLC should have a media library as the WMP or Winamp has.
I searched for it and found out that it is not fully featured as in others; if it were VLC would become clumsy and all.
So I thought I may work on it and make an extension sort of thing but for that I needed to learn Lua. I'm reading all i can about Lua especially in VLC forums.
I started by setting a goal of creating a menu entry under "View" and on clicking it a dialog box should appear where there would be entries of media files.
I have reached here in my scripting adventure:
Code: Select all
-- File name: "flib.lua"
-- Extension description
function descriptor()
return { title = "FLibrary" ;
version = "0" ;
author = "ScitDei" ;
url = 'http://forum.videolan.org/';
shortdesc = "Video Library Using Flash";
description = "<b>FLibrary</b><hr />"
.. "VLC Extension that displays Video Library Using Flash.";
capabilities = { "interface", "meta-listener" }
}
end
-- Global variables //copied from other extension. I thought is is required as i needed button and a dialog box
dlg = nil -- Dialog
lbl_subtitle = nil -- Label widget
btn_start = nil -- Button widget
--Dialog box text
output_dialogbox = true
html1 = "<div align=\"center\" style=\"background-color:white;\"><a style=\"font-family:Verdana;font-size:36px;font-weight:bold;color:black;background-color:white;\">"
html2 = "</a></div>"
welcome = "FLibrary"
-- Activation & Deactivation
function activate()
create_dialog()
vlc.msg.dbg( "Extension activated" )
end
function deactivate()
vlc.msg.dbg( "Extension deactivated" )
end
function close()
vlc.deactivate()
end
--create dialog
function create_dialog()
dlg = vlc.dialog("FLibrary")
w1 = dlg:add_label(html1..welcome..html2, 1, 1, 10, 10)
d:add_check_box( text, welcome )
end
what else is necessarily required that I should put in to make it appear in the view menu.
Am I doing something very foolish? I think I am.
Please guide me.
One more thing : I was thinking since my extension mainly deals with the visual part, should it be placed in the lua/intf folder? or lua/extensions is ok?