mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-01-02 09:50:41 +00:00
Merge branch 'master' of https://github.com/iluvcapra/wavinfo into feature-interactive
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import datetime
|
||||
from . import WavInfoReader
|
||||
from . import __version__
|
||||
|
||||
import datetime
|
||||
from optparse import OptionParser
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
from enum import Enum
|
||||
import importlib.metadata
|
||||
from base64 import b64encode
|
||||
from cmd import Cmd
|
||||
from shlex import split
|
||||
@@ -106,10 +107,22 @@ class MetaBrowser(Cmd):
|
||||
|
||||
|
||||
def main():
|
||||
version = importlib.metadata.version('wavinfo')
|
||||
manpath = os.path.dirname(__file__) + "/man"
|
||||
parser = OptionParser()
|
||||
|
||||
parser.usage = 'wavinfo (--adm | --ixml) <FILE> +'
|
||||
|
||||
# parser.add_option('--install-manpages',
|
||||
# help="Install manual pages for wavinfo",
|
||||
# default=False,
|
||||
# action='store_true')
|
||||
|
||||
parser.add_option('--man',
|
||||
help="Read the manual and exit.",
|
||||
default=False,
|
||||
action='store_true')
|
||||
|
||||
parser.add_option('--adm', dest='adm',
|
||||
help='Output ADM XML',
|
||||
default=False,
|
||||
@@ -129,6 +142,26 @@ def main():
|
||||
|
||||
interactive_dict = []
|
||||
|
||||
|
||||
# if options.install_manpages:
|
||||
# print("Installing manpages...")
|
||||
# print(f"Docfiles at {__file__}")
|
||||
# return
|
||||
|
||||
if options.man:
|
||||
import shlex
|
||||
print("Which man page?")
|
||||
print("1) wavinfo usage")
|
||||
print("7) General info on Wave file metadata")
|
||||
m = input("?> ")
|
||||
|
||||
args = ["man", "-M", manpath, "1", "wavinfo"]
|
||||
if m.startswith("7"):
|
||||
args[3] = "7"
|
||||
|
||||
os.system(shlex.join(args))
|
||||
return
|
||||
|
||||
for arg in args[1:]:
|
||||
try:
|
||||
this_file = WavInfoReader(path=arg)
|
||||
@@ -146,7 +179,7 @@ def main():
|
||||
ret_dict = {
|
||||
'filename': arg,
|
||||
'run_date': datetime.datetime.now().isoformat(),
|
||||
'application': "wavinfo " + __version__,
|
||||
'application': f"wavinfo {version}",
|
||||
'scopes': {}
|
||||
}
|
||||
for scope, name, value in this_file.walk():
|
||||
|
||||
Reference in New Issue
Block a user