mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-01 13:12:26 -04:00
Merge branch 'master' of https://github.com/craigerl/aprsd
This commit is contained in:
commit
d61c90e2b7
55
.gitignore
vendored
Normal file
55
.gitignore
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Packages
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.eggs
|
||||||
|
eggs
|
||||||
|
parts
|
||||||
|
bin
|
||||||
|
var
|
||||||
|
sdist
|
||||||
|
develop-eggs
|
||||||
|
.installed.cfg
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.coverage
|
||||||
|
.tox
|
||||||
|
nosetests.xml
|
||||||
|
.testrepository
|
||||||
|
.venv
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
|
||||||
|
# Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
|
||||||
|
# Complexity
|
||||||
|
output/*.html
|
||||||
|
output/*/index.html
|
||||||
|
|
||||||
|
# Sphinx
|
||||||
|
doc/build
|
||||||
|
|
||||||
|
# pbr generates these
|
||||||
|
AUTHORS
|
||||||
|
ChangeLog
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
*~
|
||||||
|
.*.swp
|
||||||
|
.*sw?
|
||||||
|
.ropeproject
|
6
MANIFEST.in
Normal file
6
MANIFEST.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
include AUTHORS
|
||||||
|
include ChangeLog
|
||||||
|
exclude .gitignore
|
||||||
|
exclude .gitreview
|
||||||
|
|
||||||
|
global-exclude *.pyc
|
19
aprsd/__init__.py
Normal file
19
aprsd/__init__.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import pbr.version
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = pbr.version.VersionInfo(
|
||||||
|
'aprsd').version_string()
|
@ -19,7 +19,8 @@
|
|||||||
# License GPLv2
|
# License GPLv2
|
||||||
#
|
#
|
||||||
|
|
||||||
from fuzzyclock import fuzzy
|
# python included libs
|
||||||
|
import argparse
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
import sys
|
import sys
|
||||||
@ -33,12 +34,18 @@ from email.mime.text import MIMEText
|
|||||||
import subprocess
|
import subprocess
|
||||||
import datetime
|
import datetime
|
||||||
import calendar
|
import calendar
|
||||||
from imapclient import IMAPClient, SEEN
|
|
||||||
import email
|
import email
|
||||||
import threading
|
import threading
|
||||||
import signal
|
import signal
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
|
# external lib imports
|
||||||
|
from imapclient import IMAPClient, SEEN
|
||||||
|
|
||||||
|
# local imports here
|
||||||
|
from fuzzyclock import fuzzy
|
||||||
|
import utils
|
||||||
|
|
||||||
# localization, please edit:
|
# localization, please edit:
|
||||||
HOST = "noam.aprs2.net" # north america tier2 servers round robin
|
HOST = "noam.aprs2.net" # north america tier2 servers round robin
|
||||||
USER = "KM6XXX-9" # callsign of this aprs client with SSID
|
USER = "KM6XXX-9" # callsign of this aprs client with SSID
|
||||||
@ -54,6 +61,52 @@ shortcuts = {
|
|||||||
email_sent_dict = {} # message_number:time combos so we don't resend the same email in five mins {int:int}
|
email_sent_dict = {} # message_number:time combos so we don't resend the same email in five mins {int:int}
|
||||||
ack_dict = {} # message_nubmer:ack combos so we stop sending a message after an ack from radio {int:int}
|
ack_dict = {} # message_nubmer:ack combos so we stop sending a message after an ack from radio {int:int}
|
||||||
message_number = 0 # current aprs radio message number, increments for each message we send over rf {int}
|
message_number = 0 # current aprs radio message number, increments for each message we send over rf {int}
|
||||||
|
|
||||||
|
# command line args
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--user",
|
||||||
|
metavar="<user>",
|
||||||
|
default=utils.env("APRS_USER"),
|
||||||
|
help="The callsign of this ARPS client with SSID"
|
||||||
|
" Default=env[APRS_USER]")
|
||||||
|
|
||||||
|
parser.add_argument("--host",
|
||||||
|
metavar="<host>",
|
||||||
|
default=utils.env("APRS_HOST"),
|
||||||
|
help="The aprs host to use Default=env[APRS_HOST]")
|
||||||
|
parser.add_argument("--password",
|
||||||
|
metavar="<password>",
|
||||||
|
default=utils.env("APRS_PASSWORD"),
|
||||||
|
help="The aprs password Default=env[APRS_PASSWORD]")
|
||||||
|
parser.add_argument("--callsign",
|
||||||
|
metavar="<callsign>",
|
||||||
|
default=utils.env("APRS_CALLSIGN"),
|
||||||
|
help="The callsign of radio in the field to which we send "
|
||||||
|
"email Default=env[APRS_CALLSIGN]")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
if not args.user:
|
||||||
|
print("Missing the aprs user (env[APRS_USER])")
|
||||||
|
parser.print_help()
|
||||||
|
parser.exit()
|
||||||
|
else:
|
||||||
|
USER = args.user
|
||||||
|
|
||||||
|
if not args.password:
|
||||||
|
print("Missing the aprs password (env[APRS_PASSWORD])")
|
||||||
|
parser.print_help()
|
||||||
|
parser.exit()
|
||||||
|
else:
|
||||||
|
PASS = args.password
|
||||||
|
|
||||||
|
if not args.callsign:
|
||||||
|
print("Missing the aprs callsign (env[APRS_CALLSIGN])")
|
||||||
|
parser.print_help()
|
||||||
|
parser.exit()
|
||||||
|
else:
|
||||||
|
BASECALLSIGN = args.callsign
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(HOST, 14580)
|
tn = telnetlib.Telnet(HOST, 14580)
|
||||||
except Exception, e:
|
except Exception, e:
|
16
aprsd/utils.py
Normal file
16
aprsd/utils.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
"""Utilities and helper functions."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import pprint
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def env(*vars, **kwargs):
|
||||||
|
"""This returns the first environment variable set.
|
||||||
|
if none are non-empty, defaults to '' or keyword arg default
|
||||||
|
"""
|
||||||
|
for v in vars:
|
||||||
|
value = os.environ.get(v, None)
|
||||||
|
if value:
|
||||||
|
return value
|
||||||
|
return kwargs.get('default', '')
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pbr
|
||||||
|
imapclient
|
31
setup.cfg
Normal file
31
setup.cfg
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
[metadata]
|
||||||
|
name = aprsd
|
||||||
|
summary = Amateur radio APRS daemon which listens for messages and responds
|
||||||
|
description-file =
|
||||||
|
README.md
|
||||||
|
author = Craig Lamparter
|
||||||
|
author-email = something@somewhere.com
|
||||||
|
classifier =
|
||||||
|
Topic :: Communications :: Ham Radio
|
||||||
|
Operating System :: POSIX :: Linux
|
||||||
|
Programming Language :: Python
|
||||||
|
|
||||||
|
[global]
|
||||||
|
setup-hooks =
|
||||||
|
pbr.hooks.setup_hook
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
aprsd
|
||||||
|
|
||||||
|
[entry_points]
|
||||||
|
console_scripts =
|
||||||
|
aprsd = aprsd.main:main
|
||||||
|
|
||||||
|
[build_sphinx]
|
||||||
|
source-dir = doc/source
|
||||||
|
build-dir = doc/build
|
||||||
|
all_files = 1
|
||||||
|
|
||||||
|
[upload_sphinx]
|
||||||
|
upload-dir = doc/build/html
|
29
setup.py
Normal file
29
setup.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||||
|
# setuptools if some other modules registered functions in `atexit`.
|
||||||
|
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||||
|
try:
|
||||||
|
import multiprocessing # noqa
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['pbr'],
|
||||||
|
pbr=True)
|
Loading…
x
Reference in New Issue
Block a user