5
"""Generate an (S)VCD/DVD menu MPEG (to replace the 'makemenu' shell script).
9
from libtovid.opts import Option, OptionDict
10
from libtovid.media import standard_media
11
from libtovid.template import Style, textmenu, thumbmenu
12
from libtovid import log
14
# Dictionary of valid options with documentation
16
Option('out', 'NAME', None,
17
"""Output prefix or menu name."""),
19
Option('titles', '"TITLE"[, "TITLE"]', [],
20
"""Comma-separated list of quoted titles; these are the titles that
21
will be displayed (and linked) from the menu."""),
23
Option('format', 'vcd|svcd|dvd', 'dvd',
24
"""Generate a menu compliant with the specified disc format"""),
25
Option('tvsys', 'pal|ntsc', 'ntsc',
26
"""Make the menu for the specified TV system"""),
27
Option('background', 'IMAGE', None,
28
"""Use IMAGE (in most any graphic format) as a background."""),
29
Option('audio', 'AUDIOFILE', None,
30
"""Use AUDIOFILE for background music while the menu plays."""),
31
Option('font', 'FONTNAME', 'Helvetica',
32
"""Use FONTNAME for the menu text."""),
33
Option('fontsize', 'NUM', '24',
34
"""Use a font size of NUM pixels."""),
35
Option('align', 'west|north|east|south|center', 'northwest'),
36
Option('textcolor', 'COLOR', 'white',
37
"""Color of menu text. COLOR may be a hexadecimal triplet (#RRGGBB or
38
#RGB), or a color name from 'convert -list color."""),
39
Option('highlightcolor', 'COLOR', 'red',
40
"""Color of menu highlights."""),
41
Option('selectcolor', 'COLOR', 'green',
42
"""Color of menu selections."""),
44
# Thumbnail menus and effects
45
Option('thumbnails', 'FILE[, FILE ...]', [],
46
"""Create thumbnails of the provided list of video files, which
47
should correspond to the given -titles list."""),
48
Option('border', 'NUM', '0',
49
"""Add a border of NUM pixels around thumbnails."""),
50
Option('effects', 'shadow|round|glass [, ...]', [],
51
"""Add the listed effects to the thumbnails.""")
55
if __name__ == '__main__':
56
"""Create a Menu with provided options and generate it.
58
options = OptionDict(OPTION_DEFS)
59
# If no arguments were provided, print usage notes
60
# TODO: Proper argument verification
62
print 'Usage: pymakemenu [options] -out NAME'
63
print 'Where [options] may be any of the following:'
65
print 'Please provide an output name (-out).'
67
options.override(sys.argv[1:])
69
target = standard_media(options['format'], options['tvsys'])
70
target.filename = options['out']
72
style = Style(options['font'],
75
options['highlightcolor'],
76
options['selectcolor'],
78
if options['thumbnails'] != []:
79
menu = thumbmenu.ThumbMenu(target, options['thumbnails'],
80
options['titles'], style)
82
menu = textmenu.TextMenu(target, options['titles'], style)