[vlc-devel] [PATCH] Download subtitles using OpenSubtitles.Org
Antoine Cellerier
dionoea at videolan.org
Wed Jan 16 13:32:07 CET 2008
On Tue, 15 Jan 2008 23:00:33 +0100, Jean-Philippe André <jpeg at via.ecp.fr>
wrote:
> It is not finished yet (really not !), but we have now a simple Qt
> interface that calls a C module which call a lua script. The lua script
> has to fetch a list of subtitles available for a movie name.
Looks good. A few comments about the code:
opensubtitles.lua:
VLC already has 2 XML parsing modules. Maybe you could add lua bindings to
the VLC XML parsing interface instead of parsing it yourself in Lua
(although that sounds cool :D ... but it's kind of duplicating existing
work).
It would be better (and clearer) if you only had one subtitles information
array. Like a local subs = { { name= ..., url=..., ... } }. That makes it
easier to iterate and prevents having to use list indices instead. (btw,
isn't subnum a bit like #subname ?) You could even returns that subs array
directly to VLC (a bit like what the playlist demux lua scripts do) instead
of returning a string which VLC will have to parse.
modules/misc/lua/{vlc.h,subtitles.c}:
Same comment about using a structure for names, langs and urls instead of 3
parrallel arrays.
I'm also planing on moving quite a bit of stuff arround in lua and cleaning
it up to make it feel a bit more like lua instead of C when coding the
scripts. That shouldn't have a big impact on what you've written but who
knows ... :)
--
dionoea
Antoine Cellerier
More information about the vlc-devel
mailing list