mirror of
https://github.com/iluvcapra/mfbatch.git
synced 2025-12-31 08:50:51 +00:00
pylints
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
# metaflac.py
|
"""
|
||||||
# mfbatch
|
mbatch metaflac - Read/write metadata functions
|
||||||
|
"""
|
||||||
|
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
from re import match
|
from re import match
|
||||||
from io import StringIO
|
|
||||||
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
@@ -38,9 +38,11 @@ def sanatize_value(v: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def read_metadata(path: str, metaflac_path=METAFLAC_PATH) -> FlacMetadata:
|
def read_metadata(path: str, metaflac_path=METAFLAC_PATH) -> FlacMetadata:
|
||||||
|
"""
|
||||||
|
Read metadata from a FLAC file
|
||||||
|
"""
|
||||||
metaflac_command = [metaflac_path, '--list']
|
metaflac_command = [metaflac_path, '--list']
|
||||||
result = run(metaflac_command + [path], capture_output=True)
|
result = run(metaflac_command + [path], capture_output=True, check=True)
|
||||||
result.check_returncode()
|
|
||||||
|
|
||||||
file_metadata = {}
|
file_metadata = {}
|
||||||
for line in result.stdout.decode('utf-8').splitlines():
|
for line in result.stdout.decode('utf-8').splitlines():
|
||||||
@@ -53,8 +55,10 @@ def read_metadata(path: str, metaflac_path=METAFLAC_PATH) -> FlacMetadata:
|
|||||||
|
|
||||||
def write_metadata(path: str, data: FlacMetadata,
|
def write_metadata(path: str, data: FlacMetadata,
|
||||||
metaflac_path=METAFLAC_PATH):
|
metaflac_path=METAFLAC_PATH):
|
||||||
remove_job = run([metaflac_path, '--remove-all-tags', path])
|
"""
|
||||||
remove_job.check_returncode()
|
Write metadata to a FLAC file
|
||||||
|
"""
|
||||||
|
run([metaflac_path, '--remove-all-tags', path], check=True)
|
||||||
|
|
||||||
metadatum_f = ""
|
metadatum_f = ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user