Update wave_reader.py

Added `url` property
This commit is contained in:
Jamie Hardt
2019-01-05 21:49:58 -08:00
parent 2f1511d935
commit 188ba855b2

View File

@@ -1,6 +1,7 @@
#-*- coding: utf-8 -*-
import struct
import pathlib
import os
from collections import namedtuple
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.
WavAudioFormat = namedtuple('WavAudioFormat','audio_format channel_count sample_rate byte_rate block_align bits_per_sample')
class WavInfoReader():
"""
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.
"""
absolute_path = os.path.abspath(path)
self.url = pathlib.Path(absolute_path).as_uri()
with open(path, 'rb') as f:
chunks = parse_chunk(f)