コード例 #1
0
ファイル: backroom.py プロジェクト: 109021017/muzei
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    crop_tuple = tuple(float(x) for x in json.loads(self.request.get('crop')))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        crop_tuple,
        target_artwork.publish_date.strftime('%Y%m%d') + ' '
            + artwork_json['title'] + ' '
            + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
コード例 #2
0
ファイル: backroom.py プロジェクト: SayCV/AndWall
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        crop_tuple = tuple(
            float(x) for x in json.loads(self.request.get('crop')))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json['imageUri'], crop_tuple,
            target_artwork.publish_date.strftime('%Y%m%d') + ' ' +
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)
コード例 #3
0
ファイル: backroom.py プロジェクト: zhanghuanhome/muzei
    def post(self):
        id = long(self.request.get("id"))
        artwork_json = json.loads(self.request.get("json"))
        crop_tuple = tuple(float(x) for x in json.loads(self.request.get("crop")))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json["title"]
        target_artwork.byline = artwork_json["byline"]

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json["imageUri"],
            crop_tuple,
            target_artwork.publish_date.strftime("%Y%m%d") + " " + artwork_json["title"] + " " + artwork_json["byline"],
        )
        if not new_thumb_url and "thumbUri" in artwork_json:
            new_thumb_url = artwork_json["thumbUri"]

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json["detailsUri"]
        target_artwork.save()
        self.response.set_status(200)
コード例 #4
0
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        crop_tuple = tuple(
            float(x) for x in json.loads(self.request.get('crop')))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']
        target_artwork.attribution = artwork_json[
            'attribution'] if 'attribution' in artwork_json else None

        new_image_url, new_thumb_url = backroomarthelper.maybe_process_image(
            artwork_json['imageUri'], crop_tuple,
            target_artwork.publish_date.strftime('%Y%m%d') + ' ' +
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()

        self.response.set_status(200)
        self.response.out.write(json.dumps(artwork_dict(target_artwork)))
コード例 #5
0
ファイル: backroom.py プロジェクト: romannurik/muzei
    def post(self):
        id = long(self.request.get("id"))
        artwork_json = json.loads(self.request.get("json"))
        crop_tuple = tuple(float(x) for x in json.loads(self.request.get("crop")))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.title = artwork_json["title"]
        target_artwork.byline = artwork_json["byline"]
        target_artwork.attribution = artwork_json["attribution"] if "attribution" in artwork_json else None

        new_image_url, new_thumb_url = backroomarthelper.maybe_process_image(
            artwork_json["imageUri"],
            crop_tuple,
            target_artwork.publish_date.strftime("%Y%m%d") + " " + artwork_json["title"] + " " + artwork_json["byline"],
        )
        if not new_thumb_url and "thumbUri" in artwork_json:
            new_thumb_url = artwork_json["thumbUri"]

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json["detailsUri"]
        target_artwork.save()

        self.response.set_status(200)
        self.response.out.write(json.dumps(artwork_dict(target_artwork)))
コード例 #6
0
ファイル: backroom.py プロジェクト: abdelrhman/muzei
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    crop_tuple = tuple(float(x) for x in json.loads(self.request.get('crop')))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      webapp2.abort(404)

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']
    target_artwork.attribution = artwork_json['attribution'] if 'attribution' in artwork_json else None

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        crop_tuple,
        target_artwork.publish_date.strftime('%Y%m%d') + ' '
            + artwork_json['title'] + ' '
            + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()

    self.response.set_status(200)
    self.response.out.write(json.dumps(artwork_dict(target_artwork)))
コード例 #7
0
ファイル: backroom.py プロジェクト: 109021017/muzei
 def post(self):
   id = long(self.request.get('id'))
   target_artwork = FeaturedArtwork.get_by_id(id)
   if not target_artwork:
     self.response.set_status(404)
     return
   target_artwork.delete()
   self.response.set_status(200)
コード例 #8
0
ファイル: backroom.py プロジェクト: SayCV/AndWall
 def post(self):
     id = long(self.request.get('id'))
     target_artwork = FeaturedArtwork.get_by_id(id)
     if not target_artwork:
         self.response.set_status(404)
         return
     target_artwork.delete()
     self.response.set_status(200)
コード例 #9
0
ファイル: backroom.py プロジェクト: romannurik/muzei
    def post(self):
        id = long(self.request.get("id"))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.delete()
        self.response.set_status(200)
コード例 #10
0
ファイル: backroom.py プロジェクト: romannurik/muzei
    def post(self):
        id = long(self.request.get("id"))
        publish_date = datetime.datetime.utcfromtimestamp(long(self.request.get("publishDate")) / 1000).date()
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        # shift other artworks over
        self.move_artwork(target_artwork, publish_date, target_artwork.key().id())
        self.response.set_status(200)
コード例 #11
0
    def post(self):
        id = long(self.request.get('id'))
        publish_date = (datetime.datetime.utcfromtimestamp(
            long(self.request.get('publishDate')) / 1000).date())
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        # shift other artworks over
        self.move_artwork(target_artwork, publish_date,
                          target_artwork.key().id())
        self.response.set_status(200)
コード例 #12
0
ファイル: backroom.py プロジェクト: 109021017/muzei
  def post(self):
    id = long(self.request.get('id'))
    publish_date = (datetime.datetime
        .utcfromtimestamp(long(self.request.get('publishDate')) / 1000)
        .date())
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    # shift other artworks over
    self.move_artwork(target_artwork, publish_date, target_artwork.key().id())
    self.response.set_status(200)
コード例 #13
0
ファイル: backroom.py プロジェクト: ALEXGUOQ/muzei
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']
    target_artwork.image_url = artwork_json['imageUri']
    target_artwork.thumb_url = (artwork_json['thumbUri']
               if 'thumbUri' in artwork_json
               else (artwork_json['imageUri'] + '!BlogSmall.jpg'))
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']
        target_artwork.image_url = artwork_json['imageUri']
        target_artwork.thumb_url = (artwork_json['thumbUri']
                                    if 'thumbUri' in artwork_json else
                                    (artwork_json['imageUri'] +
                                     '!BlogSmall.jpg'))
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)
コード例 #15
0
ファイル: backroom.py プロジェクト: 8enSmith/muzei
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        artwork_json['title'] + ' ' + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
コード例 #16
0
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json['imageUri'],
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)