main.py 1.18 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
# -*- coding: utf-8 -*-
"""
This file is part of GetTor, a service providing alternative methods to download
the Tor Browser.

:authors: Hiro <hiro@torproject.org>
          please also see AUTHORS file
:copyright: (c) 2008-2014, The Tor Project, Inc.
            (c) 2014, all entities within the AUTHORS file
:license: see included LICENSE for information
"""

Hiro's avatar
Hiro committed
13
14
15
"""
This sets up GetTor and starts the servers running.
"""
16
17
18

from .utils.commons import log
from .utils import options
Hiro's avatar
Hiro committed
19

20
21
from .services import BaseService
from .services.email.sendmail import Sendmail
Hiro's avatar
Hiro committed
22
from .services.twitter.twitterdm import Twitterdm
23
24
25

def run(gettor, app):
    """
Hiro's avatar
Hiro committed
26
    This is GetTor's main entry point and main runtime loop.
27
28
29
30
    """
    settings = options.parse_settings()

    sendmail = Sendmail(settings)
Hiro's avatar
Hiro committed
31
    twitterdm = Twitterdm(settings)
32
33
34
35
36
37
38
39
40

    log.info("Starting services.")
    sendmail_service = BaseService(
        "sendmail", sendmail.get_interval(), sendmail
    )

    gettor.addService(sendmail_service)

    gettor.setServiceParent(app)
Hiro's avatar
Hiro committed
41
42
43
44
45
46
47
48
49


    twitter_service = BaseService(
        "twitterdm", twitterdm.get_interval(), twitterdm
    )

    gettor.addService(twitter_service)

    gettor.setServiceParent(app)