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
|
#!/usr/bin/env python3
import argparse
from http.server import HTTPServer
from .podcastfeeder import create_feeder
from .config import (
Config,
ConfigException
)
"""
Start the program
"""
def main():
arg_parser = argparse.ArgumentParser(prog="youtube-podcaster",
description="Converts youtube \
playlists to RSS-feeds")
arg_parser.add_argument("-c", "--config",
dest="config",
help="Use CONFIG as the config file")
arg_parser.add_argument("-i", "--interface",
dest="interface",
help="The interface the http server will listen on")
arg_parser.add_argument("-p", "--port",
dest="port",
help="The port the http server will listen on")
arg_parser.add_argument("--api-key",
dest="apikey",
help="The YouTube API v3 key")
args = arg_parser.parse_args()
try:
config = Config.parse_config(args)
PodcastFeeder = create_feeder(config)
server = HTTPServer(config.get_server_address(), PodcastFeeder)
server.serve_forever()
except ConfigException as e:
print(e)
except KeyboardInterrupt:
server.socket.close()
# vim: set ts=8 sw=4 tw=0 et :
|