OSDN Git Service

LinGui: remove target file size option
[handbrake-jp/handbrake-jp-git.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", "preview_frame", "none", True, False),
11         DepEntry("title", "picture_label", "none", True, False),
12         DepEntry("title", "picture_tab", "none", True, False),
13         DepEntry("title", "chapters_label", "none", True, False),
14         DepEntry("title", "chapters_tab", "none", True, False),
15         DepEntry("title", "start_point", "none", True, False),
16         DepEntry("title", "end_point", "none", True, False),
17         DepEntry("title", "angle", "none", True, False),
18         DepEntry("title", "angle_label", "1", True, False),
19         DepEntry("use_dvdnav", "angle", "FALSE", True, True),
20         DepEntry("use_dvdnav", "angle_label", "FALSE", True, True),
21         DepEntry("angle_count", "angle", "1", True, True),
22         DepEntry("angle_count", "angle_label", "1", True, True),
23         DepEntry("vquality_type_bitrate", "VideoAvgBitrate", "TRUE", False, False),
24         DepEntry("vquality_type_constant", "VideoQualitySlider", "TRUE", False, False),
25         DepEntry("vquality_type_constant", "VideoTwoPass", "TRUE", True, False),
26         DepEntry("vquality_type_constant", "VideoTurboTwoPass", "TRUE", True, False),
27         DepEntry("VideoFramerate", "VideoFrameratePFR", "source", True, True),
28         DepEntry("VideoFramerate", "VideoFramerateVFR", "source", False, True),
29         DepEntry("VideoTwoPass", "VideoTurboTwoPass", "TRUE", False, False),
30         DepEntry("FileFormat", "Mp4LargeFile", "mp4", False, True),
31         DepEntry("FileFormat", "Mp4HttpOptimize", "mp4", False, True),
32         DepEntry("FileFormat", "Mp4iPodCompatible", "mp4", False, True),
33         DepEntry("PictureDecombDeinterlace", "PictureDeinterlace", "TRUE", True, True),
34         DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceCustom", "TRUE", True, True),
35         DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceLabel", "TRUE", True, True),
36         DepEntry("PictureDecombDeinterlace", "PictureDecomb", "FALSE", True, True),
37         DepEntry("PictureDecombDeinterlace", "PictureDecombCustom", "FALSE", True, True),
38         DepEntry("PictureDecombDeinterlace", "PictureDecombLabel", "FALSE", True, True),
39         DepEntry("PictureDeinterlace", "PictureDeinterlaceCustom", "custom", False, True),
40         DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True),
41         DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
42         DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
43         DepEntry("PictureWidthEnable", "PictureWidth", "TRUE", False, False),
44         DepEntry("PictureHeightEnable", "PictureHeight", "TRUE", False, False),
45         DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False),
46         DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
47         DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
48         DepEntry("PictureAutoCrop", "PictureRightCrop", "FALSE", False, False),
49         DepEntry("VideoEncoder", "x264_tab", "x264", False, False),
50         DepEntry("VideoEncoder", "x264_tab_label", "x264", False, False),
51         DepEntry("VideoEncoder", "Mp4iPodCompatible", "x264", False, False),
52         DepEntry("AudioEncoderActual", "AudioBitrate", "ac3pass|dtspass", True, False),
53         DepEntry("AudioEncoderActual", "AudioSamplerate", "ac3pass|dtspass", True, False),
54         DepEntry("AudioEncoderActual", "AudioMixdown", "ac3pass|dtspass", True, False),
55         DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "ac3pass|dtspass", True, False),
56         DepEntry("AudioEncoderActual", "drc_label", "ac3pass|dtspass", True, False),
57         DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
58         DepEntry("x264_bframes", "x264_direct", "0", True, False),
59         DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
60         DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
61         DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
62         DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
63         DepEntry("use_source_name", "chapters_in_destination", "TRUE", False, False),
64         DepEntry("use_source_name", "title_no_in_destination", "TRUE", False, False),
65         )
66
67 def main():
68
69         try:
70                 depsfile = open("widget.deps", "w")
71         except Exception, err:
72                 print >> sys.stderr, ( "Error: %s"  % str(err) )
73                 sys.exit(1)
74
75         try:
76                 revfile = open("widget_reverse.deps", "w")
77         except Exception, err:
78                 print >> sys.stderr, ( "Error: %s"  % str(err))
79                 sys.exit(1)
80
81         top = dict()
82         for ii in dep_map:
83                 if ii.widget in top:
84                         continue
85                 deps = list()
86                 for jj in dep_map:
87                         if jj.widget == ii.widget:
88                                 deps.append(jj.dep)
89                 top[ii.widget] = deps
90         plistlib.writePlist(top, depsfile)
91
92         top = dict()
93         for ii in dep_map:
94                 if ii.dep in top:
95                         continue
96                 deps = list()
97                 for jj in dep_map:
98                         if ii.dep == jj.dep:
99                                 rec = list()
100                                 rec.append(jj.widget)
101                                 rec.append(jj.enable)
102                                 rec.append(jj.die)
103                                 rec.append(jj.hide)
104                                 deps.append(rec)
105                 top[ii.dep] = deps
106         plistlib.writePlist(top, revfile)
107         
108 main()
109