File: HowToUse_Dll.py

package info (click to toggle)
libmediainfo 0.7.70-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,220 kB
  • ctags: 16,696
  • sloc: cpp: 157,850; ansic: 4,082; xml: 1,264; cs: 944; java: 719; python: 565; sh: 345; makefile: 260; pascal: 195
file content (91 lines) | stat: -rwxr-xr-x 2,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
##  Copyright (c) MediaArea.net SARL. All Rights Reserved.
 #
 #  Use of this source code is governed by a BSD-style license that can
 #  be found in the License.html file in the root of the source tree.
 ##

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Python (Windows)  example
#
# To make this example working, you must put MediaInfo.Dll and test.avi
# in the same folder
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Should be "import MediaInfoDLL" but does not work, why?
# How to import MediaInfoDLL.py correctly?
# Example following
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

from MediaInfoDLL import *

MI = MediaInfo()

Version=MI.Option_Static("Info_Version", "0.7.7.0;MediaInfoDLL_Example_Python;0.7.7.0")
if Version=="":
    print "MediaInfo.Dll: this version of the DLL is not compatible"
    exit


#Information about MediaInfo
print "Info_Parameters"
print MI.Option_Static(u"Info_Parameters")

print
print "Info_Capacities"
print MI.Option_Static(u"Info_Capacities")

print
print "Info_Codecs"
print MI.Option_Static(u"Info_Codecs")


#An example of how to use the library
print
print "Open"
MI.Open(u"Example.ogg")

print
print "Inform with Complete=false"
MI.Option_Static("Complete")
print MI.Inform()

print
print "Inform with Complete=true"
MI.Option_Static(u"Complete", u"1")
print MI.Inform()

print
print "Custom Inform"
MI.Option_Static(u"Inform", u"General;Example : FileSize=%FileSize%")
print MI.Inform()

print
print "Get with Stream=General and Parameter='FileSize'"
print MI.Get(Stream.General, 0, u"FileSize")

print
print "GetI with Stream=General and Parameter=46"
print MI.GetI(Stream.General, 0, 46)

print
print "Count_Get with StreamKind=Stream_Audio"
print MI.Count_Get(Stream.Audio)

print
print "Get with Stream=General and Parameter='AudioCount'"
print MI.Get(Stream.General, 0, u"AudioCount")

print
print "Get with Stream=Audio and Parameter='StreamCount'"
print MI.Get(Stream.Audio, 0, u"StreamCount")

print
print "Close"
MI.Close()