GMusicFS icon indicating copy to clipboard operation
GMusicFS copied to clipboard

Error when reading files - AttributeError: 'Buffer' object has no attribute 'headers'

Open Elizafox opened this issue 11 years ago • 2 comments

Hi,

cp gives me this error when I try to copy files:

elizabeth@ein ~/google_music/artists/crudbump/2012 - real art $ cp 002\ -\ white\ house.mp3 ~
cp: error reading ‘002 - white house.mp3’: Bad address
cp: failed to extend ‘/home/elizabeth/002 - white house.mp3’: Bad address

The debug log is filled with stuff like this:

DEBUG:fuse.log-mixin:<- open 32768
DEBUG:fuse.log-mixin:-> read /artists/crudbump/2012 - real art/006 - i'm meaty.mp3 (16384L, 0, 32768L)
DEBUG:fuse.log-mixin:<- read '[Unhandled Exception]'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/fuse.py", line 420, in _wrapper
    return func(*args, **kwargs) or 0
  File "/usr/lib64/python2.7/site-packages/fuse.py", line 500, in read
    offset, fh)
  File "/usr/lib64/python2.7/site-packages/fuse.py", line 887, in __call__
    ret = getattr(self, op)(path, *args)
  File "/usr/lib64/python2.7/site-packages/gmusicfs/gmusicfs.py", line 332, in read
    if artist_album_track_m and (int(u.headers['Content-Length']) < (offset + size)):
AttributeError: 'Buffer' object has no attribute 'headers'

Elizafox avatar Feb 09 '14 02:02 Elizafox

(Those were for two different files obviously, but the outcome is the same)

Elizafox avatar Feb 09 '14 17:02 Elizafox

Okay, after investigating the issue...

It tries to get the urllib2 handle like so, a few lines prior:

u = self.__open_files.get(fh, None)

In the open function, around line 302, it does this:

        #Check for multi-part 
        if len(urls) > 1:
            self.__open_files[fh] = self.__open_multi_part(urls, path)
        else:
            u = self.__open_files[fh] = urllib2.urlopen(urls[0])
            u.bytes_read = 0
        return fh

Spot the bug in __open_multi_part ;p

    def __open_multi_part(self, urls, path):
        """Starts a thread to download a multi-part track (Google Play All
        Access) into a single file in the cache directory and return
        an open file handle for it while it downloads.
        """
        buf = fifo.Buffer()
        # Start downloading the multi part track in another thread:
        downloader = AllAccessTrackDownloader(urls, buf, path)
        downloader.start()
        # Return the buffer, while the download is still happening:
        return buf

Elizafox avatar Feb 10 '14 03:02 Elizafox