~jordens/eyefi/trunk

« back to all changes in this revision

Viewing changes to eyefi/run_actions.py

  • Committer: Robert Jordens
  • Date: 2013-09-04 23:26:22 UTC
  • Revision ID: jordens@phys.ethz.ch-20130904232622-tsih0yxj3xtdjsr3
rewrite maclog, add manual action running, fix a few bugs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# EyeFi Python Server
 
2
#
 
3
# Copyright (C) 2010 Robert Jordens
 
4
 
5
# This program is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation, either version 3 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
 
 
19
from twisted.internet import reactor
 
20
from twisted.python import log
 
21
 
 
22
from eyefi.config import glue_config, get_cards
 
23
from eyefi.actions import build_actions
 
24
from eyefi.server import EyeFiServer
 
25
 
 
26
 
 
27
cfg = glue_config()
 
28
 
 
29
 
 
30
def get_server(cfg=cfg):
 
31
    cards = get_cards(cfg)
 
32
    actions = build_actions(cfg, cards)
 
33
    server = EyeFiServer(cards, actions)
 
34
    return server
 
35
 
 
36
if __name__ == "__main__":
 
37
    import sys
 
38
    log.startLogging(sys.stdout)
 
39
    server = get_server()
 
40
    mac = server.cards.keys()[0]
 
41
    files = sys.argv[1:]
 
42
    d = server.run_actions(mac, files)
 
43
    d.addBoth(reactor.stop)
 
44
    reactor.run()