Hello community,

here is the log from the commit of package python-pymediainfo for 
openSUSE:Factory checked in at 2020-11-24 22:14:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pymediainfo (Old)
 and      /work/SRC/openSUSE:Factory/.python-pymediainfo.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pymediainfo"

Tue Nov 24 22:14:15 2020 rev:10 rq:850404 version:5.0.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pymediainfo/python-pymediainfo.changes    
2020-11-23 19:00:28.417968243 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pymediainfo.new.5913/python-pymediainfo.changes
  2020-11-24 22:14:30.887608716 +0100
@@ -1,0 +2,6 @@
+Tue Nov 24 10:16:29 UTC 2020 - Luigi Baldoni <aloi...@gmx.com>
+
+- Update to version 5.0.3
+  * Fix TypeError when parsing certain files
+
+-------------------------------------------------------------------

Old:
----
  pymediainfo-5.0.2.tar.gz

New:
----
  pymediainfo-5.0.3.tar.gz

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

Other differences:
------------------
++++++ python-pymediainfo.spec ++++++
--- /var/tmp/diff_new_pack.gWIV0B/_old  2020-11-24 22:14:31.515609298 +0100
+++ /var/tmp/diff_new_pack.gWIV0B/_new  2020-11-24 22:14:31.515609298 +0100
@@ -18,7 +18,7 @@
 
 %define skip_python2 1
 Name:           python-pymediainfo
-Version:        5.0.2
+Version:        5.0.3
 Release:        0
 Summary:        Python wrapper for the mediainfo library
 License:        MIT

++++++ pymediainfo-5.0.2.tar.gz -> pymediainfo-5.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/PKG-INFO 
new/pymediainfo-5.0.3/PKG-INFO
--- old/pymediainfo-5.0.2/PKG-INFO      2020-11-20 01:10:58.641353800 +0100
+++ new/pymediainfo-5.0.3/PKG-INFO      2020-11-24 00:18:27.095504800 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: pymediainfo
-Version: 5.0.2
+Version: 5.0.3
 Summary: A Python wrapper for the mediainfo library.
 Home-page: https://github.com/sbraz/pymediainfo
 Author: Louis Sautier
@@ -42,6 +42,7 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX :: Linux
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/pymediainfo/__init__.py 
new/pymediainfo-5.0.3/pymediainfo/__init__.py
--- old/pymediainfo-5.0.2/pymediainfo/__init__.py       2020-11-20 
01:10:43.000000000 +0100
+++ new/pymediainfo-5.0.3/pymediainfo/__init__.py       2020-11-24 
00:18:11.000000000 +0100
@@ -65,34 +65,38 @@
 
     def __init__(self, xml_dom_fragment: ET.Element):
         self.track_type = xml_dom_fragment.attrib["type"]
+        repeated_attributes = []
         for elem in xml_dom_fragment:
             node_name = elem.tag.lower().strip().strip("_")
             if node_name == "id":
                 node_name = "track_id"
             node_value = elem.text
-            other_node_name = "other_%s" % node_name
             if getattr(self, node_name) is None:
                 setattr(self, node_name, node_value)
             else:
+                other_node_name = f"other_{node_name}"
+                repeated_attributes.append((node_name, other_node_name))
                 if getattr(self, other_node_name) is None:
                     setattr(self, other_node_name, [node_value])
                 else:
                     getattr(self, other_node_name).append(node_value)
 
-        for other in [d for d in self.__dict__.keys() if 
d.startswith("other_")]:
+        for primary_key, other_key in repeated_attributes:
             try:
-                primary = other.replace("other_", "")
                 # Attempt to convert the main value to int
-                setattr(self, primary, int(getattr(self, primary)))
+                # Usually, if an attribute is repeated, one of its value
+                # is an int and others are human-readable formats
+                setattr(self, primary_key, int(getattr(self, primary_key)))
             except ValueError:
-                # If it fails, try to set the main value to an int taken from 
other values
-                for value in getattr(self, other):
+                # If it fails, try to find a secondary value
+                # that is an int and swap it with the main value
+                for other_value in getattr(self, other_key):
                     try:
-                        current = getattr(self, primary)
+                        current = getattr(self, primary_key)
                         # Set the main value to an int
-                        setattr(self, primary, int(value))
+                        setattr(self, primary_key, int(other_value))
                         # Append its previous value to other values
-                        getattr(self, other).append(current)
+                        getattr(self, other_key).append(current)
                         break
                     except ValueError:
                         pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/pymediainfo.egg-info/PKG-INFO 
new/pymediainfo-5.0.3/pymediainfo.egg-info/PKG-INFO
--- old/pymediainfo-5.0.2/pymediainfo.egg-info/PKG-INFO 2020-11-20 
01:10:58.000000000 +0100
+++ new/pymediainfo-5.0.3/pymediainfo.egg-info/PKG-INFO 2020-11-24 
00:18:27.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: pymediainfo
-Version: 5.0.2
+Version: 5.0.3
 Summary: A Python wrapper for the mediainfo library.
 Home-page: https://github.com/sbraz/pymediainfo
 Author: Louis Sautier
@@ -42,6 +42,7 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX :: Linux
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/pymediainfo.egg-info/SOURCES.txt 
new/pymediainfo-5.0.3/pymediainfo.egg-info/SOURCES.txt
--- old/pymediainfo-5.0.2/pymediainfo.egg-info/SOURCES.txt      2020-11-20 
01:10:58.000000000 +0100
+++ new/pymediainfo-5.0.3/pymediainfo.egg-info/SOURCES.txt      2020-11-24 
00:18:27.000000000 +0100
@@ -26,6 +26,7 @@
 tests/data/accentué.txt
 tests/data/empty.gif
 tests/data/invalid.xml
+tests/data/issue100.xml
 tests/data/issue55.flv
 tests/data/mp3.mp3
 tests/data/mp4-with-audio.mp4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/setup.py 
new/pymediainfo-5.0.3/setup.py
--- old/pymediainfo-5.0.2/setup.py      2020-11-20 01:10:43.000000000 +0100
+++ new/pymediainfo-5.0.3/setup.py      2020-11-24 00:18:11.000000000 +0100
@@ -61,6 +61,7 @@
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3 :: Only",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Operating System :: POSIX :: Linux",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/tests/data/issue100.xml 
new/pymediainfo-5.0.3/tests/data/issue100.xml
--- old/pymediainfo-5.0.2/tests/data/issue100.xml       1970-01-01 
01:00:00.000000000 +0100
+++ new/pymediainfo-5.0.3/tests/data/issue100.xml       2020-11-24 
00:18:11.000000000 +0100
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Mediainfo version="20.09">
+  <File>
+    <track type="General">
+      <Count>331</Count>
+      <Count_of_stream_of_this_kind>1</Count_of_stream_of_this_kind>
+      <Kind_of_stream>General</Kind_of_stream>
+      <Kind_of_stream>General</Kind_of_stream>
+      <Stream_identifier>0</Stream_identifier>
+      <Count_of_video_streams>1</Count_of_video_streams>
+      <Count_of_audio_streams>1</Count_of_audio_streams>
+      <OtherCount>2</OtherCount>
+      <Video_Format_List>AVC</Video_Format_List>
+      <Video_Format_WithHint_List>AVC</Video_Format_WithHint_List>
+      <Codecs_Video>AVC</Codecs_Video>
+      <Audio_Format_List>AAC LC</Audio_Format_List>
+      <Audio_Format_WithHint_List>AAC LC</Audio_Format_WithHint_List>
+      <Audio_codecs>AAC LC</Audio_codecs>
+      <Other_Format_List>RTP / RTP</Other_Format_List>
+      <Other_Format_WithHint_List>RTP / RTP</Other_Format_WithHint_List>
+      <Other_Codec_List>RTP / RTP</Other_Codec_List>
+      <Other_Language_List>English / English</Other_Language_List>
+    </track>
+  </File>
+</Mediainfo>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pymediainfo-5.0.2/tests/test_pymediainfo.py 
new/pymediainfo-5.0.3/tests/test_pymediainfo.py
--- old/pymediainfo-5.0.2/tests/test_pymediainfo.py     2020-11-20 
01:10:43.000000000 +0100
+++ new/pymediainfo-5.0.3/tests/test_pymediainfo.py     2020-11-24 
00:18:11.000000000 +0100
@@ -56,11 +56,21 @@
                 break
 
     def test_track_other_attributes(self):
-        for track in self.media_info.tracks:
-            if track.track_type == "General":
-                self.assertEqual(5, len(track.other_file_size))
-                self.assertEqual(4, len(track.other_duration))
-                break
+        general_tracks = [
+            track for track in self.media_info.tracks if track.track_type == 
"General"
+        ]
+        general_track = general_tracks[0]
+        self.assertEqual(5, len(general_track.other_file_size))
+        self.assertEqual(
+            ["1mn 1s", "1mn 1s 394ms", "1mn 1s", "00:01:01.394"], 
general_track.other_duration
+        )
+
+    def test_track_existing_other_attributes(self):
+        with open(os.path.join(data_dir, "issue100.xml")) as f:
+            media_info = MediaInfo(f.read())
+        general_tracks = [track for track in media_info.tracks if 
track.track_type == "General"]
+        general_track = general_tracks[0]
+        self.assertEqual(general_track.other_format_list, "RTP / RTP")
 
     def test_load_mediainfo_from_string(self):
         self.assertEqual(4, len(self.media_info.tracks))
@@ -142,7 +152,7 @@
 @pytest.mark.internet
 class MediaInfoURLTest(unittest.TestCase):
     def setUp(self):
-        url = 
"https://github.com/sbraz/pymediainfo/raw/master/tests/data/sample.mkv";
+        url = 
"https://github.com/sbraz/pymediainfo/raw/v5.0/tests/data/sample.mkv";
         self.media_info = MediaInfo.parse(url)
 
     def test_parse_url(self):
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to