-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmedium.py
62 lines (55 loc) · 1.51 KB
/
medium.py
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
import os
import re
class Medium:
def __init__(self, type_='BluRay'):
self.type_ = type_
# for assets
def magicNum(self, x:str):
'''FilePath'''
tmp = os.path.split(x)[1]
mn = tmp[:5]
if mn.isnumeric():
return mn
def index(self, x:str):
'''FilePath'''
tmp = os.path.split(x)[1]
mn = tmp[:5]
ind = x.split('.')[0][-2:]
if mn.isnumeric() and ind.isnumeric():
return int(ind)
def magicNumPG(self, x:str):
'''FilePath'''
if 'slice' in x and 'clip' in x:
mn = x.split('.')[-2][-5:]
return mn
tmp = os.path.split(x)[1]
mn = tmp[:5]
if mn.isnumeric():
return mn
def indexPG(self, x:str):
'''FilePath'''
if 'slice' in x and 'clip' in x:
return
try:
tmp = os.path.split(x)[1]
mn = tmp[:5]
ind = x.split('.')[0].split('_')[2]
if mn.isnumeric() and ind.isnumeric():
return int(ind)
except:
pass
def magicNumClip(self, x:str):
'''Name'''
mn = x[:5]
if mn.isnumeric():
return mn
match = re.search('Clip#(\d+)', x, flags=re.I)
if match:
mn = '%05d' % int(match.group(1))
return mn
class BluRay(Medium):
def __init__(self):
super().__init__('BluRay')
class UHDBluRay(Medium):
def __init__(self):
super().__init__('UHD BluRay')