Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Google App Engine Standard Runtime #286

Closed
mike-matera opened this issue Jan 15, 2017 · 4 comments
Closed

Support Google App Engine Standard Runtime #286

mike-matera opened this issue Jan 15, 2017 · 4 comments
Labels

Comments

@mike-matera
Copy link

@mike-matera mike-matera commented Jan 15, 2017

Hi,

GAE does not support the 'mmap' library in Python. Applications have no direct access to files at the operating system level. The runtime does support file-like objects that can, read, write, seek, etc. In the current version of mutagen it's possible to read ID3 tags from a file if the "import mmap" line is changed in _util.py to be:

try : 
   import mmap
except : 
   pass

I'm happy to help by providing testing and any environment setup documentation. Just ask.

Thanks!
./m

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jan 15, 2017

Thanks

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jan 16, 2017

fyi, more info for working with file-like objects: https://mutagen.readthedocs.io/en/latest/user/filelike.html

@mike-matera

This comment has been minimized.

Copy link
Author

@mike-matera mike-matera commented Jan 16, 2017

Thanks! This works for me. In case you're interested here's some more detail about using App Engine and Cloud Storage:

There are two APIs for accessing cloud storage in AppEngine. One gives a file-like object, which works for reading tags. The file-like API only transfers blocks of the file that the application requests. Which is great because it takes much less than one second to read the ID3 tags in a 100MB MP3 file.

Writing tags is a different story. Google Cloud Storage blobs are immutable (they can't be written). A blob update therefore is a read-modify-write. In the case of writing tags the whole MP3 would have to be pulled down modified locally and rewritten. Which can get expensive if you have long files (like two-hour DJ mixes). It's not clear to me whether it's even possible to do this in App Engine. If I ever try it I'll let you know.

Thanks again!

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jan 17, 2017

Thanks for the info.

mutagen does quote a lot of read/seek calls when parsing; not sure how the file-like is implemented, but in case those operations have a large overhead looking into caching might speed things up a bit. Maybe they can be wrapped with io.BufferReader?

lazka added a commit that referenced this issue Jan 22, 2017
Handle the case importing mmap fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.