-
Notifications
You must be signed in to change notification settings - Fork 1
/
filters.py
433 lines (366 loc) · 11 KB
/
filters.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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# Character sets
# Mane 6 + Sunset (for the Equestria Girls)
ts = {'Twilight Sparkle'}
aj = {'Applejack'}
fs = {'Fluttershy'}
rd = {'Rainbow Dash'}
ra = {'Rarity'}
pp = {'Pinkie Pie'}
ss = {'Sunset Shimmer'}
mane_6 = ts | aj | fs | rd | ra | pp
mane_7 = mane_6 | {'Spike'}
princesses = {'Princess Celestia', 'Princess Luna', 'Princess Cadance', }
cmc = {'Apple Bloom', 'Sweetie Belle', 'Scootaloo', }
apples = {'Apple Bloom', 'Granny Smith', 'Big McIntosh', 'Applejack', }
pies = {'Pinkie Pie', 'Maud Pie', 'Igneous Rock', 'Cloudy Quartz', 'Limestone Pie', 'Marble Pie', }
cakes = {'Mr Cake', 'Mrs Cake', 'Pumpkin Cake', 'Pound Cake', }
antagonists = {'Nightmare Moon', 'Queen Chrysalis', 'King Sombra', 'Lord Tirek', 'Adagio Dazzle', 'Sonata Dusk',
'Aria Blaze', 'Midnight Sparkle', }
small_bad = {'Flim', 'Flam', 'Mane-iac', 'Suri Polomare', 'Diamond Tiara', 'Dr Caballeron', 'Ahuizotl', 'Garble',
'Hoops', 'Dumb-Bell', 'Score', 'Rover', 'Fido', 'Spot', }
# These are the main characters, whose classes are used in every episode
classes = {
'Twilight Sparkle': 'ts',
'Sci-Twi': 'ts',
'Pinkie Pie': 'pp',
'Rarity': 'r',
'Rainbow Dash': 'rd',
'Applejack': 'aj',
'Fluttershy': 'fs',
'Spike': 's',
'Sunset Shimmer': 'su',
'Apple Bloom': 'ab',
'Sweetie Belle': 'sb',
'Scootaloo': 'sc',
'Princess Celestia': 'pc',
'Princess Luna': 'pl',
'Princess Cadance': 'ca'
}
legends = [
('Mane 8', mane_7 | ss),
('CMC', cmc),
('Princesses', princesses),
]
# Remapping characters for minor characters
char_map = {
# Diamond dogs
('Rover', 'Fido', 'Spot'): 'dg',
# Snips and snails
('Snips', 'Snails'): 'sn',
# Spa ponies
('Aloe', 'Lotus Blossom'): 'spa',
# Ponytones
('Toe-Tapper', 'Torch Song'): 'pt',
# Wonderbolts
('Soarin', 'Spitfire', 'Fleetfoot', 'Misty Fly',): 'wb',
# Our Town townsfolks
('Sugar Belle', 'Double Diamond', 'Party Favor', 'Night Glider', 'Citizens', ): 'ot',
# Method Mares
('On Stage', 'Raspberry Beret', 'Late Show', 'Stardom',): 'mms',
# Pie Family
tuple(pies - pp): 'pf',
# Shy family
('Mr Shy', 'Mrs Shy'): 'fsf',
}
# CSS classes to be used
special_char = {
'Friendship is Magic, part 1': {'Narrator': 'na'},
'Griffon the Brush Off': {'Gilda': 'gi'},
'Boast Busters': {
'Trixie': 'tx',
'Snips and Snails': 'sn'
},
'Bridle Gossip': {'Zecora': 'z'},
'Winter Wrap Up': {'Mayor Mare': 'mm'},
'Call of the Cutie': {
'Cheerilee': 'ch',
'Diamond Tiara': 'dt',
'Silver Spoon': 'ss'
},
'A Dog and Pony Show': {'Diamond Dogs': 'dg'},
# Season Two
'The Cutie Pox': {'Zecora': 'z'},
'Sweet and Elite': {'Fancy Pants': 'fp'},
'Family Appreciation Day': {
'Cheerilee': 'ch',
'Granny Smith': 'gs',
'Diamond Tiara': 'dt',
},
'The Super Speedy Cider Squeezy 6000': {
'Flim': 'fi',
'Flam': 'fa',
'Granny Smith': 'gs',
},
'Read It and Weep': {
'Daring Do': 'dd',
'Doctor Horse': 'dh',
},
'Hearts and Hooves Day': {
'Cheerilee': 'ch',
'Big McIntosh': 'bm'
},
'A Friend in Deed': {'Cranky Doodle Donkey': 'cr'},
'Putting Your Hoof Down': {'Iron Will': 'iw'},
'Dragon Quest': {'Garble': 'ga'},
'Ponyville Confidential': {
'Diamond Tiara': 'dt',
'Cheerilee': 'ch'
},
'A Canterlot Wedding - Part 1': {
'Shining Armor': 'sa'
},
'A Canterlot Wedding - Part 2': {
'Shining Armor': 'sa'
},
# Season Three
'The Crystal Empire - Part 1': {
'Shining Armor': 'sa'
},
'One Bad Apple': {
'Diamond Tiara': 'dt',
'Silver Spoon': 'ss',
'Babs Seed': 'bs'
},
'Magic Duel': {
'Trixie': 'tx',
'Zecora': 'z'
},
'Wonderbolts Academy': {
'Lightning Dust': 'ld',
'Spitfire': 'sf'
},
'Apple Family Reunion': {
'Babs Seed': 'bs',
'Granny Smith': 'gs'
},
'Games Ponies Play': {
'Ms Harshwhinny': 'hw',
'Ms Peachbottom': 'pb',
'Shining Armor': 'sa'
},
'Flight to the Finish': {
'Ms Harshwhinny': 'hw',
'Diamond Tiara': 'dt',
'Silver Spoon': 'ss',
},
# Season Four
'Princess Twilight Sparkle - Part 1': {
'Discord': 'd'
},
'Princess Twilight Sparkle - Part 2': {
'Discord': 'd'
},
'Power Ponies': {'Mane-iac': 'mi'},
"Daring Don't": {
'Daring Do': 'dd',
'AK Yearling': 'dd',
'Ahuizotl': 'az',
},
'Rarity Takes Manehattan': {
'Suri Polomare': 'sp',
'Prim Hemline': 'ph'
},
'Pinkie Apple Pie': {
'Big McIntosh': 'bm',
'Granny Smith': 'gs',
'Goldie Delicious': 'gd',
},
'Rainbow Falls': {
'Wonderbolts': 'wb',
},
'Twilight Time': {
'Diamond Tiara': 'dt',
'Silver Spoon': 'ss',
},
'Filli Vanilli': {
'Ponytones': 'pt',
'Big McIntosh': 'bm',
},
"It Ain't Easy Being Breezies": {'Seabreeze': 'sz'},
"Three's A Crowd": {'Discord': 'd'},
'Pinkie Pride': {'Cheese Sandwich': 'cs'},
'Simple Ways': {'Trenderhoof': 'th'},
'Maud Pie': {'Maud Pie': 'mp'},
'Leap of Faith': {
'Flim': 'fi',
'Flam': 'fa',
'Granny Smith': 'gs'
},
"Twilight's Kingdom - Part 1": {
'Discord': 'd',
},
"Twilight's Kingdom - Part 2": {
'Discord': 'd',
},
# Season Five
'The Cutie Map - Part 1': {
'Townsfolk': 'ot',
},
'The Cutie Map - Part 2': {
'Townsfolk': 'ot',
},
'Make New Friends but Keep Discord': {
'Discord': 'd',
'Tree Hugger': 'tre'
},
"Appleoosa's Most Wanted": {
'Trouble Shoes': 'trs',
'Sheriff Silverstar': 'sss',
},
'The Lost Treasure of Griffonstone': {'Gilda': 'gi'},
'Amending Fences': {
'Moon Dancer': 'md',
'Minuette': 'mn',
'Lemon Hearts': 'lh',
'Twinkleshine': 'tw',
},
'Canterlot Boutique': {'Sassy Saddles': 'ss'},
'Rarity Investigates!': {
'The Wonderbolts': 'wb',
'Wind Rider': 'wr',
},
'What About Discord?': {'Discord': 'd'},
'Made in Manehattan': {
'Coco Pommel': 'cp',
'Method Mares': 'mms',
},
'Party Pooped': {
'Prince Rutherford': 'prf',
},
'Brotherhooves Social': {
'Big McIntosh': 'bm',
'Granny Smith': 'gs'
},
'Princess Spike': {
'Fancy Pants': 'fp',
},
'Hearthbreakers': {
'Pie Family': 'pf',
'Granny Smith': 'gs',
},
'The Hooffields and McColts': {
'Hooffields': 'hf',
'McColts': 'mc',
},
'Crusaders of the Lost Mark': {
'Diamond Tiara': 'dt',
'Silver Spoon': 'ss',
},
'The Mane Attraction': {
'Coloratura': 'ct',
'Svengallop': 'sv',
},
# Season Six
'The Crystalling - Part 1': {
'Shining Armor': 'sa',
'Starlight Glimmer': 'sg',
'Sunburst': 'st',
},
'The Crystalling - Part 2': {
'Shining Armor': 'sa',
'Starlight Glimmer': 'sg',
'Sunburst': 'st',
},
'The Gift of the Maud Pie': {
'Maud Pie': 'mp',
},
'Gauntlet of Fire': {
'Princess Ember': 'pe',
'Garble': 'ga',
'Dragon Lord Torch': 'tor',
},
'Newbie Dash': {
'The Wonderbolts': 'wb',
},
'No Second Prances': {
'Trixie': 'tx',
'Starlight Glimmer': 'sg',
},
"A Hearth's Warming Tail": {
'Starlight Glimmer': 'sg',
},
'Applejack\'s "Day" Off': {
'Aloe and Lotus': 'spa',
},
'Flutter Brutter': {
'Zephyr Breeze': 'zb',
'Mr and Mrs Shy': 'fsf',
},
'Spice Up Your Life': {
'Coriander Cumin': 'cc',
'Saffron Masala': 'sm',
'Zesty Gourmand': 'zg',
},
# Equestria Girls
"Equestria Girls: Friendship Games": {
}
}
# Adjectives to strip out of speaker names
adjectives = ('Filly', 'Younger', 'Young', 'Future', 'Old', 'Pond', 'Past', 'Baby', 'Countess')
# Mapping of names to their replacement used by the speaker parser to ensure consistency
name_replace = {
'Twilight': 'Twilight Sparkle',
'Pinkie': 'Pinkie Pie',
'3': 'Pinkie Pie', # 'Pinkies 3 and 4'
'4': 'Pinkie Pie', # - from Too Many Pinkies
'Rarity to Opal': 'Rarity',
'Lady Rarity': 'Rarity',
'Trixie Lulamoon': 'Trixie',
'Maud': 'Maud Pie',
'Sweetie Drops': 'Bon Bon',
'Princesses Celestia': 'Princess Celestia', # 'Princesses Celestia, Luna and Cadance'
'Luna': 'Princess Luna',
'Cadance': 'Princess Cadance',
'Big Mac': 'Big McIntosh',
'Mr': 'Mr Cake', # 'Mr and Mrs Cake'
'Ahuizotl with Fluttershys voice': 'Fluttershy',
'At the same time Applejack': 'Applejack',
'Stephen Magnet': 'Steven Magnet', # His credited name in Slice of Life
'Principal Celestia': 'Princess Celestia',
'Vice Principal Luna': 'Princess Luna',
'Train conductor': 'Train Conductor',
'Cranky': 'Cranky Doodle Donkey'
}
set_replace = {
('Mane Six', 'Main Six', 'Main cast', 'Main Cast', 'Main cast sans Spike',
'All ponies', 'the Rainbooms', 'Rainbooms', 'The Rainbooms'): mane_6,
('The Ponytones', 'The Pony Tones'): ('Rarity', 'Big McIntosh', 'Torch Song', 'Toe-Tapper'),
('Main 6 sans Twilight', 'Main cast bar Twilight', 'Main cast sans Twilight',
'Everyone but Twilight', 'All except Twilight'): mane_6 - ts,
('Main cast sans Pinkie',): mane_6 - pp,
('Main cast sans Rainbow Dash',): mane_6 - rd,
('Main cast sans Fluttershy', 'All except Fluttershy'): mane_6 - fs,
('Main cast sans Rarity', 'All but Rarity', 'All sans Rarity'): mane_6 - ra,
('The cast',): mane_6 | ss,
('Cutie Mark Crusaders', 'Crusaders'): cmc,
('Apple family',): apples,
('The Dazzlings',): ('Adagio Dazzle', 'Sonata Dusk', 'Aria Blaze'),
('The Illusions',): ('Trixie', 'The Illusions') # The other band members are unnamed
}
# There's a lot of dialog attributed to 'all' in the show
# turns out this value is different for each episode, hence this
# dict to hold the mapping
what_is_all = {
'Castle Sweet Castle': mane_6 - ts,
'Pinkie Apple Pie': apples | pp,
'The Show Stoppers': cmc,
'My Little Pony Equestria Girls': mane_6,
'Suited For Success': mane_6 - ra,
'The Best Night Ever': mane_6,
'The Crystal Empire - Part 1': mane_6,
"Twilight's Kingdom - Part 2": mane_6
}
what_is_rest = {
'A Canterlot Wedding - Part 1': mane_6 - (ts | aj),
'Bats!': mane_6 - ts,
'Do Princesses Dream of Magic Sheep': mane_6 - fs,
'Filli Vanilli': mane_6 - fs,
"It Ain't Easy Being Breezies": mane_6 - fs,
'Keep Calm and Flutter On': mane_6 - ts,
'Maud Pie': mane_6 - aj,
'MMMystery on the Friendship Express': mane_6 - pp,
'My Little Pony Equestria Girls Rainbow Rocks': mane_6,
'Sweet and Elite': mane_6 - ra,
'The Super Speedy Cider Squeezy 6000': mane_6,
'Wonderbolts Academy': mane_6 - rd
}