Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
965b82cc
Commit
965b82cc
authored
Sep 16, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't print the "googleimage.lua: didn't return a string" message if the function returned nil.
parent
9c767262
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
modules/misc/lua/luameta.c
modules/misc/lua/luameta.c
+15
-15
No files found.
modules/misc/lua/luameta.c
View file @
965b82cc
...
...
@@ -85,27 +85,27 @@ static lua_State * vlclua_meta_init( vlc_object_t *p_this, input_item_t * p_item
/* Load Lua libraries */
luaL_openlibs
(
p_state
);
/* XXX: Don't open all the libs? */
luaL_register
(
p_state
,
"vlc"
,
p_reg
);
lua_pushlightuserdata
(
p_state
,
p_this
);
lua_setfield
(
p_state
,
lua_gettop
(
p_state
)
-
1
,
"private"
);
psz_meta
=
input_item_GetName
(
p_item
);
lua_pushstring
(
p_state
,
psz_meta
);
lua_setfield
(
p_state
,
lua_gettop
(
p_state
)
-
1
,
"name"
);
free
(
psz_meta
);
psz_meta
=
input_item_GetArtist
(
p_item
);
lua_pushstring
(
p_state
,
psz_meta
);
lua_setfield
(
p_state
,
lua_gettop
(
p_state
)
-
1
,
"artist"
);
free
(
psz_meta
);
psz_meta
=
input_item_GetTitle
(
p_item
)
;
lua_pushstring
(
p_state
,
psz_meta
);
lua_setfield
(
p_state
,
lua_gettop
(
p_state
)
-
1
,
"title"
);
free
(
psz_meta
);
psz_meta
=
input_item_GetAlbum
(
p_item
);
lua_pushstring
(
p_state
,
psz_meta
);
lua_setfield
(
p_state
,
lua_gettop
(
p_state
)
-
1
,
"album"
);
...
...
@@ -135,7 +135,7 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
* functions. */
lua_pushnil
(
p_state
);
lua_setglobal
(
p_state
,
"fetch_art"
);
/* Load and run the script(s) */
if
(
luaL_dofile
(
p_state
,
psz_filename
)
)
{
...
...
@@ -178,7 +178,7 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
i_ret
=
VLC_SUCCESS
;
}
}
else
else
if
(
!
lua_isnil
(
p_state
,
s
)
)
{
msg_Err
(
p_this
,
"Lua art fetcher script %s: "
"didn't return a string"
,
psz_filename
);
...
...
@@ -206,7 +206,7 @@ static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
* functions. */
lua_pushnil
(
p_state
);
lua_setglobal
(
p_state
,
"fetch_meta"
);
/* Load and run the script(s) */
if
(
luaL_dofile
(
p_state
,
psz_filename
)
)
{
...
...
@@ -215,9 +215,9 @@ static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
lua_pop
(
p_state
,
1
);
return
VLC_EGENERIC
;
}
lua_getglobal
(
p_state
,
"fetch_meta"
);
if
(
!
lua_isfunction
(
p_state
,
lua_gettop
(
p_state
)
)
)
{
msg_Warn
(
p_this
,
"Error while runing script %s, "
...
...
@@ -225,7 +225,7 @@ static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
lua_pop
(
p_state
,
1
);
return
VLC_EGENERIC
;
}
if
(
lua_pcall
(
p_state
,
0
,
1
,
0
)
)
{
msg_Warn
(
p_this
,
"Error while runing script %s, "
...
...
@@ -234,7 +234,7 @@ static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
lua_pop
(
p_state
,
1
);
return
VLC_EGENERIC
;
}
if
((
t
=
lua_gettop
(
p_state
)))
{
...
...
@@ -268,7 +268,7 @@ int E_(FindMeta)( vlc_object_t *p_this )
meta_engine_t
*
p_me
=
(
meta_engine_t
*
)
p_this
;
input_item_t
*
p_item
=
p_me
->
p_item
;
lua_State
*
p_state
=
vlclua_meta_init
(
p_this
,
p_item
);
int
i_ret
=
vlclua_scripts_batch_execute
(
p_this
,
"luameta"
,
&
fetch_meta
,
p_state
,
p_item
);
lua_close
(
p_state
);
return
i_ret
;
...
...
@@ -282,7 +282,7 @@ int E_(FindArt)( vlc_object_t *p_this )
playlist_t
*
p_playlist
=
(
playlist_t
*
)
p_this
;
input_item_t
*
p_item
=
(
input_item_t
*
)(
p_playlist
->
p_private
);
lua_State
*
p_state
=
vlclua_meta_init
(
p_this
,
p_item
);
int
i_ret
=
vlclua_scripts_batch_execute
(
p_this
,
"luameta"
,
&
fetch_art
,
p_state
,
p_item
);
lua_close
(
p_state
);
return
i_ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment