lua warning: Error while running script C:\vlc-2.1.0-git-20120216-0009-win32\vlc-2.1.0-git-20120216-0009\lua\extensions\subtitler.lua, function (null)(): ...2.1.0-git-20120216-0009\lua\extensions\subtitler.lua:154: attempt to index field 'misc' (a nil value)
Line 154:
vlc.misc.mwait(vlc.misc.mdate() + 500000)
The countdown in the script works in VLC 1.1.x
Thanks. I am on Windows XP SP2
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
vlc.misc is only for interface scripts. See commit 52d4b4bb. You shouldn't try to use it, and it has been removed from extension scripts in VLC 2.0.
Well, I do not understand what the "commit 52d4b4bb" means.
Then if it has been removed, what should I use to repeatedly pause a script for a while insted of vlc.misc.mwait()? Is there eny alternative to this? I would like to create subtitle extension displaying subtitles in dialog box. I wanted to check actual playback time in certain time interval. You have taken me my hopes to create the extension that many users are waiting for: externa / dual subtitles :o(
I'm not convinced that VLC should provide any kind of general purpose functions to lua scripts. Meanwhile, there are many tutorials on how to sleep in lua. However, that kind of busy-looping is not very good coding practice. One way to wait on an event would be to use vlc.var.add_callback on the playback time variable.
If you really think that you need functions in vlc.misc in extension scripts, ask Rémi who removed them.
Thank you for the explanation. vlc.var.add_callback was also mentioned in VLC forum website several times but without any further details how to use it. There is no available example for this at all. There is only one "README" file (http://www.videolan.org/developers/vlc/share/lua/README.txt) that contains no examples and no information that vlc.misc is not available in extensions scripts.
Could you please tell me briefly how to use vlc.var.add_callback? Then I would share your informations with other users in VLC forum.
My "Media Context" extension needs the "vlc.misc.version()" function to ensure that it isn't being run on an old edition of VLC. This is absolutely necessary, as anything earlier than VLC v1.1.11 was horribly buggy. Since "vlc.misc" is no longer available to extensions, how else can I get the version number of VLC at runtime?
There is an example of use of vlc.var.add_callback() in hotkeys.lua. You'd probably want to use something like vlc.var.add_callback(vlc.object.input(), "time", your_function, your_data)
VLC versions earlier than 1.1.11 have known security issues and are not supported anyway, so in comparison I'm not too sure why you'd be worried about this extension being used with them. Anyway, if vlc.misc is nil then it tells you that you're on 2.0
I wrote a private message to Rémi to ask him to reconsider the disabled vlc.misc in extensions. I think that vlc.misc is quite useful feature that definitely should not be missing in extensions. If there is something from it that should not be used in extensions (vlc.misc.should_die) then put a brief remark about it in README.txt and users/developers will not use it.
I started to learn VLC Lua scripting and plan to make some new useful extensions for users. I would like to bring some new ideas enhancing the usage of VLC. For example I already made a simple script displaying running time in top-right corner of a screen in a playing movie. Unfortunately it does not work in new VLC2 due to missing vlc.misc.
I also like an idea from VLC forum to make a support for .lrc files to display songs' lyrics in a dialog box or as a karaoke like subtitles (similar to my planned script - subtitler - external/dual subtitles). It could be done as a playlist script, but a content of .lrc file could be parsed like in extension with an output to a dialog box or OSD text instead of putting new items into VLC playlist. Probably I will open a new ticket for this with a request to combine abilities of VLC scripts, at least playlists and extensions.
Please, vlc.misc is very useful (version info, various dir info, not-busy-waits) and it is so easy to enable it again. Please reconsider. Thanks
I don't think you understood the meaning of my previous message. Some lazy users might still be running VLC v1.1.10 or earlier. My "Media Context" (MC) extension tells them to upgrade their VLC version first.
Suppose something similar happens in VLC v2.x. There are still some pretty major bugs in VLC's extension code that cause it to freeze. When these finally get fixed, I will want to force MC users to upgrade VLC then too.
MC also uses "vlc.misc" in several other ways. It uses "vlc.misc.mwait()" and "vlc.misc.mdate()" to wait for the new metadata to stabilise after starting a stream. It also uses "vlc.misc.mdate()" for debugging purposes.
It uses "vlc.misc.cachedir()" to save downloaded image files about the current context (e.g. artist, album, track). Without this, MC would have to rely on unreliable environment variables (e.g. "TEMP", "TMP", "TMPDIR").
For all of these reasons, it's absolutely necessary to have "vlc.misc" or an equivalent in VLC v2.x. To be frank, it seems pretty brainless to remove this functionality without consulting the extension community first.
vlc.misc was never meant to work for any Lua script other than a Lua interface. Indeed, some parts of vlc.misc did not work properly with Lua script type.
In my opinion, mwait() and msleep() should not be used by extensions anyway. They incite polling which is a bad and harmful programming practice. If you need to wait for events, then implement correct event handling.
As for the rest of vlc.misc, patch is welcome. I did not originate the vlc.misc limitation, I will definitely not take responsibility for it on my free time.
Has your lengthy discussion with Remi about this matter reached a conclusion yet? If so, what was the verdict regarding the possibility of resurrecting "vlc.misc"? I'm stuck in limbo at the moment, not knowing what to do about my extension code ...
Has your lengthy discussion with Remi about this matter reached a conclusion yet? If so, what was the verdict regarding the possibility of resurrecting "vlc.misc"? I'm stuck in limbo at the moment, not knowing what to do about my extension code ...
I still think that we should have some kind of timer available to execute some callback functions at desired frequency and the ability to stop it. Something like: id=vlc.timer(callback, 0.1); and then after some event or after certain number of calls: vlc.timer.stop(id).
Input event responds luckily 4-5 times a second. So far I have used this only as a clock to read time value for the running time displayed in video.http://forum.videolan.org/viewtopic.php?f=29&t=97639#p331154 I will use input events in external subtitler I plan to do. What if I would like to show the running time in a dialog box that should work also without any loaded and playing film or song? Stop-watch updated every 100 ms (10 times per second), why not? The timer is useful and have a certain purpose.
The more functions script writers will have to choose from, the more new ideas and scripts will be written.
Thanks
Thanks for the notification about the mailing list messages relating to this issue. I've just posted a more detailed explanation of my dilemmas, which can be viewed by non-members here.
I had a go at modifying my Media Context extension to work without "vlc.misc.mwait()" earlier. I'm pleased to inform you that I was able to do so without any (known) drawbacks surfacing. The best news of all is that MC appears to work better than ever as a result of this change! It's more responsive and it seems to cause VLC to crash less often when "vlc.misc.mwait()" isn't used.
For these reasons, I'd like to apologise for being critical of the VLC developers who were responsible for the decision to remove "vlc.misc.mwait()" from VLC v2.x. For anyone who's interested, I'll upload a new release of MC for VLC v1.1.x in the coming days. I'll release an edition for VLC v2.x once JB has rolled-out the (caching and versioning) changes mentioned to the mailing list.