Skip to content

Commit

Permalink
quodlibet#207: changed access scope of __fileobj from private to prot…
Browse files Browse the repository at this point in the history
…ected
  • Loading branch information
Borewit authored and phw committed Oct 15, 2019
1 parent f373fe8 commit fbe791a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions mutagen/_riff.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class RiffFile(object):
"""

def __init__(self, fileobj):
self.__fileobj = fileobj
self._fileobj = fileobj
self.__riffChunks = {}

# Reset read pointer to beginning of RIFF file
Expand Down Expand Up @@ -152,7 +152,7 @@ def __getitem__(self, id_):
return self.__riffChunks[id_]
except KeyError:
raise KeyError(
"%r has no %r chunk" % (self.__fileobj, id_))
"%r has no %r chunk" % (self.fileobj, id_))

def __delitem__(self, id_):
"""Remove a chunk from the IFF file"""
Expand All @@ -172,10 +172,10 @@ def insert_chunk(self, id_):
if not is_valid_chunk_id(id_):
raise KeyError("RIFF key must be four ASCII characters.")

self.__fileobj.seek(self.__next_offset)
self.__fileobj.write(pack('>4si', id_.ljust(4).encode('ascii'), 0))
self.__fileobj.seek(self.__next_offset)
chunk = RiffChunkHeader(self.__fileobj, self[u'RIFF'])
self.fileobj.seek(self.__next_offset)
self.fileobj.write(pack('>4si', id_.ljust(4).encode('ascii'), 0))
self.fileobj.seek(self.__next_offset)
chunk = RiffChunkHeader(self.fileobj, self[u'RIFF'])
self[u'RIFF']._update_size(self[u'RIFF'].data_size + chunk.size)

self.__riffChunks[id_] = chunk
Expand Down
15 changes: 7 additions & 8 deletions mutagen/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __getitem__(self, id_):
return self.__wavChunks[id_]
except KeyError:
raise KeyError(
"%r has no %r chunk" % (self._RiffFile__fileobj, id_))
"%r has no %r chunk" % (self._fileobj, id_))

def __delitem__(self, id_):
"""Remove a chunk from the RIFF/WAVE file"""
Expand All @@ -187,21 +187,20 @@ def insert_chunk(self, id_):

check_id(id_)

self._RiffFile__fileobj.seek(self.__next_offset)
self._RiffFile__fileobj.write(pack('<4si',
id_.ljust(4).encode('ascii'), 0))
self._RiffFile__fileobj.seek(self.__next_offset)
chunk = RiffChunkHeader(self._RiffFile__fileobj)
self._fileobj.seek(self.__next_offset)
self._fileobj.write(pack('<4si', id_.ljust(4).encode('ascii'), 0))
self._fileobj.seek(self.__next_offset)
chunk = RiffChunkHeader(self._fileobj)
self[u'RIFF']._update_size(self[u'RIFF'].data_size + chunk.size)

self.__wavChunks[id_] = chunk
self.__next_offset = chunk.offset + chunk.size


class WaveStreamInfo(StreamInfo):
"""RiffWave()
"""WaveStreamInfo()
Microsoft WAVE soundfile information.
Microsoft WAVE file information.
Information is parsed from the 'fmt ' & 'data'chunk of the RIFF/WAVE file
Expand Down

0 comments on commit fbe791a

Please sign in to comment.