more scripts file
[archive.git] / Apkawa / AnimeRename / old / rename.py
blob612ad49545dd89ac390d5a29668d4f9580282cfd
1 import re
3 medias=(
4 '[Ayako-sae] Minami-ke Okawari - 08 (1280x720 h264) [335AF5B6].mkv',
5 '[Zero-Raws] Minami-ke Okawari 13 END RAW (D-TX DivX6.6 1280x720 120fps[ED60]).avi',
6 '[GC-TA]_Minami-ke_Okawari_-_02[1280x720_H264_AAC][4B157583].mkv',
7 '[TweakAnime]_Minami-ke_Okawari_12_[H264][1280x720]_[A42D78FB].mkv',
10 subs = (
11 '[Ayako-sae] Minami-ke Okawari - 01 (1280x720 h264) [C45C676E].ass',
12 '[Ayako-sae] Minami-ke Okawari - 02 (1280x720 h264) [AAA2972D].ass',
13 '[Ayako-sae] Minami-ke Okawari - 03 (1280x720 h264) [4CFDA043].ass',
14 '[Ayako-sae] Minami-ke Okawari - 04 (1280x720 h264) [552F578F].ass',
15 '[Ayako-sae] Minami-ke Okawari - 05 (1280x720 h264) [56AEC7A4].ass',
16 '[Ayako-sae] Minami-ke Okawari - 06 (1280x720 h264) [EE3616A4].ass',
17 '[Ayako-sae] Minami-ke Okawari - 07 (1280x720 h264) [4E87A2EF].ass',
18 '[Ayako-sae] Minami-ke Okawari - 08 (1280x720 h264) [335AF5B6].ass',
19 '[Ayako-sae] Minami-ke Okawari - 09 (1280x720 h264) [3652C422].ass',
20 '[Ayako-sae] Minami-ke Okawari - 10 (1280x720 h264) [28A5D871].ass',
21 '[TweakAnime]_Minami-ke_Okawari_11_[H264][1280x720]_[432A6AC8].ass',
22 '[TweakAnime]_Minami-ke_Okawari_12_[H264][1280x720]_[A42D78FB].ass',
25 def parse_filename(filename):
26 pre_parse = re.sub('_',' ', re.sub('(\[.*?\])|(\(.*?\))|(\.mkv)|(\.avi)','',filename))
27 i = re.findall('[\d]{2,3}',pre_parse)
28 keyword = re.findall('([A-Z-a-z]{2,})',pre_parse)
29 return (fi
30 print renamelistlename,keyword,i)
34 key_medias = map(lambda x: parse_filename(x),medias)
35 key_subs = map(lambda x: parse_filename(x),subs)
36 renamelist=[]
37 for key_media in key_medias:
38 for key_sub in key_subs:
39 if key_media[2] == key_sub[2]:
40 #print 'OK'
41 #print key_media
42 #print key_sub
43 renamelist.append((key_media[0],key_sub[0]))
44 break
46 print renamelist
51 '''
52 for filename in filenames:
53 medias = parse_filename(filename)
55 for sub in subs:
56 key_subs = parse_filename(sub)
58 for key_sub,media in key_subs,medias:
59 '''