mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 17:00:41 +00:00
Compare commits
48 Commits
feature-sm
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 95ba34187a | |||
| 4d2dfcd370 | |||
| 717b6a4117 | |||
| 7393afac95 | |||
| e9450cd65a | |||
| 51b1a2e8b4 | |||
| 53303232b4 | |||
| 3519a0251f | |||
| 79ec1649c4 | |||
| 7c3f4c9b5e | |||
| 2e8224cb3c | |||
| 8ef4186b4c | |||
| cd5346c1cb | |||
|
|
925bf4f8a6 | ||
|
|
e98ba0bf07 | ||
| afca634dc3 | |||
|
|
df9ae0f4d6 | ||
|
|
2f23bcb982 | ||
| 5e641b0963 | |||
| 1b57ad0fac | |||
| c7a34e0064 | |||
| 6b788484da | |||
| 76905f1a40 | |||
| 9ac06040a2 | |||
| 1b78f5b821 | |||
| 03d718b4ad | |||
| 61f79760e6 | |||
|
|
afe5ea9ed3 | ||
|
|
c1205d52e8 | ||
|
|
b82b6b6d43 | ||
|
|
8ef664266f | ||
|
|
dfb7e34fc7 | ||
|
|
2ebdefaab5 | ||
|
|
c609e22270 | ||
|
|
ef9c39f1b6 | ||
|
|
cc9d884ea8 | ||
|
|
94563f69a9 | ||
|
|
2830cb87a4 | ||
|
|
1c8581ff35 | ||
|
|
1d499d9741 | ||
|
|
8cabf948ff | ||
|
|
c13b07e4a3 | ||
|
|
ac37c14b3d | ||
|
|
36e4a02ab8 | ||
|
|
ffc0c48af7 | ||
|
|
206962b218 | ||
|
|
d560e5a9f0 | ||
|
|
98ca1ec462 |
6
.github/workflows/python-package.yml
vendored
6
.github/workflows/python-package.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.5.0
|
||||
@@ -27,8 +27,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install pytest
|
||||
python -m pip install -e .
|
||||
python -m pip install --group dev
|
||||
python -m pip install .
|
||||
- name: Setup FFmpeg
|
||||
uses: FedericoCarboni/setup-ffmpeg@v2
|
||||
- name: Test with pytest
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: Flake8
|
||||
name: Lint with Ruff
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -11,12 +11,11 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.11"]
|
||||
python-version: ["3.13", "3.14"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.5.0
|
||||
@@ -27,14 +26,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install flake8
|
||||
python -m pip install -e .
|
||||
- name: Lint with flake8
|
||||
python -m pip install --group dev
|
||||
python -m pip install .
|
||||
- name: Lint with ruff
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
flake8 wavinfo
|
||||
ruff check src
|
||||
40
.github/workflows/pythonpublish.yml
vendored
40
.github/workflows/pythonpublish.yml
vendored
@@ -8,29 +8,33 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v5.3.0
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools build wheel twine lxml
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
|
||||
- name: Setup uv and Handle Its Cache
|
||||
# You may pin to the exact commit or the version.
|
||||
# uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817
|
||||
uses: hynek/setup-cached-uv@v2.3.0
|
||||
- name: Build
|
||||
run: |
|
||||
python -m build .
|
||||
twine upload dist/*
|
||||
- name: Report to Mastodon
|
||||
uses: cbrgm/mastodon-github-action@v1.0.1
|
||||
uv build --wheel
|
||||
- name: Publish to Pypi
|
||||
uses: pypa/gh-action-pypi-publish@v1.13.0
|
||||
with:
|
||||
message: |
|
||||
I just released a new version of wavinfo, my library for reading WAVE file metadata!
|
||||
#sounddesign #filmmaking #audio #python
|
||||
${{ github.server_url }}/${{ github.repository }}
|
||||
env:
|
||||
MASTODON_URL: ${{ secrets.MASTODON_URL }}
|
||||
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
|
||||
password: ${{ secrets.PYPI_APIKEY }}
|
||||
# - name: Send Bluesky Post
|
||||
# uses: myConsciousness/bluesky-post@v5
|
||||
# with:
|
||||
# text: |
|
||||
# I've released a new version of wavinfo, my module for
|
||||
# reading WAVE metadata.
|
||||
# link-preview-url: ${{ github.server_url }}/${{ github.repository }}
|
||||
# identifier: ${{ secrets.BLUESKY_APP_USER }}
|
||||
# password: ${{ secrets.BLUESKY_APP_PASSWORD }}
|
||||
# service: bsky.social
|
||||
# retry-count: 1
|
||||
|
||||
@@ -9,11 +9,11 @@ version: 2
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
# You can also specify other tool versions:
|
||||
# nodejs: "16"
|
||||
# rust: "1.55"
|
||||
# golang: "1.17"
|
||||
python: "3.13"
|
||||
jobs:
|
||||
install:
|
||||
- pip install --upgrade pip
|
||||
- pip install --group 'doc'
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
@@ -28,5 +28,3 @@ python:
|
||||
install:
|
||||
- method: pip
|
||||
path: .
|
||||
extra_requirements:
|
||||
- doc
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
 [](https://wavinfo.readthedocs.io/en/latest/?badge=latest) 
|
||||
|
||||
[](https://github.com/iluvcapra/wavinfo/actions/workflows/python-package.yml)
|
||||
[](https://github.com/iluvcapra/wavinfo/actions/workflows/python-flake8.yml)
|
||||
[](https://github.com/iluvcapra/wavinfo/actions/workflows/python-ruff.yml)
|
||||
[](https://codecov.io/gh/iluvcapra/wavinfo)
|
||||
|
||||
# wavinfo
|
||||
|
||||
@@ -6,89 +6,135 @@ from the command line and output metadata to stdout.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ wavinfo [--ixml | --adm] INFILE +
|
||||
|
||||
By default, `wavinfo` will output a JSON dictionary for each file argument.
|
||||
$ wavinfo [[-i] | [--ixml | --adm]] INFILE +
|
||||
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
Two option flags will change the behavior of the command:
|
||||
By default, `wavinfo` will output a JSON dictionary for each file argument.
|
||||
|
||||
``-i``
|
||||
`wavinfo` will run in `interactive mode`_.
|
||||
|
||||
Two option flags will change the behavior of the command in non-interactive
|
||||
mode:
|
||||
|
||||
``--ixml``
|
||||
The *\-\-ixml* flag will cause `wavinfo` to output the iXML metadata payload
|
||||
of each input wave file, or will emit an error message to stderr if iXML
|
||||
metadata is not present.
|
||||
The *\-\-ixml* flag will cause `wavinfo` to output the iXML metadata
|
||||
payload of each input wave file, or will emit an error message to stderr if
|
||||
iXML metadata is not present.
|
||||
|
||||
``--adm``
|
||||
The *\-\-adm* flag will cause `wavinfo` to output the ADM XML metadata
|
||||
payload of each input wave file, or will emit an error message to stderr if
|
||||
ADM XML metadata is not present.
|
||||
|
||||
These options are mutually-exclusive, with `\-\-adm` taking precedence.
|
||||
These options are mutually-exclusive, with `\-\-adm` taking precedence. The
|
||||
``--ixml`` and ``--adm`` flags futher take precedence over ``-i``.
|
||||
|
||||
|
||||
Interactive Mode
|
||||
-----------------
|
||||
|
||||
In interactive mode, `wavinfo` will present a command prompt which allows you
|
||||
to query the files provided on the command line and explore the metadata tree
|
||||
interactively. Each file on the command line is scanned and presented as a
|
||||
tree of metadata records.
|
||||
|
||||
Commands include:
|
||||
|
||||
``ls``
|
||||
List the available metadata keys at the current level.
|
||||
|
||||
``cd``
|
||||
Traverse to a metadata key in the current level (or enter `..` to go up
|
||||
to the prevvious level).
|
||||
|
||||
``bye``
|
||||
Exit to the shell.
|
||||
|
||||
Type `help` or `?` at the prompt to get a full list of commands.
|
||||
|
||||
|
||||
Example Output
|
||||
--------------
|
||||
|
||||
.. attention::
|
||||
|
||||
Metadata fields containing binary data, such as the Broadcast-WAV UMID, will
|
||||
be included in the JSON output as a base-64 encoded string, preceded by the
|
||||
marker "base64:".
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
{
|
||||
"filename": "tests/test_files/sounddevices/A101_1.WAV",
|
||||
"run_date": "2022-11-26T17:56:38.342935",
|
||||
"application": "wavinfo 2.1.0",
|
||||
"scopes": {
|
||||
"fmt": {
|
||||
"audio_format": 1,
|
||||
"channel_count": 2,
|
||||
"sample_rate": 48000,
|
||||
"byte_rate": 288000,
|
||||
"block_align": 6,
|
||||
"bits_per_sample": 24
|
||||
{
|
||||
"filename": "../tests/test_files/nuendo/wavinfo Test Project - Audio - 1OA.wav",
|
||||
"run_date": "2024-11-25T10:26:11.280053",
|
||||
"application": "wavinfo 3.0.0",
|
||||
"scopes": {
|
||||
"fmt": {
|
||||
"audio_format": 65534,
|
||||
"channel_count": 4,
|
||||
"sample_rate": 48000,
|
||||
"byte_rate": 576000,
|
||||
"block_align": 12,
|
||||
"bits_per_sample": 24
|
||||
},
|
||||
"data": {
|
||||
"byte_count": 576000,
|
||||
"frame_count": 48000
|
||||
},
|
||||
"ixml": {
|
||||
"track_list": [
|
||||
{
|
||||
"channel_index": "1",
|
||||
"interleave_index": "1",
|
||||
"name": "",
|
||||
"function": "ACN0-FOA"
|
||||
},
|
||||
"data": {
|
||||
"byte_count": 1441434,
|
||||
"frame_count": 240239
|
||||
{
|
||||
"channel_index": "2",
|
||||
"interleave_index": "2",
|
||||
"name": "",
|
||||
"function": "ACN1-FOA"
|
||||
},
|
||||
"ixml": {
|
||||
"track_list": [
|
||||
{
|
||||
"channel_index": "1",
|
||||
"interleave_index": "1",
|
||||
"name": "MKH516 A",
|
||||
"function": ""
|
||||
},
|
||||
{
|
||||
"channel_index": "2",
|
||||
"interleave_index": "2",
|
||||
"name": "Boom",
|
||||
"function": ""
|
||||
}
|
||||
],
|
||||
"project": "BMH",
|
||||
"scene": "A101",
|
||||
"take": "1",
|
||||
"tape": "18Y12M31",
|
||||
"family_uid": "USSDVGR1112089007124001008206300",
|
||||
"family_name": null
|
||||
{
|
||||
"channel_index": "3",
|
||||
"interleave_index": "3",
|
||||
"name": "",
|
||||
"function": "ACN2-FOA"
|
||||
},
|
||||
"bext": {
|
||||
"description": "sSPEED=023.976-ND\r\nsTAKE=1\r\nsUBITS=$12311801\r\nsSWVER=2.67\r\nsPROJECT=BMH\r\nsSCENE=A101\r\nsFILENAME=A101_1.WAV\r\nsTAPE=18Y12M31\r\nsTRK1=MKH516 A\r\nsTRK2=Boom\r\nsNOTE=\r\n",
|
||||
"originator": "Sound Dev: 702T S#GR1112089007",
|
||||
"originator_ref": "USSDVGR1112089007124001008206301",
|
||||
"originator_date": "2018-12-31",
|
||||
"originator_time": "12:40:00",
|
||||
"time_reference": 2190940753,
|
||||
"version": 1,
|
||||
"umid": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coding_history": "A=PCM,F=48000,W=24,M=stereo,R=48000,T=2 Ch\r\n",
|
||||
"loudness_value": null,
|
||||
"loudness_range": null,
|
||||
"max_true_peak": null,
|
||||
"max_momentary_loudness": null,
|
||||
"max_shortterm_loudness": null
|
||||
{
|
||||
"channel_index": "4",
|
||||
"interleave_index": "4",
|
||||
"name": "",
|
||||
"function": "ACN3-FOA"
|
||||
}
|
||||
],
|
||||
"project": "wavinfo Test Project",
|
||||
"scene": null,
|
||||
"take": null,
|
||||
"tape": null,
|
||||
"family_uid": "E5DDE719B9484A758162FF7B652383A3",
|
||||
"family_name": null
|
||||
},
|
||||
"bext": {
|
||||
"description": "wavinfo Test Project Nuendo output",
|
||||
"originator": "Nuendo",
|
||||
"originator_ref": "USJPHNNNNNNNNN202829RRRRRRRRR",
|
||||
"originator_date": "2022-12-02",
|
||||
"originator_time": "10:21:06",
|
||||
"time_reference": 172800000,
|
||||
"version": 2,
|
||||
"umid": "base64:k/zr4qE4RiaXyd/fO7GuCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"coding_history": "A=PCM,F=48000,W=24,T=Nuendo\r\n",
|
||||
"loudness_value": 327.67,
|
||||
"loudness_range": 327.67,
|
||||
"max_true_peak": 327.67,
|
||||
"max_momentary_loudness": 327.67,
|
||||
"max_shortterm_loudness": 327.67
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,25 +12,24 @@
|
||||
# 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.
|
||||
#
|
||||
import importlib
|
||||
# import importlib
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
sys.path.insert(0, os.path.abspath("../../.."))
|
||||
sys.path.insert(0, os.path.abspath('../../src'))
|
||||
sys.path.insert(0, os.path.abspath("../../../src"))
|
||||
print(sys.path)
|
||||
|
||||
import importlib
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = u'wavinfo'
|
||||
copyright = u'2018-2024, Jamie Hardt'
|
||||
copyright = u'2018-2025, Jamie Hardt'
|
||||
author = u'Jamie Hardt'
|
||||
|
||||
# The short X.Y version
|
||||
version = "3.1"
|
||||
version = "4.0"
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = importlib.metadata.version("wavinfo")
|
||||
release = "4.0.0"
|
||||
# release = importlib.metadata.version("wavinfo")
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
# https://python-poetry.org/docs/pyproject/
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
requires = ["uv_build>=0.8.18,<0.9.0"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "wavinfo"
|
||||
version = "3.1.0"
|
||||
version = "4.0.0"
|
||||
description = "Probe WAVE files for all metadata"
|
||||
authors = ["Jamie Hardt <jamiehardt@me.com>"]
|
||||
authors = [{ name = "Jamie Hardt", email = "jamiehardt@me.com"}]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
classifiers = [
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Topic :: Multimedia',
|
||||
'Topic :: Multimedia :: Sound/Audio',
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13"
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: 3.14"
|
||||
]
|
||||
homepage = "https://github.com/iluvcapra/wavinfo"
|
||||
repository = "https://github.com/iluvcapra/wavinfo.git"
|
||||
@@ -39,17 +38,22 @@ keywords = [
|
||||
'broadcast'
|
||||
]
|
||||
|
||||
[tool.poetry.extras]
|
||||
doc = ['sphinx', 'sphinx_rtd_theme']
|
||||
dependencies = [
|
||||
"lxml>=6.0.2",
|
||||
]
|
||||
|
||||
[tool.poetry.scripts]
|
||||
wavinfo = 'wavinfo.__main__:main'
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pytest>=8.3.5",
|
||||
"ruff>=0.14.0",
|
||||
]
|
||||
doc = [
|
||||
"sphinx>=7.1.2",
|
||||
"sphinx-rtd-theme>=3.0.2",
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
lxml = "~= 5.3.0"
|
||||
sphinx_rtd_theme = {version= '>= 1.1.1', optional=true}
|
||||
sphinx = {version= '>= 5.3.0', optional=true}
|
||||
[project.scripts]
|
||||
wavinfo = "wavinfo:__main__.main"
|
||||
|
||||
[tool.pyright]
|
||||
typeCheckingMode = "basic"
|
||||
@@ -65,3 +69,4 @@ disable = [
|
||||
"R0913", # (too-many-arguments)
|
||||
"W0105", # (pointless-string-statement)
|
||||
]
|
||||
|
||||
|
||||
@@ -2,5 +2,8 @@
|
||||
Probe WAVE Files for iXML, Broadcast-WAVE and other metadata.
|
||||
"""
|
||||
|
||||
__all__ = ['WavInfoReader', 'WavInfoEOFError']
|
||||
|
||||
from .wave_reader import WavInfoReader
|
||||
from .riff_parser import WavInfoEOFError
|
||||
|
||||
@@ -8,6 +8,9 @@ import json
|
||||
from enum import Enum
|
||||
import importlib.metadata
|
||||
from base64 import b64encode
|
||||
from cmd import Cmd
|
||||
from shlex import split
|
||||
from typing import List, Dict, Union
|
||||
|
||||
|
||||
class MyJSONEncoder(json.JSONEncoder):
|
||||
@@ -24,6 +27,85 @@ class MissingDataError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class MetaBrowser(Cmd):
|
||||
prompt = "(wavinfo) "
|
||||
|
||||
metadata: Union[List, Dict]
|
||||
path: List[str] = []
|
||||
|
||||
@property
|
||||
def cwd(self):
|
||||
root: List | Dict = self.metadata
|
||||
for key in self.path:
|
||||
if isinstance(root, list):
|
||||
root = root[int(key)]
|
||||
else:
|
||||
root = root[key]
|
||||
|
||||
return root
|
||||
|
||||
@staticmethod
|
||||
def print_value(collection, key):
|
||||
val = collection[key]
|
||||
if isinstance(val, int):
|
||||
print(f" - {key}: {val}")
|
||||
elif isinstance(val, str):
|
||||
print(f" - {key}: \"{val}\"")
|
||||
elif isinstance(val, dict):
|
||||
print(f" - {key}: Dict ({len(val)} keys)")
|
||||
elif isinstance(val, list):
|
||||
print(f" - {key}: List ({len(val)} keys)")
|
||||
elif isinstance(val, bytes):
|
||||
print(f" - {key}: ({len(val)} bytes)")
|
||||
elif val is None:
|
||||
print(f" - {key}: (NO VALUE)")
|
||||
else:
|
||||
print(f" - {key}: Unknown")
|
||||
|
||||
def do_ls(self, _):
|
||||
'List items at the current node: LS'
|
||||
root = self.cwd
|
||||
|
||||
if isinstance(root, list):
|
||||
print("List:")
|
||||
for i in range(len(root)):
|
||||
self.print_value(root, i)
|
||||
|
||||
elif isinstance(root, dict):
|
||||
print("Dictionary:")
|
||||
for key in root:
|
||||
self.print_value(root, key)
|
||||
|
||||
else:
|
||||
print("Cannot print node, is not a list or dictionary.")
|
||||
|
||||
def do_cd(self, args):
|
||||
'Switch to a different node: CD node-name | ".."'
|
||||
argv = split(args)
|
||||
if argv[0] == "..":
|
||||
self.path = self.path[0:-1]
|
||||
else:
|
||||
if isinstance(self.cwd, list):
|
||||
if int(argv[0]) < len(self.cwd):
|
||||
self.path = self.path + [argv[0]]
|
||||
else:
|
||||
print(f"Index {argv[0]} does not exist")
|
||||
elif isinstance(self.cwd, dict):
|
||||
if argv[0] in self.cwd.keys():
|
||||
self.path = self.path + [argv[0]]
|
||||
else:
|
||||
print(f"Key \"{argv[0]}\" does not exist")
|
||||
|
||||
if len(self.path) > 0:
|
||||
self.prompt = "(" + "/".join(self.path) + ") "
|
||||
else:
|
||||
self.prompt = "(wavinfo) "
|
||||
|
||||
def do_bye(self, _):
|
||||
'Exit the interactive browser: BYE'
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
version = importlib.metadata.version('wavinfo')
|
||||
manpath = os.path.dirname(__file__) + "/man"
|
||||
@@ -51,8 +133,15 @@ def main():
|
||||
default=False,
|
||||
action='store_true')
|
||||
|
||||
parser.add_option('-i',
|
||||
help='Read metadata with an interactive prompt',
|
||||
default=False,
|
||||
action='store_true')
|
||||
|
||||
(options, args) = parser.parse_args(sys.argv)
|
||||
|
||||
interactive_dict = []
|
||||
|
||||
# if options.install_manpages:
|
||||
# print("Installing manpages...")
|
||||
# print(f"Docfiles at {__file__}")
|
||||
@@ -98,7 +187,12 @@ def main():
|
||||
|
||||
ret_dict['scopes'][scope][name] = value
|
||||
|
||||
json.dump(ret_dict, cls=MyJSONEncoder, fp=sys.stdout, indent=2)
|
||||
if options.i:
|
||||
interactive_dict.append(ret_dict)
|
||||
else:
|
||||
json.dump(ret_dict, cls=MyJSONEncoder, fp=sys.stdout,
|
||||
indent=2)
|
||||
|
||||
except MissingDataError as e:
|
||||
print("MissingDataError: Missing metadata (%s) in file %s" %
|
||||
(e, arg), file=sys.stderr)
|
||||
@@ -106,6 +200,11 @@ def main():
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
if len(interactive_dict) > 0:
|
||||
cli = MetaBrowser()
|
||||
cli.metadata = interactive_dict
|
||||
cli.cmdloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -3,6 +3,7 @@
|
||||
wavinfo \- probe wave files for metadata
|
||||
.SH SYNOPSIS
|
||||
.SY wavinfo
|
||||
.I "[\-i]"
|
||||
.I "[\-\-adm]"
|
||||
.I "[\-\-ixml]"
|
||||
.I FILE ...
|
||||
@@ -24,6 +25,10 @@ Output any iXML metdata in
|
||||
.BR FILE .
|
||||
.IP "\-h, \-\-help"
|
||||
Print brief help.
|
||||
.IP "\-i"
|
||||
Enter
|
||||
.I "interactive mode"
|
||||
and browse metadata in FILE with an interactive command prompt.
|
||||
.SH DETAILED DESCRIPTION
|
||||
.B wavinfo
|
||||
collects metadata according to different
|
||||
@@ -89,7 +89,7 @@ class WavBextReader:
|
||||
# umid_str = umid_parsed.basic_umid_to_str()
|
||||
# else:
|
||||
|
||||
umid_str = None
|
||||
# umid_str = None
|
||||
|
||||
return {'description': self.description,
|
||||
'originator': self.originator,
|
||||
@@ -98,7 +98,7 @@ class WavBextReader:
|
||||
'originator_time': self.originator_time,
|
||||
'time_reference': self.time_reference,
|
||||
'version': self.version,
|
||||
'umid': umid_str,
|
||||
'umid': self.umid,
|
||||
'coding_history': self.coding_history,
|
||||
'loudness_value': self.loudness_value,
|
||||
'loudness_range': self.loudness_range,
|
||||
Reference in New Issue
Block a user