Merge branch 'master' of https://github.com/iluvcapra/wavinfo into feature-smpl

This commit is contained in:
Jamie Hardt
2024-11-25 10:52:46 -08:00
8 changed files with 67 additions and 42 deletions

2
.gitignore vendored
View File

@@ -110,3 +110,5 @@ venv_docs/
.DS_Store .DS_Store
.vscode/ .vscode/
poetry.lock

View File

@@ -12,24 +12,25 @@
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
import importlib
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('../..')) sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath("../../..")) sys.path.insert(0, os.path.abspath("../../.."))
print(sys.path) print(sys.path)
import wavinfo import importlib
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = u'wavinfo' project = u'wavinfo'
copyright = u'2018-2023, Jamie Hardt' copyright = u'2018-2024, Jamie Hardt'
author = u'Jamie Hardt' author = u'Jamie Hardt'
# The short X.Y version # The short X.Y version
version = wavinfo.__short_version__ version = "3.1"
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = wavinfo.__version__ release = importlib.metadata.version("wavinfo")
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------

View File

@@ -1,13 +1,16 @@
[build-system] # https://python-poetry.org/docs/pyproject/
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
[project] [build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "wavinfo" name = "wavinfo"
authors = [{name = "Jamie Hardt", email = "jamiehardt@me.com"}] version = "3.0.1"
description = "Probe WAVE files for all metadata"
authors = ["Jamie Hardt <jamiehardt@me.com>"]
license = "MIT"
readme = "README.md" readme = "README.md"
dynamic = ["version", "description"]
requires-python = "~=3.8"
classifiers = [ classifiers = [
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
@@ -20,9 +23,10 @@ classifiers = [
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13" "Programming Language :: Python :: 3.13"
] ]
dependencies = [ homepage = "https://github.com/iluvcapra/wavinfo"
"lxml ~= 5.3.0" repository = "https://github.com/iluvcapra/wavinfo.git"
] documentation = "https://wavinfo.readthedocs.io/"
urls.Tracker = 'https://github.com/iluvcapra/wavinfo/issues'
keywords = [ keywords = [
'waveform', 'waveform',
'metadata', 'metadata',
@@ -35,29 +39,17 @@ keywords = [
'broadcast' 'broadcast'
] ]
[tool.flit.module] [tool.poetry.extras]
name = "wavinfo" doc = ['sphinx', 'sphinx_rtd_theme']
[project.optional-dependencies] [tool.poetry.scripts]
doc = [
'sphinx >= 5.3.0',
'sphinx_rtd_theme >= 1.1.1',
]
[project.urls]
Home = "https://github.com/iluvcapra/wavinfo"
Documentation = "https://wavinfo.readthedocs.io/"
Source = "https://github.com/iluvcapra/wavinfo.git"
Issues = 'https://github.com/iluvcapra/wavinfo/issues'
[project.entry_points.console_scripts]
wavinfo = 'wavinfo.__main__:main' wavinfo = 'wavinfo.__main__:main'
[project.scripts] [tool.poetry.dependencies]
wavinfo = "wavinfo.__main__:main" python = "^3.8"
lxml = "~= 5.3.0"
[tool.flit.external-data] sphinx_rtd_theme = {version= '>= 1.1.1', optional=true}
directory = "data" sphinx = {version= '>= 5.3.0', optional=true}
[tool.pyright] [tool.pyright]
typeCheckingMode = "basic" typeCheckingMode = "basic"

View File

@@ -4,6 +4,3 @@ Probe WAVE Files for iXML, Broadcast-WAVE and other metadata.
from .wave_reader import WavInfoReader from .wave_reader import WavInfoReader
from .riff_parser import WavInfoEOFError from .riff_parser import WavInfoEOFError
__version__ = '3.0.0'
__short_version__ = '3.0.0'

View File

@@ -1,11 +1,12 @@
import datetime
from . import WavInfoReader from . import WavInfoReader
from . import __version__
import datetime
from optparse import OptionParser from optparse import OptionParser
import sys import sys
import os
import json import json
from enum import Enum from enum import Enum
import importlib.metadata
from base64 import b64encode from base64 import b64encode
@@ -24,10 +25,22 @@ class MissingDataError(RuntimeError):
def main(): def main():
version = importlib.metadata.version('wavinfo')
manpath = os.path.dirname(__file__) + "/man"
parser = OptionParser() parser = OptionParser()
parser.usage = 'wavinfo (--adm | --ixml) <FILE> +' 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', parser.add_option('--adm', dest='adm',
help='Output ADM XML', help='Output ADM XML',
default=False, default=False,
@@ -39,6 +52,26 @@ def main():
action='store_true') action='store_true')
(options, args) = parser.parse_args(sys.argv) (options, args) = parser.parse_args(sys.argv)
# 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:]: for arg in args[1:]:
try: try:
this_file = WavInfoReader(path=arg) this_file = WavInfoReader(path=arg)
@@ -56,7 +89,7 @@ def main():
ret_dict = { ret_dict = {
'filename': arg, 'filename': arg,
'run_date': datetime.datetime.now().isoformat(), 'run_date': datetime.datetime.now().isoformat(),
'application': "wavinfo " + __version__, 'application': f"wavinfo {version}",
'scopes': {} 'scopes': {}
} }
for scope, name, value in this_file.walk(): for scope, name, value in this_file.walk():

View File

@@ -17,7 +17,7 @@ With no options,
will emit a JSON (Javascript Object Notation) object containing all will emit a JSON (Javascript Object Notation) object containing all
detected metadata. detected metadata.
.IP "\-\-adm" .IP "\-\-adm"
Output any Audio Definition Model (ADM) metadata in Output Audio Definition Model (ADM) XML metadata in
.BR FILE . .BR FILE .
.IP "\-\-ixml" .IP "\-\-ixml"
Output any iXML metdata in Output any iXML metdata in