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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# ------------------------------------------------------------------------------------------# ----------------------------------------------------
# - after importing 'event' the event object is available
# with the following methods:
#
# title
# shorttext
# starttime
# year
# category
# episodname
# shortname
# partname
# season
# part
# number
# extracol1
# extracol2
# extracol3
#
# namingmode -> timers naming mode { 1,2,3,4,5 } - see epgservice.h
# tmplExpression
#
# - implement at least the function 'name()' witch have to return the name of the recording
# if the result was empty VDRs typical recording name will be used
# ------------------------------------------------------------------------------------------
import event
def name():
import locale
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
import time
if event.namingmode() == 1: # Auto
if event.episodname():
if event.shortname():
title = event.shortname()
else:
title = event.episodname()
part = "%02i" % int(event.part())
number = "%03i" % int(event.number())
if event.title() == 'Tatort':
if event.extracol1():
ermittler = event.extracol1()[11:]
else:
ermittler = ''
if event.extracol2():
ort = event.extracol2()[5:]
else:
ort = ''
season = str(int(event.season())+1969)
return "Tatort~" + ort + "~" + ermittler + "~" + season + "x" + part + " - " + number + ". " + event.shorttext()
else:
if event.title() == 'Polizeiruf 110':
season = str(int(event.season())+1971)
else:
season = "%02i" % int(event.season())
return title + "~" + season + "x" + part + " - " + number + ". " + event.shorttext()
elif event.category() == 'Serie':
if event.shorttext() and event.title() != event.shorttext():
return event.title() + "~" + event.shorttext()
else:
return event.title() + "~" + time.strftime("%a %d.%m.%Y %H:%M", time.localtime(event.starttime()))
else:
return event.title()
elif event.namingmode() == 2: # Constable
if event.episodname():
if event.shortname():
title = event.shortname()
else:
title = event.episodname()
part = "%02i" % int(event.part())
number = "%03i" % int(event.number())
if event.title() == 'Tatort':
if event.extracol1:
ermittler = event.extracol1()[11:]
else:
ermittler = ''
if event.extracol2():
ort = event.extracol2()[5:]
else:
ort = ''
season = str(int(event.season())+1969)
return "Tatort~" + ort + "~" + ermittler + "~" + season + "x" + part + " - " + number + ". " + event.shorttext()
else:
if event.title() == 'Polizeiruf 110':
season = str(int(event.season())+1971)
else:
season = "%02i" % int(event.season())
return title + "~" + season + "x" + part + " - " + number + ". " + event.shorttext()
elif event.shorttext() and event.title() != event.shorttext():
return event.title() + "~?x? - ?. " + event.shorttext()
else:
return event.title() + "~" + time.strftime("%a %d.%m.%Y %H:%M", time.localtime(event.starttime()))
elif event.namingmode() == 3: # Serie
if event.shorttext() and event.title() != event.shorttext():
return event.title() + "~" + event.shorttext()
else:
return event.title()
elif event.namingmode() == 4: # Kategorisiert
if event.category():
return event.category() + "~" + event.title()
else:
return event.title()
elif event.namingmode() == 5: # User (has to be defined/configured by User
return event.title()
elif event.namingmode() == 6:
if event.tmplExpression() == "":
return event.title()
recording = event.tmplExpression()
recording = recording.replace("%title%", event.title())
recording = recording.replace("%shorttext%", event.shorttext())
recording = recording.replace("%starttime%", time.strftime("%a %d.%m.%Y %H:%M", time.localtime(event.starttime())))
recording = recording.replace("%year%", event.year())
recording = recording.replace("%category%", event.category())
recording = recording.replace("%episodname%", event.episodname())
recording = recording.replace("%shortname%", event.shortname())
recording = recording.replace("%partname%", event.partname())
recording = recording.replace("%season%", "%02i" % int(event.season()))
recording = recording.replace("%part%", "%02i" % int(event.part()))
recording = recording.replace("%number%", "%02i" % int(event.number()))
recording = recording.replace("%extracol1%", event.extracol1())
recording = recording.replace("%extracol2%", event.extracol2())
recording = recording.replace("%extracol3%", event.extracol3())
recording = recording.replace("/", "~")
return recording
else:
return event.title()
|