lyrpy 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lyr/LUConsole.py +402 -0
- lyr/LUConst.py +45 -0
- lyr/LUDateTime.py +207 -0
- lyr/LUDecotators.py +418 -0
- lyr/LUDict.py +117 -0
- lyr/LUDoc.py +61 -0
- lyr/LUErrors.py +80 -0
- lyr/LUFile.py +1174 -0
- lyr/LUFileUtils.py +486 -0
- lyr/LULog.py +2249 -0
- lyr/LUNetwork.py +277 -0
- lyr/LUNumUtils.py +305 -0
- lyr/LUObjects.py +208 -0
- lyr/LUObjectsYT.py +829 -0
- lyr/LUParserARG.py +365 -0
- lyr/LUParserINI.py +371 -0
- lyr/LUParserREG.py +510 -0
- lyr/LUProc.py +110 -0
- lyr/LUQThread.py +139 -0
- lyr/LUQTimer.py +197 -0
- lyr/LUSheduler.py +940 -0
- lyr/LUStrDecode.py +223 -0
- lyr/LUStrUtils.py +633 -0
- lyr/LUSupport.py +124 -0
- lyr/LUThread.py +176 -0
- lyr/LUTimer.py +139 -0
- lyr/LUVersion.py +380 -0
- lyr/LUYouTube.py +204 -0
- lyr/LUos.py +797 -0
- lyr/LUsys.py +47 -0
- lyr/__init__.py +21 -0
- lyr/__main__.py +19 -0
- lyrpy-0.0.2.dist-info/LICENSE +19 -0
- lyrpy-0.0.2.dist-info/METADATA +19 -0
- lyrpy-0.0.2.dist-info/RECORD +37 -0
- lyrpy-0.0.2.dist-info/WHEEL +5 -0
- lyrpy-0.0.2.dist-info/top_level.txt +1 -0
lyr/LUVersion.py
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"""LUVersion.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023-2024
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUVersion.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
#------------------------------------------
|
|
17
|
+
# БИБЛИОТЕКИ python
|
|
18
|
+
#------------------------------------------
|
|
19
|
+
import os
|
|
20
|
+
import platform
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
import datetime
|
|
26
|
+
|
|
27
|
+
# if platform.system() == 'Windows':
|
|
28
|
+
# import win32api
|
|
29
|
+
# import win32con
|
|
30
|
+
# #endif
|
|
31
|
+
|
|
32
|
+
#------------------------------------------
|
|
33
|
+
# БИБЛИОТЕКА LU
|
|
34
|
+
#------------------------------------------
|
|
35
|
+
|
|
36
|
+
class TVersionInfo:
|
|
37
|
+
"""TVersionInfo"""
|
|
38
|
+
luClassName = "TVersionInfo"
|
|
39
|
+
|
|
40
|
+
#--------------------------------------------------
|
|
41
|
+
# constructor
|
|
42
|
+
#--------------------------------------------------
|
|
43
|
+
def __init__(self):
|
|
44
|
+
self.__FFileName = ''
|
|
45
|
+
self.__FInfo = None
|
|
46
|
+
self.__FFileDate = 0
|
|
47
|
+
self.__FFileVersion = ''
|
|
48
|
+
self.__FFileInfoSize = 0
|
|
49
|
+
self.__FInfoSize = 0
|
|
50
|
+
self.__FFileInfo = None
|
|
51
|
+
self.__FCompanyName = ''
|
|
52
|
+
self.__FFileDescription = ''
|
|
53
|
+
self.__FInternalName = ''
|
|
54
|
+
self.__FLegalTrademarks = ''
|
|
55
|
+
self.__FLegalCopyright = ''
|
|
56
|
+
self.__FProductName = ''
|
|
57
|
+
self.__FOriginalFilename = ''
|
|
58
|
+
self.__FProductVersion = ''
|
|
59
|
+
self.__FComments = ''
|
|
60
|
+
|
|
61
|
+
self.__lang = ''
|
|
62
|
+
self.__codepage = ''
|
|
63
|
+
|
|
64
|
+
self.__FTmp = None
|
|
65
|
+
self.__FTransInfo = None
|
|
66
|
+
self.__FTransInfoSize = 0
|
|
67
|
+
|
|
68
|
+
#--------------------------------------------------
|
|
69
|
+
# destructor
|
|
70
|
+
#--------------------------------------------------
|
|
71
|
+
def __del__(self):
|
|
72
|
+
#beginfunction
|
|
73
|
+
LClassName = self.__class__.__name__
|
|
74
|
+
s = '{} уничтожен'.format (LClassName)
|
|
75
|
+
#print (s)
|
|
76
|
+
#endfunction
|
|
77
|
+
|
|
78
|
+
#--------------------------------------------------
|
|
79
|
+
# @property FileName
|
|
80
|
+
#--------------------------------------------------
|
|
81
|
+
# getter
|
|
82
|
+
@property
|
|
83
|
+
def FileName(self):
|
|
84
|
+
#beginfunction
|
|
85
|
+
return self.__FFileName
|
|
86
|
+
#endfunction
|
|
87
|
+
# setter
|
|
88
|
+
@FileName.setter
|
|
89
|
+
def FileName(self, Value: str):
|
|
90
|
+
propNames = ('Comments', 'InternalName', 'ProductName',
|
|
91
|
+
'CompanyName', 'LegalCopyright', 'ProductVersion',
|
|
92
|
+
'FileDescription', 'LegalTrademarks', 'PrivateBuild',
|
|
93
|
+
'FileVersion', 'OriginalFilename', 'SpecialBuild')
|
|
94
|
+
|
|
95
|
+
props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
|
|
96
|
+
#beginfunction
|
|
97
|
+
if Value == '':
|
|
98
|
+
return
|
|
99
|
+
self.__FFileName = Value
|
|
100
|
+
# Get the size of the FileVersionInformatioin
|
|
101
|
+
if self.__FInfoSize > 0:
|
|
102
|
+
pass
|
|
103
|
+
#self.__FInfoSize = win32api.GetFileVersionInfoSize(self.__FFileName.encode(), None)
|
|
104
|
+
# If InfoSize = 0, then the file may not exist, or
|
|
105
|
+
# it may not have file version information in it.
|
|
106
|
+
#if self.__FInfoSize == 0:
|
|
107
|
+
# raise Exception.Create("Can''t get file version information for "+self.__FFileName)
|
|
108
|
+
|
|
109
|
+
#file modification
|
|
110
|
+
#self.__FFileDate = FileDateToDateTime(FileAge(Value))
|
|
111
|
+
LFileTimeSource = os.path.getmtime(self.__FFileName)
|
|
112
|
+
#convert timestamp into DateTime object
|
|
113
|
+
self.__FFileDate = datetime.datetime.fromtimestamp(LFileTimeSource)
|
|
114
|
+
|
|
115
|
+
# Get the information
|
|
116
|
+
#self.__FInfo = win32api.GetFileVersionInfo(self.__FFileName, 0, self.__FInfoSize, self.__FInfo)
|
|
117
|
+
# backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
|
|
118
|
+
self.__FInfo = win32api.GetFileVersionInfo (self.__FFileName, '\\')
|
|
119
|
+
props ['FixedFileInfo'] = self.__FInfo
|
|
120
|
+
props ['FileVersion'] = "%d.%d.%d.%d" % (self.__FInfo ['FileVersionMS'] / 65536,
|
|
121
|
+
self.__FInfo ['FileVersionMS'] % 65536,
|
|
122
|
+
self.__FInfo ['FileVersionLS'] / 65536,
|
|
123
|
+
self.__FInfo ['FileVersionLS'] % 65536)
|
|
124
|
+
self.__FFileVersion = props ['FileVersion']
|
|
125
|
+
|
|
126
|
+
# \VarFileInfo\Translation returns list of available (language, codepage)
|
|
127
|
+
# pairs that can be used to retreive string info. We are using only the first pair.
|
|
128
|
+
self.__lang, self.__codepage = win32api.GetFileVersionInfo (self.__FFileName, '\\VarFileInfo\\Translation') [0]
|
|
129
|
+
#print ('__lang = ',self.__lang)
|
|
130
|
+
#print ('__codepage = ', self.__codepage)
|
|
131
|
+
|
|
132
|
+
# any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
|
|
133
|
+
# two are language/codepage pair returned from above
|
|
134
|
+
strInfo = {}
|
|
135
|
+
for propName in propNames:
|
|
136
|
+
strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (self.__lang, self.__codepage, propName)
|
|
137
|
+
#print str_info
|
|
138
|
+
strInfo [propName] = win32api.GetFileVersionInfo (self.__FFileName, strInfoPath)
|
|
139
|
+
props ['StringFileInfo'] = strInfo
|
|
140
|
+
self.__FCompanyName = strInfo ['CompanyName']
|
|
141
|
+
self.__FFileDescription = strInfo ['FileDescription']
|
|
142
|
+
self.__FInternalName = strInfo ['InternalName']
|
|
143
|
+
self.__FLegalCopyright = strInfo ['LegalCopyright']
|
|
144
|
+
self.__FLegalTrademarks = strInfo ['LegalTrademarks']
|
|
145
|
+
self.__FOriginalFilename = strInfo ['OriginalFilename']
|
|
146
|
+
self.__FProductName = strInfo ['ProductName']
|
|
147
|
+
self.__FProductVersion = strInfo ['ProductVersion']
|
|
148
|
+
self.__FComments = strInfo ['Comments']
|
|
149
|
+
#endfunction
|
|
150
|
+
|
|
151
|
+
#--------------------------------------------------
|
|
152
|
+
# @property Major1
|
|
153
|
+
#--------------------------------------------------
|
|
154
|
+
# getter
|
|
155
|
+
@property
|
|
156
|
+
def Major1(self):
|
|
157
|
+
#beginfunction
|
|
158
|
+
LResult = int(self.__FInfo ['FileVersionMS'] / 65536)
|
|
159
|
+
return LResult
|
|
160
|
+
#endfunction
|
|
161
|
+
|
|
162
|
+
#--------------------------------------------------
|
|
163
|
+
# @property Major2
|
|
164
|
+
#--------------------------------------------------
|
|
165
|
+
# getter
|
|
166
|
+
@property
|
|
167
|
+
def Major2(self):
|
|
168
|
+
#beginfunction
|
|
169
|
+
LResult = int(self.__FInfo ['FileVersionMS'] % 65536)
|
|
170
|
+
return LResult
|
|
171
|
+
#endfunction
|
|
172
|
+
|
|
173
|
+
#--------------------------------------------------
|
|
174
|
+
# @property Minor1
|
|
175
|
+
#--------------------------------------------------
|
|
176
|
+
# getter
|
|
177
|
+
@property
|
|
178
|
+
def Minor1(self):
|
|
179
|
+
#beginfunction
|
|
180
|
+
LResult = int(self.__FInfo ['FileVersionLS'] / 65536)
|
|
181
|
+
return LResult
|
|
182
|
+
#endfunction
|
|
183
|
+
|
|
184
|
+
#--------------------------------------------------
|
|
185
|
+
# @property Minor2
|
|
186
|
+
#--------------------------------------------------
|
|
187
|
+
# getter
|
|
188
|
+
@property
|
|
189
|
+
def Minor2(self):
|
|
190
|
+
#beginfunction
|
|
191
|
+
LResult = int(self.__FInfo ['FileVersionLS'] % 65536)
|
|
192
|
+
return LResult
|
|
193
|
+
#endfunction
|
|
194
|
+
|
|
195
|
+
#--------------------------------------------------
|
|
196
|
+
# @property Lang1
|
|
197
|
+
#--------------------------------------------------
|
|
198
|
+
# getter
|
|
199
|
+
@property
|
|
200
|
+
def Lang1(self):
|
|
201
|
+
#beginfunction
|
|
202
|
+
#Result = self.__FTransInfo.dwLang1
|
|
203
|
+
LResult = ''
|
|
204
|
+
return LResult
|
|
205
|
+
#endfunction
|
|
206
|
+
|
|
207
|
+
#--------------------------------------------------
|
|
208
|
+
# @property Lang2
|
|
209
|
+
#--------------------------------------------------
|
|
210
|
+
# getter
|
|
211
|
+
@property
|
|
212
|
+
def Lang2(self):
|
|
213
|
+
#beginfunction
|
|
214
|
+
#Result = self.__FTransInfo.dwLang2
|
|
215
|
+
LResult = ''
|
|
216
|
+
return LResult
|
|
217
|
+
#endfunction
|
|
218
|
+
|
|
219
|
+
#--------------------------------------------------
|
|
220
|
+
# @property LangCharSet
|
|
221
|
+
#--------------------------------------------------
|
|
222
|
+
# getter
|
|
223
|
+
@property
|
|
224
|
+
def LangCharSet(self):
|
|
225
|
+
#beginfunction
|
|
226
|
+
#Result = IntToHex(Lang1,4)+IntToHex(Lang2,4)
|
|
227
|
+
LResult = ''
|
|
228
|
+
return LResult
|
|
229
|
+
#endfunction
|
|
230
|
+
|
|
231
|
+
#--------------------------------------------------
|
|
232
|
+
# @property FileVersion
|
|
233
|
+
#--------------------------------------------------
|
|
234
|
+
# getter
|
|
235
|
+
@property
|
|
236
|
+
def FileVersion(self):
|
|
237
|
+
#beginfunction
|
|
238
|
+
LResult = self.__FFileVersion
|
|
239
|
+
return LResult
|
|
240
|
+
#endfunction
|
|
241
|
+
|
|
242
|
+
#--------------------------------------------------
|
|
243
|
+
# @property FileDate
|
|
244
|
+
#--------------------------------------------------
|
|
245
|
+
# getter
|
|
246
|
+
@property
|
|
247
|
+
def FileDate(self):
|
|
248
|
+
#beginfunction
|
|
249
|
+
LResult = self.__FFileDate
|
|
250
|
+
return LResult
|
|
251
|
+
#endfunction
|
|
252
|
+
|
|
253
|
+
#--------------------------------------------------
|
|
254
|
+
# @property CompanyName
|
|
255
|
+
#--------------------------------------------------
|
|
256
|
+
# getter
|
|
257
|
+
@property
|
|
258
|
+
def CompanyName(self):
|
|
259
|
+
#beginfunction
|
|
260
|
+
LResult = self.__FCompanyName
|
|
261
|
+
return LResult
|
|
262
|
+
#endfunction
|
|
263
|
+
|
|
264
|
+
#--------------------------------------------------
|
|
265
|
+
# @property FileDescription
|
|
266
|
+
#--------------------------------------------------
|
|
267
|
+
# getter
|
|
268
|
+
@property
|
|
269
|
+
def FileDescription(self):
|
|
270
|
+
#beginfunction
|
|
271
|
+
LResult = self.__FFileDescription
|
|
272
|
+
return LResult
|
|
273
|
+
#endfunction
|
|
274
|
+
|
|
275
|
+
#--------------------------------------------------
|
|
276
|
+
# @property InternalName
|
|
277
|
+
#--------------------------------------------------
|
|
278
|
+
# getter
|
|
279
|
+
@property
|
|
280
|
+
def InternalName(self):
|
|
281
|
+
#beginfunction
|
|
282
|
+
LResult = self.__FInternalName
|
|
283
|
+
return LResult
|
|
284
|
+
#endfunction
|
|
285
|
+
|
|
286
|
+
#--------------------------------------------------
|
|
287
|
+
# @property LegalCopyright
|
|
288
|
+
#--------------------------------------------------
|
|
289
|
+
# getter
|
|
290
|
+
@property
|
|
291
|
+
def LegalCopyright(self):
|
|
292
|
+
#beginfunction
|
|
293
|
+
LResult = self.__FLegalCopyright
|
|
294
|
+
return LResult
|
|
295
|
+
#endfunction
|
|
296
|
+
|
|
297
|
+
#--------------------------------------------------
|
|
298
|
+
# @property LegalTrademarks
|
|
299
|
+
#--------------------------------------------------
|
|
300
|
+
# getter
|
|
301
|
+
@property
|
|
302
|
+
def LegalTrademarks(self):
|
|
303
|
+
#beginfunction
|
|
304
|
+
LResult = self.__FLegalTrademarks
|
|
305
|
+
return LResult
|
|
306
|
+
#endfunction
|
|
307
|
+
|
|
308
|
+
#--------------------------------------------------
|
|
309
|
+
# @property OriginalFilename
|
|
310
|
+
#--------------------------------------------------
|
|
311
|
+
# getter
|
|
312
|
+
@property
|
|
313
|
+
def OriginalFilename(self):
|
|
314
|
+
#beginfunction
|
|
315
|
+
LResult = self.__FOriginalFilename
|
|
316
|
+
return LResult
|
|
317
|
+
#endfunction
|
|
318
|
+
|
|
319
|
+
#--------------------------------------------------
|
|
320
|
+
# @property ProductName
|
|
321
|
+
#--------------------------------------------------
|
|
322
|
+
# getter
|
|
323
|
+
@property
|
|
324
|
+
def ProductName(self):
|
|
325
|
+
#beginfunction
|
|
326
|
+
LResult = self.__FProductName
|
|
327
|
+
return LResult
|
|
328
|
+
#endfunction
|
|
329
|
+
|
|
330
|
+
#--------------------------------------------------
|
|
331
|
+
# @property ProductVersion
|
|
332
|
+
#--------------------------------------------------
|
|
333
|
+
# getter
|
|
334
|
+
@property
|
|
335
|
+
def ProductVersion(self):
|
|
336
|
+
#beginfunction
|
|
337
|
+
LResult = self.__FProductVersion
|
|
338
|
+
return LResult
|
|
339
|
+
#endfunction
|
|
340
|
+
|
|
341
|
+
#--------------------------------------------------
|
|
342
|
+
# @property Comments
|
|
343
|
+
#--------------------------------------------------
|
|
344
|
+
# getter
|
|
345
|
+
@property
|
|
346
|
+
def Comments(self):
|
|
347
|
+
#beginfunction
|
|
348
|
+
LResult = self.__FComments
|
|
349
|
+
return LResult
|
|
350
|
+
#endfunction
|
|
351
|
+
#endclass
|
|
352
|
+
|
|
353
|
+
#-------------------------------------------------------------------------------
|
|
354
|
+
# CreateVersion
|
|
355
|
+
#-------------------------------------------------------------------------------
|
|
356
|
+
def CreateVersion (AFileName: str) -> TVersionInfo:
|
|
357
|
+
"""CreateVersion"""
|
|
358
|
+
#beginfunction
|
|
359
|
+
LResult:TVersionInfo = TVersionInfo ()
|
|
360
|
+
LResult.__FFileName = AFileName
|
|
361
|
+
return LResult
|
|
362
|
+
#endfunction
|
|
363
|
+
|
|
364
|
+
#---------------------------------------------------------
|
|
365
|
+
# main
|
|
366
|
+
#---------------------------------------------------------
|
|
367
|
+
def main ():
|
|
368
|
+
#beginfunction
|
|
369
|
+
...
|
|
370
|
+
#endfunction
|
|
371
|
+
|
|
372
|
+
#---------------------------------------------------------
|
|
373
|
+
#
|
|
374
|
+
#---------------------------------------------------------
|
|
375
|
+
#beginmodule
|
|
376
|
+
if __name__ == "__main__":
|
|
377
|
+
main()
|
|
378
|
+
#endif
|
|
379
|
+
|
|
380
|
+
#endmodule
|
lyr/LUYouTube.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""LUYouTube.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ ="""
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023-2024
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUYouTube.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
|
|
26
|
+
#------------------------------------------
|
|
27
|
+
# БИБЛИОТЕКИ LU
|
|
28
|
+
#------------------------------------------
|
|
29
|
+
# import LUObjectsYT
|
|
30
|
+
# import LUFile
|
|
31
|
+
import lyr
|
|
32
|
+
|
|
33
|
+
# --------------------------------------------
|
|
34
|
+
# TYouTubeObjectsItem
|
|
35
|
+
# --------------------------------------------
|
|
36
|
+
class TYouTubeObjectsItem (object):
|
|
37
|
+
"""TYouTubeObjectsItem"""
|
|
38
|
+
luClassName = "TYouTubeObjectsItem"
|
|
39
|
+
|
|
40
|
+
#--------------------------------------------------
|
|
41
|
+
# constructor
|
|
42
|
+
#--------------------------------------------------
|
|
43
|
+
def __init__(self, APathDownload):
|
|
44
|
+
"""Constructor"""
|
|
45
|
+
self.__FYouTubeObject: LUObjectsYT.TYouTubeObject = LUObjectsYT.TYouTubeObject(APathDownload)
|
|
46
|
+
#endfunction
|
|
47
|
+
|
|
48
|
+
#--------------------------------------------------
|
|
49
|
+
# destructor
|
|
50
|
+
#--------------------------------------------------
|
|
51
|
+
def __del__(self):
|
|
52
|
+
"""destructor"""
|
|
53
|
+
# удалить объект
|
|
54
|
+
del self.__FYouTubeObject
|
|
55
|
+
LClassName = self.__class__.__name__
|
|
56
|
+
s = '{} уничтожен'.format (LClassName)
|
|
57
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
58
|
+
#endfunction
|
|
59
|
+
|
|
60
|
+
#--------------------------------------------------
|
|
61
|
+
# @property YouTubeObject
|
|
62
|
+
#--------------------------------------------------
|
|
63
|
+
# getter
|
|
64
|
+
@property
|
|
65
|
+
def YouTubeObject(self):
|
|
66
|
+
#beginfunction
|
|
67
|
+
return self.__FYouTubeObject
|
|
68
|
+
#endfunction
|
|
69
|
+
@YouTubeObject.setter
|
|
70
|
+
def YouTubeObject(self, Value: lyr.LUObjectsYT.TYouTubeObject):
|
|
71
|
+
#beginfunction
|
|
72
|
+
self.__FYouTubeObject = Value
|
|
73
|
+
#endfunction
|
|
74
|
+
#endclass
|
|
75
|
+
|
|
76
|
+
# --------------------------------------------
|
|
77
|
+
# TYouTubeObjectsCollection
|
|
78
|
+
# --------------------------------------------
|
|
79
|
+
class TYouTubeObjectsCollection (list):
|
|
80
|
+
"""TObjectsCollection"""
|
|
81
|
+
luClassName = "TYouTubeObjectsCollection"
|
|
82
|
+
|
|
83
|
+
#--------------------------------------------------
|
|
84
|
+
# constructor
|
|
85
|
+
#--------------------------------------------------
|
|
86
|
+
def __init__ (self, APathDownload: str):
|
|
87
|
+
"""Constructor"""
|
|
88
|
+
#beginfunction
|
|
89
|
+
super ().__init__ ()
|
|
90
|
+
self.__FPathDownload = APathDownload
|
|
91
|
+
#endfunction
|
|
92
|
+
|
|
93
|
+
#--------------------------------------------------
|
|
94
|
+
# destructor
|
|
95
|
+
#--------------------------------------------------
|
|
96
|
+
def __del__ (self):
|
|
97
|
+
"""destructor"""
|
|
98
|
+
#beginfunction
|
|
99
|
+
self.clear() # удалить все items
|
|
100
|
+
LClassName = self.__class__.__name__
|
|
101
|
+
s = '{} уничтожен'.format (LClassName)
|
|
102
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
103
|
+
#endfunction
|
|
104
|
+
|
|
105
|
+
def AddItem (self) -> TYouTubeObjectsItem:
|
|
106
|
+
"""AddItem"""
|
|
107
|
+
#beginfunction
|
|
108
|
+
LYouTubeObjectsItem: TYouTubeObjectsItem = TYouTubeObjectsItem (APathDownload = self.__FPathDownload)
|
|
109
|
+
self.append (LYouTubeObjectsItem)
|
|
110
|
+
return self [self.__len__()-1]
|
|
111
|
+
#endfunction
|
|
112
|
+
|
|
113
|
+
def GetItem (self, Index: int) -> TYouTubeObjectsItem:
|
|
114
|
+
"""GetItem"""
|
|
115
|
+
#beginfunction
|
|
116
|
+
LResult: TYouTubeObjectsItem = self [Index]
|
|
117
|
+
return LResult
|
|
118
|
+
#endfunction
|
|
119
|
+
|
|
120
|
+
def SetItem (self, Index: int, Value: TYouTubeObjectsItem):
|
|
121
|
+
"""SetItem"""
|
|
122
|
+
#beginfunction
|
|
123
|
+
self [Index] = Value
|
|
124
|
+
#endfunction
|
|
125
|
+
|
|
126
|
+
def FindYouTubeObjectsItemURL (self, AURL: str) -> TYouTubeObjectsItem:
|
|
127
|
+
"""Поиск YouTubeObjectsItem по AURL"""
|
|
128
|
+
#beginfunction
|
|
129
|
+
for item in self:
|
|
130
|
+
LYouTubeObjectsItem:TYouTubeObjectsItem = item
|
|
131
|
+
LURL = LYouTubeObjectsItem.YouTubeObject.URL
|
|
132
|
+
if LURL == AURL:
|
|
133
|
+
return LYouTubeObjectsItem
|
|
134
|
+
#endif
|
|
135
|
+
#endfor
|
|
136
|
+
return None
|
|
137
|
+
#endfunction
|
|
138
|
+
#endclass
|
|
139
|
+
|
|
140
|
+
class TYouTube(object):
|
|
141
|
+
"""TYouTube"""
|
|
142
|
+
__annotations__ = \
|
|
143
|
+
"""
|
|
144
|
+
TYouTube -
|
|
145
|
+
"""
|
|
146
|
+
luClassName = 'TYouTube'
|
|
147
|
+
|
|
148
|
+
#--------------------------------------------------
|
|
149
|
+
# constructor
|
|
150
|
+
#--------------------------------------------------
|
|
151
|
+
def __init__ (self, APathDownload: str):
|
|
152
|
+
""" Constructor """
|
|
153
|
+
#beginfunction
|
|
154
|
+
super ().__init__ ()
|
|
155
|
+
# YouTubeObjectsCollection
|
|
156
|
+
self.__FYouTubeObjectsCollection = TYouTubeObjectsCollection (APathDownload = APathDownload)
|
|
157
|
+
|
|
158
|
+
# self.__FAPPWorkDir = LUos.APPWorkDir ()
|
|
159
|
+
# self.__FAPPWorkDir = LUos.GetCurrentDir ()
|
|
160
|
+
self.__FAPPWorkDir = LUFile.ExtractFileDir(sys.argv[0])
|
|
161
|
+
self.__FPathDownload = APathDownload
|
|
162
|
+
#endfunction
|
|
163
|
+
|
|
164
|
+
#--------------------------------------------------
|
|
165
|
+
# destructor
|
|
166
|
+
#--------------------------------------------------
|
|
167
|
+
def __del__ (self):
|
|
168
|
+
""" destructor """
|
|
169
|
+
#beginfunction
|
|
170
|
+
del self.__FYouTubeObjectsCollection
|
|
171
|
+
LClassName = self.__class__.__name__
|
|
172
|
+
s = '{} уничтожен'.format (LClassName)
|
|
173
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
174
|
+
#print (s)
|
|
175
|
+
#endfunction
|
|
176
|
+
|
|
177
|
+
#--------------------------------------------------
|
|
178
|
+
# @property YouTubeObjectsCollection
|
|
179
|
+
#--------------------------------------------------
|
|
180
|
+
# getter
|
|
181
|
+
@property
|
|
182
|
+
def YouTubeObjectsCollection (self):
|
|
183
|
+
#beginfunction
|
|
184
|
+
return self.__FYouTubeObjectsCollection
|
|
185
|
+
#endfunction
|
|
186
|
+
#endclass
|
|
187
|
+
|
|
188
|
+
#---------------------------------------------------------
|
|
189
|
+
# main
|
|
190
|
+
#---------------------------------------------------------
|
|
191
|
+
def main ():
|
|
192
|
+
#beginfunction
|
|
193
|
+
...
|
|
194
|
+
#endfunction
|
|
195
|
+
|
|
196
|
+
#---------------------------------------------------------
|
|
197
|
+
#
|
|
198
|
+
#---------------------------------------------------------
|
|
199
|
+
#beginmodule
|
|
200
|
+
if __name__ == "__main__":
|
|
201
|
+
main()
|
|
202
|
+
#endif
|
|
203
|
+
|
|
204
|
+
#endmodule
|