Endpoint: /album/<album_id>/cover/<photo_id>/update.json

        Update the cover photo of an album.
        Returns the updated album object.
482519
def cover_update(self, album, photo, **kwds):
        
        result = self._client.post("/album/%s/cover/%s/update.json" %
                                   (self._extract_id(album),
                                    self._extract_id(photo)),
                                   **kwds)["result"]

        # API currently doesn't return the updated album
        # (frontend issue #1369)
        if isinstance(result, bool): # pragma: no cover
            result = self._client.get("/album/%s/view.json" %
                                      self._extract_id(album))["result"]

        return Album(self._client, result)
183151
def delete(self, photo_id, album_id=0):
        
        if isinstance(photo_id, Info):
            photo_id = photo_id.id
        return self._session.okc_post('photoupload', data={
            'albumid': album_id,
            'picid': photo_id,
            'authcode': self._authcode,
            'picture.delete_ajax': 1
        })
780024
def update(self, data):
        
        data = values.of({'Data': serialize.object(data), })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return DocumentInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
200163
def put_photo(self, image, album_path="me/photos", **kwargs):
        
        return self.request(
            "{0}/{1}".format(self.version, album_path),
            post_args=kwargs,
            files={"source": image},
            method="POST",
        )
488516
def update(self):
        

        if not self.calendar_id:
            return False

        url = self.build_url(self._endpoints.get('calendar'))

        data = {
            self._cc('name'): self.name,
            self._cc('color'): self._cc(self.color.value
                                        if isinstance(self.color, CalendarColor)
                                        else self.color)
        }

        response = self.con.patch(url, data=data)

        return bool(response)
1228578
def _save_owner_cover_photo(session, hash, photo):
        
        response = session.fetch('photos.saveOwnerCoverPhoto', hash=hash, photo=photo)
        return response
850897
public function assetsUpdated(): AlbumInterface
    {
        $assets = $this->assets();
        $feature = $assets->orderBy(Asset::ATTR_UPLOADED_AT, 'desc')->first();

        $this->update([
            self::ATTR_FEATURE_IMAGE => $feature ? $feature->getId() : null,
            self::ATTR_ASSET_COUNT   => $assets->count(),
        ]);

        return $this;
    }
1123555
def update_image(self, name):
        # The `_image` is to avoid conflicts with MutableMapping.update.
        
        api = self.doapi_manager
        return api._image(api.request(self.url, method='PUT',
                                               data={"name": name})["image"])
1249403
def get_album(self, object_id, relation=None, **kwargs):
        
        return self.get_object("album", object_id, relation=relation, **kwargs)
905859
function update() {
    var element = this.element,
        options = this.options,
        isImg = this.isImg;

    // Destroy viewer if the target image was deleted

    if (isImg && !element.parentNode) {
      return this.destroy();
    }

    var images = [];

    forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
      if (options.filter) {
        if (options.filter(image)) {
          images.push(image);
        }
      } else {
        images.push(image);
      }
    });

    if (!images.length) {
      return this;
    }

    this.images = images;
    this.length = images.length;

    if (this.ready) {
      var indexes = [];

      forEach(this.items, function (item, i) {
        var img = item.querySelector('img');
        var image = images[i];

        if (image) {
          if (image.src !== img.src) {
            indexes.push(i);
          }
        } else {
          indexes.push(i);
        }
      });

      setStyle(this.list, {
        width: 'auto'
      });

      this.initList();

      if (this.isShown) {
        if (this.length) {
          if (this.viewed) {
            var index = indexes.indexOf(this.index);

            if (index >= 0) {
              this.viewed = false;
              this.view(Math.max(this.index - (index + 1), 0));
            } else {
              addClass(this.items[this.index], CLASS_ACTIVE);
            }
          }
        } else {
          this.image = null;
          this.viewed = false;
          this.index = 0;
          this.imageData = null;
          this.canvas.innerHTML = '';
          this.title.innerHTML = '';
        }
      }
    } else {
      this.build();
    }

    return this;
  }
635902
private void handleUpdate(final TrackMetadataUpdate update) {
        if ((update.metadata == null) || (update.metadata.getArtworkId() == 0)) {
            // Either we have no metadata, or the track has no album art
            clearDeck(update);
        } else {
            // We can offer artwork for this device; check if we have already looked up this art
            final AlbumArt lastArt = hotCache.get(DeckReference.getDeckReference(update.player, 0));
            final DataReference artReference = new DataReference(update.metadata.trackReference.player,
                    update.metadata.trackReference.slot, update.metadata.getArtworkId());
            if (lastArt == null || !lastArt.artReference.equals(artReference)) {  // We have something new!

                // First see if we can find the new track in one of our in-memory caches
                AlbumArt cached = findArtInMemoryCaches(artReference);
                if (cached != null) {  // Found a cue hit, use it.
                    updateArt(update, cached);
                    return;
                }

                // Not in either cache so try actually retrieving it.
                if (activeRequests.add(update.player)) {
                    clearDeck(update);  // We won't know what it is until our request completes.
                    // We had to make sure we were not already asking for this track.
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                AlbumArt art = requestArtworkInternal(artReference, update.metadata.trackType, true);
                                if (art != null) {
                                    updateArt(update, art);
                                }
                            } catch (Exception e) {
                                logger.warn("Problem requesting album art from update" + update, e);
                            } finally {
                                activeRequests.remove(update.player);
                            }
                        }
                    }).start();
                }
            }
        }
    }
385338
def upload(self, photo_file, **kwds):
        
        with open(photo_file, 'rb') as in_file:
            result = self._client.post("/photo/upload.json",
                                       files={'photo': in_file},
                                       **kwds)["result"]
        return Photo(self._client, result)
916755
def update
      @record = Post.find(params[:id])
      @record.additional_data(params[:additional_data])
      @record.deal_with_cover(params[:has_cover_image])

      respond_to do |format|

        if @record.update_attributes(page_params)

          format.html { redirect_to edit_admin_page_path(@record.id), notice: I18n.t("controllers.admin.pages.update.flash.success") }

        else
          format.html {
            # add breadcrumb and set title
            add_breadcrumb I18n.t("controllers.admin.pages.edit.breadcrumb")
            @record.post_title.blank? ? I18n.t("controllers.admin.pages.edit.title_blank") : I18n.t("controllers.admin.pages.edit.title", post_title: @record.post_title)
            @action = 'update'
            flash[:error] = I18n.t('generic.validation.no_passed')
            render action: "edit"
          }
        end

      end
    end
153405
private function adminUpdateImage()
    {
        /* @var Gallery_Entity_Table_Image $table */
        $table = ORM::getTable($this, 'Image');
        /* @var Gallery_Entity_Image $image */
        $image = $table->find(arg('update', 'int'));

        $new_section = arg('section', 'int');
        if ($new_section == $image->section)
        {
            $image->groupId = arg('group', 'int');
        }
        else
        {
            $image->section = $new_section;
            $image->groupId = arg('new_group', 'int');
        }
        $image->title = arg('title', 'dbsafe');
        $image->posted = new DateTime(arg('posted'));
        $image->cover = arg('cover', 'int');
        $image->active = arg('active', 'int');
        $image->image = 'image'; // $_FILES['image'];

        $table->update($image);

        HTTP::redirect(Eresus_Kernel::app()->getPage()->url());
    }
644395
def update(self):
        
        if self._track_changes:
            data = self.to_api_data(restrict_keys=self._track_changes)
            if data:
                response = self.session.patch(self.build_url(''), data=data)
                if not response:
                    return False
                self._track_changes.clear()
        if self._font._track_changes:
            data = self._font.to_api_data(restrict_keys=self._font._track_changes)
            if data:
                response = self.session.patch(self.build_url(self._endpoints.get('font')), data=data)
                if not response:
                    return False
                self._font._track_changes.clear()
        if self._track_background_color:
            if self._background_color is None:
                url = self.build_url(self._endpoints.get('clear_fill'))
                response = self.session.post(url)
            else:
                data = {'color': self._background_color}
                url = self.build_url(self._endpoints.get('fill'))
                response = self.session.patch(url, data=data)
            if not response:
                return False
            self._track_background_color = False

        return True
597495
def _get_album_or_image(json, imgur):
    """"""
    if json['is_album']:
        return Gallery_album(json, imgur, has_fetched=False)
    return Gallery_image(json, imgur)
1331700
def add_albumart(albumart, song_title):
    '''
    
    '''

    try:
        img = urlopen(albumart)  # Gets album art from url

    except Exception:
        log.log_error("* Could not add album art", indented=True)
        return None

    audio = EasyMP3(song_title, ID3=ID3)
    try:
        audio.add_tags()
    except _util.error:
        pass

    audio.tags.add(
        APIC(
            encoding=3,  # UTF-8
            mime='image/png',
            type=3,  # 3 is for album art
            desc='Cover',
            data=img.read()  # Reads and adds album art
        )
    )
    audio.save()
    log.log("> Added album art")