Hello community,

here is the log from the commit of package lua-lua-mpris for openSUSE:Factory 
checked in at 2019-06-01 09:58:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lua-lua-mpris (Old)
 and      /work/SRC/openSUSE:Factory/.lua-lua-mpris.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lua-lua-mpris"

Sat Jun  1 09:58:33 2019 rev:7 rq:706731 version:0.0+git20190531.e505c48

Changes:
--------
--- /work/SRC/openSUSE:Factory/lua-lua-mpris/lua-lua-mpris.changes      
2018-04-30 22:59:28.455288555 +0200
+++ /work/SRC/openSUSE:Factory/.lua-lua-mpris.new.5148/lua-lua-mpris.changes    
2019-06-01 09:58:35.459129420 +0200
@@ -1,0 +2,14 @@
+Fri May 31 16:05:45 UTC 2019 - [email protected]
+
+- Update to version 0.0+git20190531.e505c48:
+  * Replace the fix for invalid utf-8 characters with a proper fix
+
+-------------------------------------------------------------------
+Thu May 30 17:07:47 UTC 2019 - [email protected]
+
+- Update to version 0.0+git20190530.1281dcd:
+  * Fix crash when media file doesn't have utf8 encoded metadata
+  (boo#1136883)
+- Use %license
+
+-------------------------------------------------------------------

Old:
----
  lua-mpris-0.0+git20170918.28b1c75.tar.xz

New:
----
  lua-mpris-0.0+git20190531.e505c48.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lua-lua-mpris.spec ++++++
--- /var/tmp/diff_new_pack.zDQLqd/_old  2019-06-01 09:58:35.963129186 +0200
+++ /var/tmp/diff_new_pack.zDQLqd/_new  2019-06-01 09:58:35.967129185 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package lua-lua-mpris
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,14 +12,14 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %define flavor @BUILD_FLAVOR@
 %define mod_name lua-mpris
 %define mpv_lua_flavor lua51
-Version:        0.0+git20170918.28b1c75
+Version:        0.0+git20190531.e505c48
 Release:        0
 Summary:        MPRIS api for lua
 License:        MIT
@@ -80,14 +80,14 @@
 fi
 
 %files
-%doc LICENSE
+%license LICENSE
 %{lua_noarchdir}/lua-mpris
 
 # Only produce during one flavor to avoid duplicate binary.
 %if "%{flavor}" == "lua51"
 %files -n mpv-plugin-mpris
 %defattr(-,root,root)
-%doc LICENSE
+%license LICENSE
 %{_datadir}/mpv-plugin-mpris
 %ghost %config %{_sysconfdir}/mpv/scripts/mpris.lua
 %ghost %dir %{_sysconfdir}/mpv/scripts

++++++ _service ++++++
--- /var/tmp/diff_new_pack.zDQLqd/_old  2019-06-01 09:58:36.007129166 +0200
+++ /var/tmp/diff_new_pack.zDQLqd/_new  2019-06-01 09:58:36.007129166 +0200
@@ -4,7 +4,6 @@
     <param name="filename">lua-mpris</param>
     <param name="versionformat">0.0+git%cd.%h</param>
     <param name="scm">git</param>
-    <param name="revision">28b1c75444eccee91eaf648d9d75361de31605bd</param>
     <param name="changesgenerate">enable</param>
   </service>
   <service name="recompress" mode="disabled">

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.zDQLqd/_old  2019-06-01 09:58:36.031129155 +0200
+++ /var/tmp/diff_new_pack.zDQLqd/_new  2019-06-01 09:58:36.031129155 +0200
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
                 <param name="url">https://github.com/antlarr/lua-mpris</param>
-              <param 
name="changesrevision">28b1c75444eccee91eaf648d9d75361de31605bd</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">e505c4872f3bcfed4b00cdd5478982c5b76455e9</param></service></servicedata>
\ No newline at end of file

++++++ lua-mpris-0.0+git20170918.28b1c75.tar.xz -> 
lua-mpris-0.0+git20190531.e505c48.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-mpris-0.0+git20170918.28b1c75/mpv.lua 
new/lua-mpris-0.0+git20190531.e505c48/mpv.lua
--- old/lua-mpris-0.0+git20170918.28b1c75/mpv.lua       2017-09-18 
19:03:38.000000000 +0200
+++ new/lua-mpris-0.0+git20190531.e505c48/mpv.lua       2019-05-31 
18:03:06.000000000 +0200
@@ -5,6 +5,69 @@
     end
 end
 
+
+local valid_utf8_sequences = { {{0,127}},
+                          {{194,223}, {128,191}},
+                          {     224 , {160,191}, {128,191}},
+                          {{225,236}, {128,191}, {128,191}},
+                          {     237 , {128,159}, {128,191}},
+                          {{238,239}, {128,191}, {128,191}},
+                          {     240 , {144,191}, {128,191}, {128,191}},
+                          {{241,243}, {128,191}, {128,191}, {128,191}},
+                          {     244 , {128,143}, {128,191}, {128,191}}
+                        }
+
+-- Returns the length (in bytes) of the character at (byte) position i of
+-- the string str . Returns -1 if there's an invalid character at position i.
+function utf8_char_length(str, i)
+    local len = string.len(str)
+
+    for k, sequence in pairs(valid_sequences) do
+        if i + #sequence - 1 > len then
+            return -1
+        end
+        ok = true
+        for j, valid in pairs(sequence) do
+            c = string.byte(str, i+j-1)
+            if type(valid) == 'table' then
+                if c < valid[1] or c > valid[2] then
+                    ok = false
+                    break
+                end
+            else
+                if c ~= valid then
+                    ok = false
+                    break
+                end
+            end
+        end
+        if ok then
+            return #sequence
+        end
+    end
+    return -1
+end
+
+
+-- Returns the string str with invalid utf8 characters removed
+function remove_invalid_utf8_chars(str)
+    local i = 1
+    local len = string.len(str)
+
+    while i <= len do
+        local seq = {}
+        local char_length = char_length(str, i)
+        if char_length > 0 then
+            i = i + char_length
+        else
+            str = string.sub(str, 1, i - 1) .. string.sub(str, i + 1)
+            len = len - 1
+        end
+    end
+
+    return str
+end
+
 local Applet = require("lua-mpris.applet")
 local mputils = require 'mp.utils'
 
@@ -137,14 +200,18 @@
 local function update_title(name, title)
     local meta = mpris.property:get('metadata')
     if title or title ~= '' then
-        meta['xesam:title'] = title
+        meta['xesam:title'] = remove_invalid_utf8_chars(title)
     else
         meta['xesam:title'] = nil
     end
     for k,assignment in pairs(assignments) do
         value = mp.get_property(assignment[2])
         if value or value ~= '' then
-            meta[assignment[1]] = value
+            if type(value) == 'string' then
+                meta[assignment[1]] = remove_invalid_utf8_chars(value)
+            else
+                meta[assignment[1]] = value
+            end
         else
             meta[assignment[1]] = nil
         end


Reply via email to