Skip to content

Commit

Permalink
Version number+date output to CLI and ACMI metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mrschick committed Dec 10, 2021
1 parent d735026 commit 35be069
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pyinstaller --specpath "build" --distpath "build\dist" -p "." --clean -F -i NONE
Feel free to fork this project for your own uses, any Pull Requests back to the original repository would be greatly appreciated!

## To-Do List
- [ ] Add `--version` command that displays version number (and maybe release date)
- [x] Add `--version` command that displays version number (and maybe release date)
- [ ] Implement parsing of `igc` [tasks](https://xp-soaring.github.io/igc_file_format/igc_format_2008.html#link_3.6) and [events](https://xp-soaring.github.io/igc_file_format/igc_format_2008.html#link_4.2) into `acmi` [events](https://www.tacview.net/documentation/acmi/en/#Events)
- [ ] Improve and augment error handling, i.e: for flights with missing/invalid date fields in their header
- [ ] Add a way for the user to determine the output file's name or name template
4 changes: 4 additions & 0 deletions combine-igcs/combine-igcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def main():
# parse all arguments
args = parser.parse_args()

if args.version:
print(a.version)
return

try:
# define input path
inPath = a.parseArgPath(args.input, "Input")
Expand Down
8 changes: 8 additions & 0 deletions common/args.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import pathlib as pl
from common import console as c

# current release version
version = "v0.2 - 2021.12.10"

# common arguments that every program uses
def addDefaultArgs(parser):
parser.add_argument(
"--version",
action = "store_true",
help = 'print current version number+date'
)
parser.add_argument(
"-r",
"--remove",
Expand Down
3 changes: 2 additions & 1 deletion common/functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime as dt
import zipfile as zf
import pathlib as pl
from common import args as a


# FILE NAME/PATH PARSING
Expand Down Expand Up @@ -92,7 +93,7 @@ def getFlightHeader(filename): # takes a .igc filepath and returns header data a
# ACMI FILE PARSING

def acmiFileInit(refDateTime): # takes reference datetime object and returns the first 3 acmi lines
return "FileType=text/acmi/tacview\nFileVersion=2.1\n0,ReferenceTime="+refDateTime.strftime("%Y-%m-%d")+"T"+refDateTime.strftime("%H:%M:%S")+"Z\n"
return "FileType=text/acmi/tacview\nFileVersion=2.1\nDataRecorder=igc2acmi "+a.version+"\n0,ReferenceTime="+refDateTime.strftime("%Y-%m-%d")+"T"+refDateTime.strftime("%H:%M:%S")+"Z\n"

def acmiObjInit(header, id=1000): # takes a parsed .igc header and returns the respective ACMI object init line
return str(id)+",Name="+header["actype"]+",CallSign="+header["callsign"]+",Pilot="+header["pilot"]+"\n"
Expand Down
4 changes: 4 additions & 0 deletions convert-all-igcs/convert-all-igcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def main():
# parse all arguments
args = parser.parse_args()

if args.version:
print(a.version)
return

try:
# define input path
inPath = a.parseArgPath(args.input, "Input")
Expand Down
4 changes: 4 additions & 0 deletions igc2acmi/igc2acmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def main():
# parse all arguments
args = parser.parse_args()

if args.version:
print(a.version)
return

try:
# define input file path and name
igcTuple = fnc.parsePathName(args.input_igc_file)
Expand Down

0 comments on commit 35be069

Please sign in to comment.