modified: Makefile.am
[enigma2-plugins.git] / SubsDownloader2 / src / SourceCode / MediaInfoDLL.py
1 ## MediaInfoDLL - All info about media files, for DLL\r
2 #  Copyright (C) 2007-2009 Jerome Martinez, Zen@MediaArea.net\r
3\r
4 #  This library is free software: you can redistribute it and/or modify it\r
5 #  under the terms of the GNU Lesser General Public License as published by\r
6 #  the Free Software Foundation, either version 3 of the License, or\r
7 #  any later version.\r
8\r
9 #  This library is distributed in the hope that it will be useful,\r
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12 #  GNU Lesser General Public License for more details.\r
13\r
14 #  You should have received a copy of the GNU Lesser General Public License\r
15 #  along with this library. If not, see <http://www.gnu.org/licenses/>.\r
16\r
17 # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
18 # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
19\r
20 #  Public DLL interface implementation\r
21 #  Wrapper for MediaInfo Library\r
22 #  Please see MediaInfo.h for help\r
23\r
24 # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\r
25 #\r
26 # Converted to python module by Petr Kaderabek\r
27 # Modifications by Jerome Martinez\r
28 #\r
29 \r
30 \r
31 import os\r
32 import sys\r
33 from ctypes import *\r
34 \r
35 if os.name == "nt" or os.name == "dos" or os.name == "os2" or os.name == "ce":\r
36         MediaInfoDLL_Handler = windll.MediaInfo\r
37         MustUseAnsi = 0\r
38 else:\r
39         #CDLL("/usr/lib/enigma2/python/Plugins/Extensions/SubsDownloader2/libs/libzen.so.0.0.0")\r
40         #MediaInfoDLL_Handler = CDLL("/usr/lib/enigma2/python/Plugins/Extensions/SubsDownloader2/libs/libmediainfo.so.0.0.0")\r
41         MediaInfoDLL_Handler = CDLL("libmediainfo.so.0")\r
42         MustUseAnsi = 1\r
43 \r
44 \r
45 # types --> C Python:\r
46 # size_t                        c_size_t\r
47 # unsigned char*        c_char_p\r
48 # enum                          c_size_t\r
49 # const wchar_t*        c_wchar_p,\r
50 # NULL                          None,\r
51 # these functions need strings in unicode format \r
52 \r
53 \r
54 \r
55 \r
56 class Stream:\r
57         General, Video, Audio, Text, Chapters, Image, Menu, Max = range(8)\r
58 \r
59 class Info:\r
60         Name, Text, Measure, Options, Name_Text, Measure_Text, Info, HowTo, Max = range(9)\r
61 \r
62 class InfoOption:\r
63         ShowInInform, Reserved, ShowInSupported, TypeOfValue, Max = range(5)\r
64 \r
65 class FileOptions:\r
66         Nothing, Recursive, CloseAll, xxNonexx_3, Max = range(5)\r
67 \r
68 \r
69 \r
70 class MediaInfo:\r
71 \r
72         #MEDIAINFO_EXP void*         __stdcall MediaInfo_New (); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/\r
73         #/** @brief A 'new' MediaInfo interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/\r
74         MediaInfo_New = MediaInfoDLL_Handler.MediaInfo_New\r
75         MediaInfo_New.argtypes = []  \r
76         MediaInfo_New.restype  = c_void_p\r
77 \r
78         #MEDIAINFO_EXP void*         __stdcall MediaInfo_New_Quick (const wchar_t* File, const wchar_t* Options); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/\r
79         MediaInfo_New_Quick = MediaInfoDLL_Handler.MediaInfo_New_Quick\r
80         MediaInfo_New_Quick.argtypes = [c_wchar_p, c_wchar_p]\r
81         MediaInfo_New_Quick.restype  = c_void_p\r
82         MediaInfoA_New_Quick = MediaInfoDLL_Handler.MediaInfoA_New_Quick\r
83         MediaInfoA_New_Quick.argtypes = [c_char_p, c_char_p]\r
84         MediaInfoA_New_Quick.restype  = c_void_p\r
85 \r
86         #/** @brief Delete a MediaInfo interface*/\r
87         #MEDIAINFO_EXP void           __stdcall MediaInfo_Delete (void* Handle);\r
88         MediaInfo_Delete = MediaInfoDLL_Handler.MediaInfo_Delete\r
89         MediaInfo_Delete.argtypes = [c_void_p]\r
90         MediaInfo_Delete.restype  = None\r
91 \r
92         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a filename)*/\r
93         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_Open (void* Handle, const wchar_t* File);\r
94         MediaInfo_Open = MediaInfoDLL_Handler.MediaInfo_Open\r
95         MediaInfo_Open.argtype = [c_void_p, c_wchar_p]\r
96         MediaInfo_Open.restype = c_size_t\r
97         MediaInfoA_Open = MediaInfoDLL_Handler.MediaInfoA_Open\r
98         MediaInfoA_Open.argtype = [c_void_p, c_char_p]\r
99         MediaInfoA_Open.restype = c_size_t\r
100 \r
101         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer) */\r
102         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/\r
103         MediaInfo_Open_Buffer = MediaInfoDLL_Handler.MediaInfo_Open_Buffer\r
104         MediaInfo_Open_Buffer.argtype = [c_void_p, c_void_p, c_size_t, c_void_p, c_size_t]  \r
105         MediaInfo_Open_Buffer.restype = c_size_t\r
106 \r
107         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Save */\r
108         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_Save (void* Handle);\r
109         MediaInfo_Save = MediaInfoDLL_Handler.MediaInfo_Save\r
110         MediaInfo_Save.argtype = [c_void_p]\r
111         MediaInfo_Save.restype = c_size_t   \r
112 \r
113         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Close */\r
114         #MEDIAINFO_EXP void           __stdcall MediaInfo_Close (void* Handle);\r
115         MediaInfo_Close = MediaInfoDLL_Handler.MediaInfo_Close\r
116         MediaInfo_Close.argtype = [c_void_p]\r
117         MediaInfo_Close.restype = None\r
118 \r
119         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Inform */\r
120         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfo_Inform (void* Handle, size_t Reserved); /*Default : Reserved=0*/\r
121         MediaInfo_Inform = MediaInfoDLL_Handler.MediaInfo_Inform\r
122         MediaInfo_Inform.argtype = [c_void_p, c_size_t]\r
123         MediaInfo_Inform.restype = c_wchar_p\r
124         MediaInfoA_Inform = MediaInfoDLL_Handler.MediaInfoA_Inform\r
125         MediaInfoA_Inform.argtype = [c_void_p, c_size_t]\r
126         MediaInfoA_Inform.restype = c_char_p\r
127 \r
128         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */\r
129         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfo_GetI (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/\r
130         MediaInfo_GetI = MediaInfoDLL_Handler.MediaInfo_GetI\r
131         MediaInfo_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t]\r
132         MediaInfo_GetI.restype = c_wchar_p\r
133         MediaInfoA_GetI = MediaInfoDLL_Handler.MediaInfoA_GetI\r
134         MediaInfoA_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t]\r
135         MediaInfoA_GetI.restype = c_char_p\r
136 \r
137         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */\r
138         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfo_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/\r
139         MediaInfo_Get = MediaInfoDLL_Handler.MediaInfo_Get\r
140         MediaInfo_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t]\r
141         MediaInfo_Get.restype = c_wchar_p\r
142         MediaInfoA_Get = MediaInfoDLL_Handler.MediaInfoA_Get\r
143         MediaInfoA_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t]\r
144         MediaInfoA_Get.restype = c_char_p\r
145 \r
146         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */\r
147         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_SetI (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter);\r
148         MediaInfo_SetI = MediaInfoDLL_Handler.MediaInfo_SetI\r
149         MediaInfo_SetI.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_size_t, c_wchar_p]\r
150         MediaInfo_SetI.restype = c_void_p\r
151         MediaInfoA_SetI = MediaInfoDLL_Handler.MediaInfoA_SetI\r
152         MediaInfoA_SetI.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_size_t, c_wchar_p]\r
153         MediaInfoA_SetI.restype = c_void_p\r
154 \r
155         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */\r
156         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_Set (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter);\r
157         MediaInfo_Set = MediaInfoDLL_Handler.MediaInfo_Set\r
158         MediaInfo_Set.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p]\r
159         MediaInfo_Set.restype = c_size_t\r
160         MediaInfoA_Set = MediaInfoDLL_Handler.MediaInfoA_Set\r
161         MediaInfoA_Set.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p]\r
162         MediaInfoA_Set.restype = c_size_t\r
163 \r
164         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Option */\r
165         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfo_Option (void* Handle, const wchar_t* Option, const wchar_t* Value);\r
166         MediaInfo_Option = MediaInfoDLL_Handler.MediaInfo_Option\r
167         MediaInfo_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p]\r
168         MediaInfo_Option.restype = c_wchar_p\r
169         MediaInfoA_Option = MediaInfoDLL_Handler.MediaInfoA_Option\r
170         MediaInfoA_Option.argtype = [c_void_p, c_char_p, c_char_p]\r
171         MediaInfoA_Option.restype = c_char_p\r
172 \r
173         #/** @brief Wrapper for MediaInfoLib::MediaInfo::State_Get */\r
174         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_State_Get (void* Handle);\r
175         MediaInfo_State_Get = MediaInfoDLL_Handler.MediaInfo_State_Get\r
176         MediaInfo_State_Get.argtype = [c_void_p]\r
177         MediaInfo_State_Get.restype = c_size_t\r
178 \r
179         #/** @brief Wrapper for MediaInfoLib::MediaInfo::Count_Get */\r
180         #MEDIAINFO_EXP size_t       __stdcall MediaInfo_Count_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/\r
181         MediaInfo_Count_Get = MediaInfoDLL_Handler.MediaInfo_Count_Get\r
182         MediaInfo_Count_Get.argtype = [c_void_p, c_size_t, c_size_t]\r
183         MediaInfo_Count_Get.restype = c_size_t\r
184 \r
185         Handle = c_void_p(0)\r
186         MustUseAnsi = 0\r
187 \r
188         #Handling\r
189         def __init__(self):\r
190                 self.Handle=self.MediaInfo_New()\r
191                 self.MediaInfoA_Option(self.Handle, "CharSet", "UTF-8")\r
192         def __del__(self):\r
193                 self.MediaInfo_Delete(self.Handle)\r
194         def Open(self, File):\r
195                 if type(File)==str:\r
196                         return self.MediaInfoA_Open (self.Handle, File);\r
197                 elif MustUseAnsi:\r
198                         return self.MediaInfoA_Open (self.Handle, File.encode("utf-8"));\r
199                 else:\r
200                         return self.MediaInfo_Open (self.Handle, File);\r
201         def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0):\r
202                 return self.MediaInfo_Open_Buffer(self.Handle, Begin, Begin_Size, End, End_Size)\r
203         def Save(self):\r
204                 return self.MediaInfo_Save(self.Handle)\r
205         def Close(self):\r
206                 return self.MediaInfo_Close(self.Handle)\r
207 \r
208         #General information\r
209         def Inform(self):\r
210                 if MustUseAnsi:\r
211                         return unicode(self.MediaInfoA_Inform(self.Handle, 0), "utf_8") \r
212                 else:\r
213                         return self.MediaInfo_Inform(self.Handle, 0)\r
214         def Get(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name):\r
215                 if type(Parameter)==str:\r
216                         return unicode(self.MediaInfoA_Get(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind), "utf_8") \r
217                 elif MustUseAnsi:\r
218                         return unicode(self.MediaInfoA_Get(self.Handle, StreamKind, StreamNumber, Parameter.encode("utf-8"), InfoKind, SearchKind), "utf_8") \r
219                 else:\r
220                         return self.MediaInfo_Get(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind)\r
221         def GetI(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text):\r
222                 if MustUseAnsi:\r
223                         return unicode(self.MediaInfoA_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind), "utf_8") \r
224                 else:\r
225                         return self.MediaInfo_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind)\r
226         def Set(self, ToSet, StreamKind, StreamNumber, Parameter, OldParameter=u""):\r
227                 if type(Parameter)==str and type(OldParameter)==unicode:\r
228                         Parameter=Parameter.decode("utf-8")\r
229                 if type(Parameter)==unicode and type(OldParameter)==str:\r
230                         OldParameter=OldParameter.decode("utf-8")\r
231                 if type(Parameter)==str:\r
232                         return self.MediaInfoA_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldParameter)\r
233                 elif MustUseAnsi:\r
234                         return self.MediaInfoA_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter.encode("utf-8"), OldParameter.encode("utf-8"))\r
235                 else:\r
236                         return self.MediaInfo_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldParameter)\r
237         def SetI(self, ToSet, StreamKind, StreamNumber, Parameter, OldValue):\r
238                 if MustUseAnsi:\r
239                         return self.MediaInfoA_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue.encode("utf-8"))\r
240                 else:\r
241                         return self.MediaInfo_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue)\r
242 \r
243         #Options\r
244         def Option(self, Option, Value=u""):\r
245                 if type(Option)==str and type(Value)==unicode:\r
246                         Option=Option.decode("utf-8")\r
247                 if type(Option)==unicode and type(Value)==str:\r
248                         Value=Value.decode("utf-8")\r
249                 if type(Option)==str:\r
250                         return unicode(self.MediaInfoA_Option(self.Handle, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") \r
251                 elif MustUseAnsi:\r
252                         return unicode(self.MediaInfoA_Option(self.Handle, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") \r
253                 else:\r
254                         return self.MediaInfo_Option(self.Handle, Option, Value)\r
255         def Option_Static(self, Option, Value=u""):\r
256                 if type(Option)==str and type(Value)==unicode:\r
257                         Option=Option.decode("utf-8")\r
258                 if type(Option)==unicode and type(Value)==str:\r
259                         Value=Value.decode("utf-8")\r
260                 if type(Option)==str:\r
261                         return unicode(self.MediaInfoA_Option(None, Option, Value), "utf_8") \r
262                 elif MustUseAnsi:\r
263                         return unicode(self.MediaInfoA_Option(None, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") \r
264                 else:\r
265                         return self.MediaInfo_Option(None, Option, Value)\r
266         def State_Get(self):\r
267                 return self.MediaInfo_State_Get(self.Handle)\r
268         def Count_Get(self, StreamKind, StreamNumber=-1):\r
269                 return self.MediaInfo_Count_Get(self.Handle, StreamKind, StreamNumber)\r
270 \r
271 \r
272 class MediaInfoList:\r
273         #/** @brief A 'new' MediaInfoList interface, return a Handle, don't forget to delete it after using it*/\r
274         #MEDIAINFO_EXP void*                 __stdcall MediaInfoList_New (); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/\r
275         MediaInfoList_New = MediaInfoDLL_Handler.MediaInfoList_New\r
276         MediaInfoList_New.argtype = []\r
277         MediaInfoList_New.restype = c_void_p\r
278 \r
279         #/** @brief A 'new' MediaInfoList interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/\r
280         #MEDIAINFO_EXP void*                 __stdcall MediaInfoList_New_Quick (const wchar_t* Files, const wchar_t* Config); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/\r
281         MediaInfoList_New_Quick = MediaInfoDLL_Handler.MediaInfoList_New_Quick\r
282         MediaInfoList_New_Quick.argtype = [c_wchar_p, c_wchar_p]\r
283         MediaInfoList_New_Quick.restype = c_void_p\r
284 \r
285         #/** @brief Delete a MediaInfoList interface*/\r
286         #MEDIAINFO_EXP void                   __stdcall MediaInfoList_Delete (void* Handle);\r
287         MediaInfoList_Delete = MediaInfoDLL_Handler.MediaInfoList_Delete\r
288         MediaInfoList_Delete.argtype = [c_void_p]\r
289 \r
290         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a filename)*/\r
291         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Open (void* Handle, const wchar_t* Files, const MediaInfo_fileoptions_C Options); /*Default : Options=MediaInfo_FileOption_Nothing*/\r
292         MediaInfoList_Open = MediaInfoDLL_Handler.MediaInfoList_Open\r
293         MediaInfoList_Open.argtype = [c_void_p, c_wchar_p, c_void_p]\r
294         MediaInfoList_Open.restype = c_void_p\r
295 \r
296         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a buffer) */\r
297         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/\r
298         MediaInfoList_Open_Buffer = MediaInfoDLL_Handler.MediaInfoList_Open_Buffer\r
299         MediaInfoList_Open_Buffer.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]\r
300         MediaInfoList_Open_Buffer.restype = c_void_p\r
301 \r
302         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Save */\r
303         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Save (void* Handle, size_t FilePos);\r
304         MediaInfoList_Save = MediaInfoDLL_Handler.MediaInfoList_Save\r
305         MediaInfoList_Save.argtype = [c_void_p, c_void_p]\r
306         MediaInfoList_Save.restype = c_void_p\r
307 \r
308         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Close */\r
309         #MEDIAINFO_EXP void                   __stdcall MediaInfoList_Close (void* Handle, size_t FilePos);\r
310         MediaInfoList_Close = MediaInfoDLL_Handler.MediaInfoList_Close\r
311         MediaInfoList_Close.argtype = [c_void_p, c_void_p]\r
312 \r
313         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Inform */\r
314         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfoList_Inform (void* Handle, size_t FilePos, size_t Reserved); /*Default : Reserved=0*/\r
315         MediaInfoList_Inform = MediaInfoDLL_Handler.MediaInfoList_Inform\r
316         MediaInfoList_Inform.argtype = [c_void_p, c_void_p, c_void_p]\r
317         MediaInfoList_Inform.restype = c_wchar_p\r
318 \r
319         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */\r
320         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfoList_GetI (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/\r
321         MediaInfoList_GetI = MediaInfoDLL_Handler.MediaInfoList_GetI\r
322         MediaInfoList_GetI.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]\r
323         MediaInfoList_GetI.restype = c_wchar_p\r
324 \r
325         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */\r
326         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfoList_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/\r
327         MediaInfoList_Get = MediaInfoDLL_Handler.MediaInfoList_Get\r
328         MediaInfoList_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_void_p, c_void_p]\r
329         MediaInfoList_Get.restype = c_wchar_p\r
330 \r
331         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */\r
332         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_SetI (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter);\r
333         MediaInfoList_SetI = MediaInfoDLL_Handler.MediaInfoList_SetI\r
334         MediaInfoList_SetI.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p]\r
335         MediaInfoList_SetI.restype = c_void_p\r
336 \r
337         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */\r
338         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Set (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter);\r
339         MediaInfoList_Set = MediaInfoDLL_Handler.MediaInfoList_Set\r
340         MediaInfoList_Set.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_wchar_p]\r
341         MediaInfoList_Set.restype = c_void_p\r
342 \r
343         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Option */\r
344         #MEDIAINFO_EXP const wchar_t*    __stdcall MediaInfoList_Option (void* Handle, const wchar_t* Option, const wchar_t* Value);\r
345         MediaInfoList_Option = MediaInfoDLL_Handler.MediaInfoList_Option\r
346         MediaInfoList_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p]\r
347         MediaInfoList_Option.restype = c_wchar_p\r
348 \r
349         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::State_Get */\r
350         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_State_Get (void* Handle);\r
351         MediaInfoList_State_Get = MediaInfoDLL_Handler.MediaInfoList_State_Get\r
352         MediaInfoList_State_Get.argtype = [c_void_p]\r
353         MediaInfoList_State_Get.restype = c_void_p\r
354 \r
355         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */\r
356         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Count_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/\r
357         MediaInfoList_Count_Get = MediaInfoDLL_Handler.MediaInfoList_Count_Get\r
358         MediaInfoList_Count_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p]\r
359         MediaInfoList_Count_Get.restype = c_void_p\r
360 \r
361         #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */\r
362         #MEDIAINFO_EXP size_t               __stdcall MediaInfoList_Count_Get_Files (void* Handle);\r
363         MediaInfoList_Count_Get_Files = MediaInfoDLL_Handler.MediaInfoList_Count_Get_Files\r
364         MediaInfoList_Count_Get_Files.argtype = [c_void_p]\r
365         MediaInfoList_Count_Get_Files.restype = c_void_p\r
366 \r
367         Handle = c_void_p(0)\r
368 \r
369         #Handling\r
370         def __init__(self):                   \r
371                 self.Handle=MediaInfoList_New()\r
372         def __del__(self):\r
373                 MediaInfoList_Delete(self.Handle)\r
374         def Open(self, Files, Options=FileOptions.Nothing):\r
375                 return MediaInfoList_Open(self.Handle, Files, Options)\r
376         def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0):\r
377                 return MediaInfoList_Open_Buffer (self.Handle, Begin, Begin_Size, End, End_Size)\r
378         def Save(self, FilePos):\r
379                 return MediaInfoList_Save(self.Handle, FilePos)\r
380         def Close(self, FilePos):\r
381                 MediaInfoList_Close (self.Handle, FilePos)\r
382 \r
383         #General information\r
384         def Inform(self, FilePos, Reserved=0):\r
385                 return MediaInfoList_Inform (self.Handle, FilePos, Reserved)\r
386         def GetI(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text):\r
387                 return MediaInfoList_GetI (self.Handle, FilePos, StreamKind, StreamNumber, Parameter, InfoKind)\r
388         def Get(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name):\r
389                 return MediaInfoList_Get (self.Handle, FilePos, StreamKind, StreamNumber, (Parameter), InfoKind, SearchKind)\r
390         def SetI(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=u""):\r
391                 return MediaInfoList_SetI (self, Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter)\r
392         def Set(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=u""):\r
393                 return MediaInfoList_Set (self.Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter)\r
394 \r
395         #Options\r
396         def Option(self, Option, Value=u""):\r
397                 return MediaInfoList_Option (self.Handle, Option, Value)\r
398         def Option_Static(self, Option, Value=u""):\r
399                 return MediaInfoList_Option(None, Option, Value)\r
400         def State_Get(self):\r
401                 return MediaInfoList_State_Get (self.Handle)\r
402         def Count_Get(self, FilePos, StreamKind, StreamNumber):\r
403                 return MediaInfoList_Count_Get (self.Handle, FilePos, StreamKind, StreamNumber=-1)\r
404         def Count_Get_Files(self):\r
405                 return MediaInfoList_Count_Get_Files (self.Handle)\r
406 \r