OSDN Git Service

import 0.9.4
[handbrake-jp/handbrake-jp.git] / gtk / src / makedeps.py
1 #! /usr/bin/python
2
3 import collections
4 import plistlib
5
6 DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide')
7 dep_map = (
8         DepEntry("title", "queue_add", "none", True, False),
9         DepEntry("title", "queue_add_menu", "none", True, False),
10         DepEntry("title", "show_picture", "none", True, False),
11         DepEntry("title", "show_preview_menu", "none", True, False),
12         DepEntry("title", "preview_frame", "none", True, False),
13         DepEntry("title", "picture_label", "none", True, False),
14         DepEntry("title", "picture_tab", "none", True, False),
15         DepEntry("title", "chapters_label", "none", True, False),
16         DepEntry("title", "chapters_tab", "none", True, False),
17         DepEntry("title", "title", "none", True, False),
18         DepEntry("title", "start_chapter", "none", True, False),
19         DepEntry("title", "end_chapter", "none", True, False),
20         DepEntry("vquality_type_bitrate", "VideoAvgBitrate", "TRUE", False, False),
21         DepEntry("vquality_type_target", "VideoTargetSize", "TRUE", False, False),
22         DepEntry("vquality_type_constant", "VideoQualitySlider", "TRUE", False, False),
23         DepEntry("vquality_type_constant", "constant_rate_factor", "TRUE", False, False),
24         DepEntry("vquality_type_constant", "VideoTwoPass", "TRUE", True, False),
25         DepEntry("vquality_type_constant", "VideoTurboTwoPass", "TRUE", True, False),
26         DepEntry("VideoTwoPass", "VideoTurboTwoPass", "TRUE", False, False),
27         DepEntry("FileFormat", "Mp4LargeFile", "mp4|m4v", False, True),
28         DepEntry("FileFormat", "Mp4HttpOptimize", "mp4|m4v", False, True),
29         DepEntry("FileFormat", "Mp4iPodCompatible", "mp4|m4v", False, True),
30         DepEntry("PictureDecomb", "PictureDeinterlace", "none", False, False),
31         DepEntry("PictureDecomb", "PictureDeinterlaceCustom", "none", False, True),
32         DepEntry("PictureDeinterlace", "PictureDeinterlaceCustom", "custom", False, True),
33         DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True),
34         DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
35         DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
36         DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False),
37         DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
38         DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
39         DepEntry("PictureAutoCrop", "PictureRightCrop", "FALSE", False, False),
40         DepEntry("autoscale", "scale_width", "FALSE", False, False),
41         DepEntry("autoscale", "scale_height", "FALSE", False, False),
42         DepEntry("anamorphic", "PictureKeepRatio", "FALSE", False, False),
43         ## "CHECK" is a dummy value that forces scale_height deps to
44         ## be re-evaluated whenever anamorphic changes
45         DepEntry("anamorphic", "scale_height", "CHECK", True, False),
46         DepEntry("PictureKeepRatio", "scale_height", "FALSE", False, False),
47         DepEntry("VideoEncoder", "x264_tab", "x264", False, False),
48         DepEntry("VideoEncoder", "x264_tab_label", "x264", False, False),
49         DepEntry("VideoEncoder", "Mp4iPodCompatible", "x264", False, False),
50         DepEntry("AudioEncoder", "AudioBitrate", "ac3|dts", True, False),
51         DepEntry("AudioEncoder", "AudioSamplerate", "ac3|dts", True, False),
52         DepEntry("AudioEncoder", "AudioMixdown", "ac3|dts", True, False),
53         DepEntry("AudioEncoder", "AudioTrackDRCSlider", "ac3|dts", True, False),
54         DepEntry("x264_bframes", "x264_weighted_bframes", "0", True, False),
55         DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
56         DepEntry("x264_bframes", "x264_direct", "0", True, False),
57         DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
58         DepEntry("x264_refs", "x264_mixed_refs", "<2", True, False),
59         DepEntry("x264_cabac", "x264_trellis", "TRUE", False, False),
60         DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
61         DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
62         DepEntry("x264_cabac", "x264_psy_trell", "TRUE", False, False),
63         DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
64         DepEntry("ChapterMarkers", "chapters_list", "TRUE", False, False),
65         DepEntry("use_source_name", "chapters_in_destination", "TRUE", False, False),
66         DepEntry("use_source_name", "title_no_in_destination", "TRUE", False, False),
67         )
68
69 def main():
70
71         try:
72                 depsfile = open("widget.deps", "w")
73         except Exception, err:
74                 print >> sys.stderr, ( "Error: %s"  % str(err) )
75                 sys.exit(1)
76
77         try:
78                 revfile = open("widget_reverse.deps", "w")
79         except Exception, err:
80                 print >> sys.stderr, ( "Error: %s"  % str(err))
81                 sys.exit(1)
82
83         top = dict()
84         for ii in dep_map:
85                 if ii.widget in top:
86                         continue
87                 deps = list()
88                 for jj in dep_map:
89                         if jj.widget == ii.widget:
90                                 deps.append(jj.dep)
91                 top[ii.widget] = deps
92         plistlib.writePlist(top, depsfile)
93
94         top = dict()
95         for ii in dep_map:
96                 if ii.dep in top:
97                         continue
98                 deps = list()
99                 for jj in dep_map:
100                         if ii.dep == jj.dep:
101                                 rec = list()
102                                 rec.append(jj.widget)
103                                 rec.append(jj.enable)
104                                 rec.append(jj.die)
105                                 rec.append(jj.hide)
106                                 deps.append(rec)
107                 top[ii.dep] = deps
108         plistlib.writePlist(top, revfile)
109         
110 main()
111