salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Picase upload requires photos to have filename-extensions in lower case #473

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. rename a normal .jpeg photo to photo.JPEG
2. google picasa -n 'Drop Box' post photo.JPEG

What is the expected output? What do you see instead?
The following happens with uppercase filenames/extensions:
$ google picasa -n 'Drop Box' post hoppa.JPG 
Loading file hoppa.JPG to album Drop Box
Failed to upload hoppa.JPG. (602: Accepted content types: ['image/bmp', 
'image/jpeg', 'image/jpg', 'image/gif', 'image/png', 'image/mpeg', 
'image/mpeg4', 'image/3gpp', 'image/quicktime', 'image/mp4', 'image/x-ms-wmv', 
'image/avi'])

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?
googlecl-0.9.9 (verified the code on googlecl-0.9.13, same issue will be there)

Please provide any additional information below.
The attach patch should resolve the issue. Instead of using the extension from 
the filename, the python module mimetypes can be used to detect the 
content_type more reliably.

Debugging done with python-pdb:
$ python -m pdb /usr/bin/google picasa -n 'Drop Box' post hoppa.JPG 
> /usr/bin/google(43)<module>()
-> """
(Pdb) b /usr/lib/python2.6/site-packages/gdata/photos/service.py:393
Breakpoint 1 at /usr/lib/python2.6/site-packages/gdata/photos/service.py:393
(Pdb) r
Loading file hoppa.JPG to album Drop Box
> /usr/lib/python2.6/site-packages/gdata/photos/service.py(393)InsertPhoto()
-> 'body':'This is not a valid content type: %s' % content_type,
(Pdb) bt
  /usr/lib64/python2.6/bdb.py(372)run()
-> exec cmd in globals, locals
  <string>(1)<module>()
  /usr/bin/google(577)<module>()
-> main()
  /usr/bin/google(571)main()
-> run_once(options, args)
  /usr/bin/google(418)run_once()
-> task.run(client, options, args)
  /usr/lib/python2.6/site-packages/googlecl/picasa/service.py(406)_run_post()
-> user=options.owner or options.user)

/usr/lib/python2.6/site-packages/googlecl/picasa/service.py(273)insert_media_lis
t()
-> content_type=content_type)

/usr/lib/python2.6/site-packages/gdata/photos/service.py(469)InsertPhotoSimple()
-> content_type)
> /usr/lib/python2.6/site-packages/gdata/photos/service.py(393)InsertPhoto()
-> 'body':'This is not a valid content type: %s' % content_type,
(Pdb) print content_type
image/JPG
(Pdb) print filename_or_handle
hoppa.JPG
(Pdb) import mimetypes as m
(Pdb) m.init()
(Pdb) m.guess_type(filename_or_handle)
('image/jpeg', None)

Original issue reported on code.google.com by ni...@nixpanic.net on 7 Apr 2012 at 3:39

Attachments:

GoogleCodeExporter commented 9 years ago
A similar patch has been included in a version of googlecli-0.9.9 for Fedora 
EPEL-6:
- https://bugzilla.redhat.com/show_bug.cgi?id=810641

Original comment by ni...@nixpanic.net on 7 Apr 2012 at 4:21

GoogleCodeExporter commented 9 years ago
Reference to hte googlecl-discuss thread:
- 
http://groups.google.com/group/googlecl-discuss/browse_thread/thread/baa6b94ebf5
dbdd0#

Original comment by de...@fedoraproject.org on 1 May 2012 at 9:05