update the rest of the code to support the new config format
[iron-blogger] / config.py
1 #!/usr/bin/python
2 ## -*- coding: utf-8 -*-
3
4 import os.path
5 import datetime
6 import subprocess
7
8 HERE  = os.path.dirname(__file__)
9 START = datetime.datetime(2011, 10, 24, 6)
10
11 XMLRPC_ENDPOINT = 'http://iron-blogger.mako.cc/xmlrpc.php'
12 USER            = 'mako'
13 BLOG_ID         = 1
14 PARTICIPANTS_PAGE_ID         = 12
15
16 FINE_SIZE = 5
17 CURRENCY = "$"
18
19 # check the version of ledger to find out which commands to use
20 if subprocess.check_output(['ledger', '--version'])[7] == "3":
21     BALANCE_CMD = ['ledger', '-f', os.path.join(HERE,'ledger'),
22                    '--no-color', '-n', 'balance']
23
24     DEBTS_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
25                  '--flat', '--no-total', '--no-color',
26                  'balance', 'Pool:Owed:']
27
28 else:
29     BALANCE_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
30                    '-n', 'balance']
31     DEBTS_CMD = ['ledger', '-f', os.path.join(HERE, 'ledger'),
32                  '-n', 'balance', 'Pool:Owed:']
33     

Benjamin Mako Hill || Want to submit a patch?