mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-21 23:55:17 -05:00
commit
4c8d9c3b2c
@ -30,9 +30,14 @@ email server, and associated logins, passwords. search for "yourdomain",
|
|||||||
"password". Search for "shortcuts" to setup email aliases as well.
|
"password". Search for "shortcuts" to setup email aliases as well.
|
||||||
|
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
```
|
||||||
|
pip install aprsd
|
||||||
|
```
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
```
|
```
|
||||||
./aprsd.py
|
aprsd -h
|
||||||
```
|
```
|
||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
|
@ -43,7 +43,7 @@ import pprint
|
|||||||
from imapclient import IMAPClient, SEEN
|
from imapclient import IMAPClient, SEEN
|
||||||
|
|
||||||
# local imports here
|
# local imports here
|
||||||
from fuzzyclock import fuzzy
|
from aprsd.fuzzyclock import fuzzy
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
# localization, please edit:
|
# localization, please edit:
|
||||||
@ -107,6 +107,14 @@ else:
|
|||||||
BASECALLSIGN = args.callsign
|
BASECALLSIGN = args.callsign
|
||||||
|
|
||||||
|
|
||||||
|
# Now read the ~/.aprds/config.yml
|
||||||
|
config = utils.get_config()
|
||||||
|
if 'shortcuts' in config:
|
||||||
|
shortcuts = config['shortcuts']
|
||||||
|
else:
|
||||||
|
print("missing 'shortcuts' section of config.yml")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(HOST, 14580)
|
tn = telnetlib.Telnet(HOST, 14580)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
@ -3,7 +3,27 @@
|
|||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
# an example of what should be in the ~/.aprsd/config.yml
|
||||||
|
example_config = '''
|
||||||
|
shortcuts:
|
||||||
|
'aa': '5551239999@vtext.com'
|
||||||
|
'cl': 'craiglamparter@somedomain.org'
|
||||||
|
'wb': '555309@vtext.com'
|
||||||
|
|
||||||
|
smtp:
|
||||||
|
login: something
|
||||||
|
password: some lame password
|
||||||
|
|
||||||
|
imap:
|
||||||
|
login: imapuser
|
||||||
|
password: something dumb
|
||||||
|
|
||||||
|
ham:
|
||||||
|
callsign: something
|
||||||
|
basename: somebasename
|
||||||
|
'''
|
||||||
|
|
||||||
def env(*vars, **kwargs):
|
def env(*vars, **kwargs):
|
||||||
"""This returns the first environment variable set.
|
"""This returns the first environment variable set.
|
||||||
@ -14,3 +34,16 @@ def env(*vars, **kwargs):
|
|||||||
if value:
|
if value:
|
||||||
return value
|
return value
|
||||||
return kwargs.get('default', '')
|
return kwargs.get('default', '')
|
||||||
|
|
||||||
|
|
||||||
|
def get_config():
|
||||||
|
"""This tries to read the yaml config from ~/.aprsd/config.yml."""
|
||||||
|
config_file = os.path.expanduser("~/.aprsd/config.yml")
|
||||||
|
if os.path.exists(config_file):
|
||||||
|
with open(config_file, "r") as stream:
|
||||||
|
config = yaml.load(stream)
|
||||||
|
return config
|
||||||
|
else:
|
||||||
|
print("%s is missing, please create a config file" % config_file)
|
||||||
|
print("example config is\n %s" % example_config)
|
||||||
|
sys.exit(-1)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
pbr
|
pbr
|
||||||
imapclient
|
imapclient
|
||||||
|
pyyaml
|
||||||
|
Loading…
Reference in New Issue
Block a user