[vlc-devel] commit: Use lua's object syntactic sugar: a.b(a, c, d) => a:b(c, d) ( Antoine Cellerier )

git version control git at videolan.org
Sat Feb 13 19:23:22 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sat Feb 13 19:23:29 2010 +0100| [0759e71b2f6b35646acbda90406697fd7c0678d2] | committer: Antoine Cellerier 

Use lua's object syntactic sugar: a.b(a,c,d) => a:b(c,d)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0759e71b2f6b35646acbda90406697fd7c0678d2
---

 share/lua/meta/art/01_musicbrainz.lua |    2 +-
 share/lua/meta/art/02_frenchtv.lua    |    2 +-
 share/lua/meta/art/10_googleimage.lua |    2 +-
 share/lua/meta/fetcher/tvrage.lua     |    8 ++++----
 share/lua/meta/reader/filename.lua    |   10 +++++-----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/share/lua/meta/art/01_musicbrainz.lua b/share/lua/meta/art/01_musicbrainz.lua
index ac21ae3..5d2cfd0 100644
--- a/share/lua/meta/art/01_musicbrainz.lua
+++ b/share/lua/meta/art/01_musicbrainz.lua
@@ -22,7 +22,7 @@
 -- Return the artwork
 function fetch_art()
     local query
-    local meta = vlc.item.metas(vlc.item)
+    local meta = vlc.item:metas()
     if meta["artist"] and meta["album"] then
         query = "http://musicbrainz.org/ws/1/release/?type=xml&artist="..vlc.strings.encode_uri_component(meta["artist"]).."&title="..vlc.strings.encode_uri_component(meta["album"])
     else
diff --git a/share/lua/meta/art/02_frenchtv.lua b/share/lua/meta/art/02_frenchtv.lua
index 277967c..957f0d6 100644
--- a/share/lua/meta/art/02_frenchtv.lua
+++ b/share/lua/meta/art/02_frenchtv.lua
@@ -40,7 +40,7 @@ function fetch_art()
         ["Virgin 17"] = "http://upload.wikimedia.org/wikipedia/fr/3/39/Virgin17logo.png",
         ["La Chaîne Parlementaire"] = "http://upload.wikimedia.org/wikipedia/fr/9/98/Public-Senat-LCP-An_logo_2010.png"
     }
-    local meta = vlc.item.metas(vlc.item);
+    local meta = vlc.item:metas();
     local channel
     if meta["title"] then
         channel = meta["title"]
diff --git a/share/lua/meta/art/10_googleimage.lua b/share/lua/meta/art/10_googleimage.lua
index c1370d0..f42714c 100644
--- a/share/lua/meta/art/10_googleimage.lua
+++ b/share/lua/meta/art/10_googleimage.lua
@@ -31,7 +31,7 @@ end
 -- This is disabled because we have too much false positive by the inherent
 -- nature of this script.
 function fetch_art_disabled()
-    local meta = vlc.item.metas(vlc.item)
+    local meta = vlc.item:metas()
     if meta["artist"] and meta["album"] then
         title = meta["artist"].." "..meta["album"]
     elseif meta["title"] and meta["artist"] then
diff --git a/share/lua/meta/fetcher/tvrage.lua b/share/lua/meta/fetcher/tvrage.lua
index af71f0e..46c9df0 100644
--- a/share/lua/meta/fetcher/tvrage.lua
+++ b/share/lua/meta/fetcher/tvrage.lua
@@ -28,7 +28,7 @@ function get_query( title )
 end
 
 function fetch_meta()
-    local metas = vlc.item.metas(vlc.item)
+    local metas = vlc.item:metas()
 
     local showName = metas["showName"]
     if not showName then
@@ -71,9 +71,9 @@ function fetch_meta()
         return false
     end
 
-    vlc.item.set_meta(vlc.item, "title", showName.. " S"..seasonNumber.."E"..episodeNumber.." - ".. title)
-    vlc.item.set_meta(vlc.item, "artwork_url", artwork)
-    vlc.item.set_meta(vlc.item, "episodeName", title)
+    vlc.item:set_meta("title", showName.. " S"..seasonNumber.."E"..episodeNumber.." - ".. title)
+    vlc.item:set_meta("artwork_url", artwork)
+    vlc.item:set_meta("episodeName", title)
 
     return true
 end
diff --git a/share/lua/meta/reader/filename.lua b/share/lua/meta/reader/filename.lua
index 1f8665b..a1b4173 100644
--- a/share/lua/meta/reader/filename.lua
+++ b/share/lua/meta/reader/filename.lua
@@ -24,7 +24,7 @@ function trim (s)
 end
 
 function read_meta()
-    local metas = vlc.item.metas(vlc.item)
+    local metas = vlc.item:metas()
 
     -- Don't do anything if there is already a title
     if metas["title"] then
@@ -45,8 +45,8 @@ function read_meta()
 
     -- Remove . in showName
     showName = trim(string.gsub(showName, "%.", " "))
-    vlc.item.set_meta(vlc.item, "title", showName.." S"..seasonNumber.."E"..episodeNumber)
-    vlc.item.set_meta(vlc.item, "showName", showName)
-    vlc.item.set_meta(vlc.item, "episodeNumber", episodeNumber)
-    vlc.item.set_meta(vlc.item, "seasonNumber", seasonNumber)
+    vlc.item:set_meta("title", showName.." S"..seasonNumber.."E"..episodeNumber)
+    vlc.item:set_meta("showName", showName)
+    vlc.item:set_meta("episodeNumber", episodeNumber)
+    vlc.item:set_meta("seasonNumber", seasonNumber)
 end




More information about the vlc-devel mailing list