Пример #1
0
    def _upload_photo(self, uploadInfo):
        """
        Import a file into the f-spot catalog
        """
        # Check if remote is read only
        if self.photo_remote.IsReadOnly():
            raise Exceptions.SyncronizeError(
                _("F-Spot DBus interface is operating in read-only mode"))

        # create roll if necessary
        if not self.has_roll:
            self.prepare_roll()

        # start with enabled tags from gui, they exist in fspot for sure
        tags = list(self.enabledTags)

        # add tags from upload info
        for tag in uploadInfo.tags:
            self._create_tag(tag)
            tags.append(tag)

        # import the photo
        try:
            id = self.photo_remote.ImportPhoto(uploadInfo.url, True, tags)
            return Rid(uid=str(id))
        except:
            raise Exceptions.SynchronizeError('Import Failed')
Пример #2
0
    def _upload_photo(self, uploadInfo):
        """
		Upload to album
		"""
        try:
            ret = self.salbum.uploadPhoto(uploadInfo.url, uploadInfo.mimeType,
                                          uploadInfo.name)
            return Rid(ret.id)
        except Exception, e:
            raise Exceptions.SyncronizeError("Shutterfly Upload Error.")
Пример #3
0
 def _upload_photo(self, uploadInfo):
     """
     Upload to album; and return image id here
     """
     try:
         rsp = self.fapi.photos.upload(uploadInfo.url,
                                       aid=self.albums.get(
                                           self.albumname, None))
         pid = str(rsp["pid"])
         return Rid(uid=pid)
     except pyfacebook.FacebookError, f:
         raise Exceptions.SyncronizeError("Facebook Upload Error %s" % f)
Пример #4
0
 def _replace_photo(self, id, uploadInfo):
     """
     Replace a photo with a new version
     """
     return Rid(uid=id)
Пример #5
0
        #If all that went well then actually store some notes.
        uid = None
        try:
            if note.title in self._notes:
                log.debug("Updating Existing")
                uid, oldtimestamp, oldcontent = self._notes[note.title]
                self.ba.notes.update(self.pageID, uid, note.title,
                                     note.contents)
            else:
                log.debug("Creating New (title: %s)" % note.title)
                uid, title, timestamp, content = self.ba.notes.create(
                    self.pageID, note.title, note.contents)
                self._notes[title] = (uid, timestamp, content)
        except backpack.BackpackError, err:
            raise Exceptions.SyncronizeError("Could not sync note (%s)" % err)

        return Rid(uid=str(uid), mtime=None, hash=hash(None))

    def delete(self, LUID):
        if LUID in self._notes.values():
            try:
                self.ba.notes.destroy(self.pageID, LUID)
            except backpack.BackpackError, err:
                log.info("Could delete note (%s)" % err)
                raise Exceptions.SyncronizeError
        else:
            log.info("Could not find note")

    def get_UID(self):
        return "%s:%s" % (self.username, self.storeInPage)
Пример #6
0
            self.zapi.delete_from_album(LUID, self.albumId)
            del self.sphotos[LUID]
        except xmlrpclib.Fault, e:
            raise Exceptions.SyncronizeError("Zoto Delete Error: " +
                                             e.faultString)

    def _upload_photo(self, uploadInfo):
        """
        Upload to album
        """
        try:
            fotoId = self.zapi.add_to_album(uploadInfo, self.albumId)
        except Exception, e:
            raise Exceptions.SyncronizeError("Zoto Upload Error.")

        return Rid(uid=fotoId)

    def _replace_photo(self, id, uploadInfo):
        """
        Updates a photo (binary and metadata)
        """
        try:
            fotoId = self.zapi.update_photo(id, uploadInfo)
        except Exception, e:
            raise Exceptions.SyncronizeError("Zoto Update Error.")

        return Rid(uid=fotoId)

    def config_setup(self, config):
        config.add_section(_('Account details'))
        config.add_item(
Пример #7
0
 def get_rid(self):
     return Rid(self.UID)
Пример #8
0
 def _upload_photo(self, uploadInfo):
     if self.slow:
         time.sleep(2)
     LUID = "%s%s%s" % (uploadInfo.name, uploadInfo.url, self._name_)
     return Rid(uid=LUID)