When looking the script I wrote that upload pictures, I see that for
the 2nd argument I pass to InsertPhotoSimple(), I volontary strip the
filename extension and the path and use it for the title.

        self._gd.InsertPhotoSimple(album_url,
--->            filename.split('/')[-1].split('.')[0],
                '', filename, content_type=file_type)

but in the python-gdata client library, InsertPhotoSimple() is defined
this way:

  def InsertPhotoSimple(self, album_or_uri, title, summary,
filename_or_handle,
      content_type='image/jpeg', keywords=None):
    """Add a photo without constructing a PhotoEntry.

    Needs authentication, see self.ClientLogin()

    Arguments:
    album_or_uri: AlbumFeed or uri of the album where the photo should
go
    title: Photo title
    summary: Photo summary / description
    filename_or_handle: A file-like object or file name where the
image/video
      will be read from
    content_type (optional): Internet media type (a.k.a. mime type) of
      media object. Currently Google Photos supports these types:
[snip]

the 2nd argument is explained as "Photo title"... that cause the
confusion that let me think I could removed the filename extension.

so, I see 3 things here:
1: python-gdata is not clear enough on the definition of the 2nd
argument.
2: PicasaWeb API atom entries are using title as the filename, 2
differents things
3: PicasaWeb, or at least the part that enable or disable rotation in
the web interface, get the mime-type of a picture in the filename
(entry.title.text). something that can be dangerous (rename a .gif in
a .jpg)

On Nov 20, 8:53 am, "bruno.clermont" <[EMAIL PROTECTED]> wrote:
> Hi,
> after running something like this:
>
>         for photo in photos.entry:
>             if photo.title.text[-3:] != 'jpg':
>                 photo.title.text = '%s.jpg' % photo.title.text
>                 gd.UpdatePhotoMetadata(photo)
>
> I can now rotate all pictures!
> thanks!
>
> On Nov 19, 11:14 pm, "bruno.clermont" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Jeff,
>
> > Oh... that's why... thanks! I tought the mime-type was stored outside
> > the entry.text.title! because the python API require it to let me
> > upload the picture... here is the function of my code that upload the
> > picture:
>
> >     def upload(self, album, filename):
> >         album_url = '/data/feed/api/user/%s/album/%s' % (
> >                 self._username, album.name.text)
> >         file_type = mimetypes.guess_type(filename)[0]
> >         if not file_type:
> >             raise ValueError("Can't guess the mime-type of file '%s'"
> > %
> >                     filename)
> >         self._gd.InsertPhotoSimple(album_url,
> >                 filename.split('/')[-1].split('.')[0],
> >                 '', filename, content_type=file_type)
>
> > in fact, I don't define the entry.title, I just leave python-gdata do
> > it for me... I use mimetypes module to detect it for InsertPhotoSimple
> > (). So, this happened because the files I tried to upload had
> > extension .JPG (my camera use upercase like this)? is that a bug in
> > the python client API?
>
> > in mean time, I'm going to write a script that will check all entries
> > that don't have a filename extension in entry.title.text and append
> > one automatically.
>
> > thanks!
>
> > On Nov 19, 6:18 pm, Jeff Fisher <[EMAIL PROTECTED]> wrote:
>
> > > You're going to find this interesting. First notice that the title of the
> > > photo (entry.title.text if you're using the Python client) doesn't show up
> > > anywhere visible on the site.
>
> > > Now compare the entry where it fails:
>
> > >http://picasaweb.google.com/data/entry/api/user/bruno.clermont/album/...
>
> > > <title type="text">cimg7881</title>
>
> > > To the one where it works:
>
> > >http://picasaweb.google.com/data/entry/api/user/bruno.clermont/albumi...
>
> > > <title type="text">reuploaded.jpg</title>
>
> > > Now let me tell you a small secret - only JPEG images can be rotated at 
> > > the
> > > moment. Fair enough, right? But how does the UI know what is a JPEG and 
> > > what
> > > isn't? Oh dear... :)
>
> > > So anyway, it's a bug we have to fix, but in the mean time if you make 
> > > sure
> > > the upload title matches the original filename (or at least ends in .jpg)
> > > you should see the rotate buttons show up again.
>
> > > Cheers,
> > > -Jeff
>
> > > On Wed, Nov 19, 2008 at 11:21 AM, bruno.clermont
> > > <[EMAIL PROTECTED]>wrote:
>
> > > > On Nov 19, 1:17 pm, "Jeff Fisher (Google)" <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > This shouldn't make a difference. I'm not sure what causes the rotate
> > > > > buttons to be disabled. Can you link to a photo uploaded through the
>
> > > > Here is the link to a picture uploaded using the API that I can't
> > > > rotate (I'm logged and the owner of the picture):
>
> > > >http://picasaweb.google.com/bruno.clermont/Espagne2008#52648855762404...
>
> > > > and here what appear on my browser, see the disabled buttons to rotate
> > > > the picture:
>
> > > >http://lh6.ggpht.com/_EX0dlMLYvE4/SR8zP1HLRlI/AAAAAAAAQGk/O0pI-BSbHbY...
>
> > > > As you suggested, I took the picture, downloaded it on my disk and
> > > > upload it again in the same album, this time trough the basic web
> > > > uploader (no API nor the Picasa desktop application)... and this time
> > > > I'm allowed to rotate it if I want, here is the re-uploaded picture
> > > > link:
>
> > > >http://picasaweb.google.com/bruno.clermont/Espagne2008#52704496750943...
>
> > > > > Python client library that can't be rotated and then to the same photo
> > > > > uploaded through the Picasa uploader that can? This will make
> > > > > debugging the issue much easier.
>
> > > > > Cheers,
> > > > > -Jeff
>
> > > > > On Nov 18, 6:51 pm, "bruno.clermont" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi,
>
> > > > > > I wrote a small python script that upload in batch pictures from my
> > > > > > camera. I simply use the latest version of Google 
> > > > > > gdata-python-client
> > > > > > library (http://code.google.com/p/gdata-python-client/) and use like
> > > > > > they show in the documentation.
>
> > > > > > It work fine... but every pictures I upload, can't be rotated in the
> > > > > > web interface of PicasaWeb. The rotate left/right button are grey 
> > > > > > and
> > > > > > can't be clicked. I asked the question in PIcasaWeb forum and 
> > > > > > someone
> > > > > > suggested me to ask the question here...
>
> > > > > > So, my original thread is here:
>
> > > > > >http://groups.google.com/group/PicasaWebAlbums/browse_thread/thread/c.
> > > > ..
>
> > > > > > and it moved here:
> > > >http://groups.google.com/group/PicasaWebAlbums/browse_thread/thread/8...
>
> > > > > > When uploading a picture manually trough the web interface, I can
> > > > > > rotate it.
>
> > > > > > Is there a reason a picture uploaded using the PicasaWeb API can't 
> > > > > > be
> > > > > > rotated?
>
> > > > > > thanks!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to