Remove old decode_data.py manage command
Found while documenting for C0111, this was old code for the initial "decode" functionality that was replaced by decode_data in utils.py Signed-off-by: Corey Shields <cshields@gmail.com>merge-requests/398/head
parent
a697548a56
commit
dcccb1770e
|
@ -1,45 +0,0 @@
|
|||
from __future__ import absolute_import, division, print_function, \
|
||||
unicode_literals
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from db.base.models import DemodData, Satellite, Telemetry
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Decode Satellite data'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
# Positional arguments
|
||||
parser.add_argument('satellite_identifiers', nargs='+', metavar='<Satellite Identifier>')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for item in options['satellite_identifiers']:
|
||||
satellites = Satellite.objects.all()
|
||||
for satellite in satellites:
|
||||
if satellite.has_telemetry_decoders:
|
||||
data = DemodData.objects.filter(satellite=satellite).filter(payload_decoded='')
|
||||
telemetry_decoders = Telemetry.objects.filter(satellite=satellite)
|
||||
|
||||
for obj in data:
|
||||
for option in telemetry_decoders:
|
||||
decoder_module = 'db.base.decoders.{0}'.format(option.decoder)
|
||||
decoder = __import__(decoder_module, fromlist='.')
|
||||
|
||||
with open(obj.payload_frame.path) as data_file:
|
||||
frame = data_file.read()
|
||||
|
||||
try:
|
||||
payload_decoded = decoder.decode_payload(
|
||||
frame, obj.timestamp, obj.data_id
|
||||
)
|
||||
except ValueError:
|
||||
obj.payload_decoded = ''
|
||||
obj.payload_telemetry = None
|
||||
obj.save()
|
||||
continue
|
||||
else:
|
||||
obj.payload_decoded = payload_decoded
|
||||
obj.payload_telemetry = option
|
||||
obj.save()
|
||||
break
|
Loading…
Reference in New Issue