vlc/python | branch: master | Olivier Aubert <[email protected]> | Sun Oct 7 00:06:29 2018 +0200| [9ce8b69fd021316207f8702ca8bb14f4d1690313] | committer: Olivier Aubert
python: add movie metadata parsing test > http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=9ce8b69fd021316207f8702ca8bb14f4d1690313 --- tests/samples/README | 3 +++ tests/samples/sample.mp4 | Bin 0 -> 383631 bytes tests/test.py | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/samples/README b/tests/samples/README new file mode 100644 index 0000000..1f62939 --- /dev/null +++ b/tests/samples/README @@ -0,0 +1,3 @@ +These sample files are used in tests. + +They were downloaded from http://techslides.com/sample-files-for-development diff --git a/tests/samples/sample.mp4 b/tests/samples/sample.mp4 new file mode 100644 index 0000000..1fc4788 Binary files /dev/null and b/tests/samples/sample.mp4 differ diff --git a/tests/test.py b/tests/test.py index d958114..e8d088b 100755 --- a/tests/test.py +++ b/tests/test.py @@ -26,6 +26,7 @@ """Unittest module. """ +import os import unittest try: import urllib.parse as urllib # python3 @@ -37,6 +38,7 @@ try: except ImportError: import generated.vlc as vlc +SAMPLE = os.path.join(os.path.dirname(__file__), 'samples/sample.mp4') print ("Checking " + vlc.__file__) class TestVLCAPI(unittest.TestCase): @@ -130,11 +132,20 @@ class TestVLCAPI(unittest.TestCase): except TypeError: print("vlc.libvlc_log_get_context(ctx)") - url = '/tmp/foo.mp4' - instance = vlc.Instance('--vout dummy --aout dummy') instance.log_set(log_handler, None) player = instance.media_player_new() + def test_tracks_get(self): + self.assertTrue(os.path.exists(SAMPLE)) + m = vlc.Media(SAMPLE) + m.parse() + # Audiotrack is the second one + audiotrack = list(m.tracks_get())[1] + self.assertEqual(audiotrack.language, b"eng") + self.assertEqual(audiotrack.description, b"Stereo") + self.assertEqual(audiotrack.bitrate, 83051) + self.assertEqual(m.get_duration(), 5568) + if __name__ == '__main__': unittest.main() _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
