mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 08:50:41 +00:00
Update wave_reader.py
Added `url` property
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#-*- coding: utf-8 -*-
|
#-*- coding: utf-8 -*-
|
||||||
import struct
|
import struct
|
||||||
|
import pathlib
|
||||||
|
import os
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from .riff_parser import parse_chunk, ChunkDescriptor, ListChunkDescriptor
|
from .riff_parser import parse_chunk, ChunkDescriptor, ListChunkDescriptor
|
||||||
@@ -14,7 +15,6 @@ WavDataDescriptor = namedtuple('WavDataDescriptor','byte_count frame_count')
|
|||||||
#: The format of the audio samples.
|
#: The format of the audio samples.
|
||||||
WavAudioFormat = namedtuple('WavAudioFormat','audio_format channel_count sample_rate byte_rate block_align bits_per_sample')
|
WavAudioFormat = namedtuple('WavAudioFormat','audio_format channel_count sample_rate byte_rate block_align bits_per_sample')
|
||||||
|
|
||||||
|
|
||||||
class WavInfoReader():
|
class WavInfoReader():
|
||||||
"""
|
"""
|
||||||
Parse a WAV audio file for metadata.
|
Parse a WAV audio file for metadata.
|
||||||
@@ -34,7 +34,8 @@ class WavInfoReader():
|
|||||||
but this parameter is available to you if you encounter a werido.
|
but this parameter is available to you if you encounter a werido.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
absolute_path = os.path.abspath(path)
|
||||||
|
self.url = pathlib.Path(absolute_path).as_uri()
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
chunks = parse_chunk(f)
|
chunks = parse_chunk(f)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user