KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org Free Qt Applications 
 Qt-Prop.org Proprietary Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Frugalware-Art.org Artwork for Frugalware Linux 
 Arch-Stuff.org Artwork and Stuff for Arch Linux 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    Linux42.org    OpenSkillz.com   
Kubuntu-Art.org - Stuff for your Kubuntu Desktop

 Aug 31 2016  
 Not logged in  
 Home    Add Artwork   Forum   Groups   Knowledge   Events   Jobs   Users   Register   Login-

- New questions .- Answered question .- Not answered question .- My questions .- Post your question here . 
Go back to the overview page to see other entries
Back to overview

click to vote up

My LUA Extension is Crashing VLC... :(

Programming - May 3 2014
not answered
Question:Hello Guys,

Not a programmer...

So I Created this little extension that tells me at what time my playlist will be over... basically, it adds up the time of all items in playlist and ands it to the os.time()...

Please excuse my bad habits, I know there is a million better ways to handle the variables, do the additions, etc... Any help is appreciated in any part of the code, but the code works for what it need it, now here is my problem;

When i leave the Extension open and ADD about 5 or 7 items to the playlist VLC Crashes... this does not happen if i close the Extension and open it again after just a few additions... any hints?! please see attached image so you get an idea.. This Happens in Windows7, 8 and Ubuntu...

Ohh also, if you run the Extension, you'll notice the window that pops up gets larger and larger every time you hit "Calculate" ... This is because I dont know how to Clean the window for an "add_label()" any help is much appreciated...

Here is the CODE:

-- Global Variables
cn = 1

function descriptor()
return { title = "TimeCalc" ;
version = "-1.0" ;
author = "Cesar Fernandez" ;
url = '';
shortdesc = "Time Calc";
description = "Time playlist end calc Tool" ;

function activate()
w = vlc.dialog("Time calc")
w:add_button("Clean PLaylist", clean_playlist, 1, cn, 1, 1)
w:add_button("Calculate", calculate, 2, cn, 1, 1)
cn= cn + 2


function deactivate()

function calculate()
if vlc.playlist.current()>0 then
w:add_label("Current System time:", 1, cn, 1, 2)
w:add_label(os.date(), 2, cn, 1, 2)
cn= cn + 2
w:add_label("Will play until:", 1, cn, 1, 2)

local SecsToAdd = playlist_duration() - vlc.var.get(vlc.object.input(), "time")
SecsToAdd = round(SecsToAdd, 0)
local systemYear = os.date("%y")
local systemMonth = os.date("%m")
local systemDay = os.date("%d")
local systemHour = os.date("%H")
local systemMinute = os.date("%M")
local systemSecond = os.date("%S")
local endY = systemYear
local endMo = systemMonth
local endD = systemDay
local endH = systemHour
local endM = systemMinute
local endS = systemSecond

while SecsToAdd >= 86400 do -- longer than a day
SecsToAdd = SecsToAdd - 86400
endD = endD + 1

while SecsToAdd >= 3600 do -- longer than an hour
SecsToAdd = SecsToAdd - 3600
endH = endH + 1
if endH >= 24 then--check if schedule goes to next day
endH = endH - 24
endD = endD + 1

while SecsToAdd >= 60 do -- longer than a min
SecsToAdd = SecsToAdd - 60
endM = endM + 1
if endM >= 60 then --check if schedule goes to next hour
endM = endM - 60
endH = endH + 1
if endH >= 24 then --check if schedule goes to next day
endH = endH - 24
endD = endD + 1

endS = endS + SecsToAdd -- Rest of Secs
if endS >= 60 then --check if schedule goes to next Min
endS = endS - 60
endM = endM + 1
if endM >= 60 then--check if schedule goes to next hour
endM = endM - 60
endH = endH + 1
if endH >= 24 then--check if schedule goes to next day
endH = endH - 24
endD = endD + 1
w:add_label(endMo .. "/" .. endD .. "/" .. endY .. " " .. endH .. ":" .. endM ..":" .. endS, 2, cn, 1, 2)
cn= cn + 2

w:add_label("ERR - No Active Item in Playlist", 1, cn, 1, 2)
cn= cn + 2

function clean_playlist()
local i = vlc.playlist.current()
while i >4 do
i = i - 1


function playlist_duration()
local sum = 0
local play_list = vlc.playlist.get("playlist",false)
for k, item in pairs(play_list.children) do
if item.duration ~= -1 then
sum = sum + item.duration
return sum

function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult

function close()


Thanks a Ton!!!

My LUA Extension is Crashing VLC... :(  

Add answer
Back to overview

Add comment

Do you have a question?
Post your question here


Copyright 2007-2016 Kubuntu-Art.org Team  Legal Notice
All rights reserved. Kubuntu-Art.org is not liable for any content or goods on this site.
You can find our FAQ here.
All contributors are responsible for the lawfulness of their uploads.
Please send us a notice if you spot an ABUSE of the website.
Information about advertising in Kubuntu-Art.org.
Developers can use our public webservice interface. More information here: public api
For further information or comments on this site, please send us a message
Kubuntu is a registered trademark of Canonical Ltd.
Content RSS   
Events RSS