From 188ba855b296e7747597b52f95a0069ce8039631 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 5 Jan 2019 21:49:58 -0800 Subject: [PATCH] Update wave_reader.py Added `url` property --- wavinfo/wave_reader.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wavinfo/wave_reader.py b/wavinfo/wave_reader.py index 3e1a514..7c36350 100644 --- a/wavinfo/wave_reader.py +++ b/wavinfo/wave_reader.py @@ -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)