metaWeblog.newMediaObject(blog_id, username, password, media)
    => media structure
975213
def new_media_object(blog_id, username, password, media):
    
    authenticate(username, password)
    path = default_storage.save(Entry().image_upload_to(media['name']),
                                ContentFile(media['bits'].data))
    return {'url': default_storage.url(path)}
1001139
function createDBAdapter() {
  var returnObj = {
    getMeta,
    patchMeta
  };

  for (const key in db) {
    /* istanbul ignore else */
    if (db.hasOwnProperty(key) && key.indexOf('Meta') === -1) {
      returnObj[key] = db[key];
    }
  }

  return returnObj;
}
1336364
def write(self, oprot):
        '''
        
        '''

        oprot.write_struct_begin('OnlineDatabaseObjectDetailImage')

        oprot.write_field_begin(name='full_size_url', type=11, id=None)
        oprot.write_string(self.full_size_url)
        oprot.write_field_end()

        oprot.write_field_begin(name='mediaid', type=11, id=None)
        oprot.write_string(self.mediaid)
        oprot.write_field_end()

        oprot.write_field_begin(name='objectid', type=11, id=None)
        oprot.write_string(self.objectid)
        oprot.write_field_end()

        oprot.write_field_begin(name='src', type=11, id=None)
        oprot.write_string(self.src)
        oprot.write_field_end()

        oprot.write_field_begin(name='thumbnail_url', type=11, id=None)
        oprot.write_string(self.thumbnail_url)
        oprot.write_field_end()

        oprot.write_field_begin(name='title', type=11, id=None)
        oprot.write_string(self.title)
        oprot.write_field_end()

        oprot.write_field_begin(name='type', type=11, id=None)
        oprot.write_string(str(self.type))
        oprot.write_field_end()

        oprot.write_field_stop()

        oprot.write_struct_end()

        return self
790195
function describe(id, callback) {
    if (id == undefined)
      return callback(new TypeError("'id' can't be null or undefined"))

    var mediaObject = objects[id];
    if (mediaObject) return callback(null, mediaObject);

    var params = {
      object: id
    };

    function callback2(error, result) {
      if (error) return callback(error);

      var mediaObject = mediaObjectCreator.createInmediate(result);

      return callback(null, registerObject(mediaObject, id));
    }

    encode('describe', params, callback2);
  }
229146
def new(cls,
            username,
            password=None,
            email=None,
            first_name="",
            last_name="",
            login_method=None,
            role="MEMBER"
            ):
        
        data = {
            "first_name": first_name,
            "last_name": last_name,
            "email": email
        }

        if not password:
            password = utils.generate_random_string()

        username = username.strip().lower()
        if "@" in username and not email:
            if not utils.is_email_valid(username):
                exceptions.AuthError(_("Invalid username"))
            data["email"] = username
        elif email:
            if not utils.is_email_valid(email):
                exceptions.AuthError(_("Invalid username"))

        if not utils.is_username_valid(username):
            exceptions.AuthError(_("Invalid username"))
        if not utils.is_password_valid(password):
            raise exceptions.AuthError(_("Password is invalid"))

        if cls.get_by_username(username):
            raise exceptions.AuthError(_("Username exists already"))
        _email = data.get("email")
        if _email:
            if cls.get_by_email(_email):
                raise exceptions.AuthError(_("Email address exists already"))

        role = AuthUserRole.get_by_name(role or "MEMBER")
        if not role:
            raise exceptions.AuthError(_("Invalid user role"))

        data.update({
            "username": username,
            "password_hash": cls.encrypt_password(password),
            "email_verified": False,
            "login_method": login_method,
            "role": role,
            "status": cls.STATUS_ACTIVE
        })
        user = cls.create(**data)
        user.reset_secret_key()
        return user
1256400
function MediaObject(){
  MediaObject.super_.call(this);


  var self = this;


  //
  // Define object properties
  //

  /**
   * Unique identifier of this object
   *
   * @public
   * @readonly
   * @member {external:Number} id
   */
  this.once('_id', function(error, id)
  {
    if(error)
      return Object.defineProperties(this,
      {
        '_createError': {value: error},
        'id': {value: null, enumerable: true}
      });

    Object.defineProperty(this, 'id',
    {
      configurable: true,
      enumerable: true,
      value: id
    });
  })

  //
  // Subscribe and unsubscribe events on the server when adding and removing
  // event listeners on this MediaObject
  //

  var subscriptions = {};

  this.on('removeListener', function(event, listener)
  {
    // Blacklisted events
    if(event[0] == '_'
    || event == 'release'
    || event == 'newListener')
      return;

    var count = EventEmitter.listenerCount(this, event);
    if(count) return;

    var token = subscriptions[event];

    var params =
    {
      object: this,
      subscription: token
    };

    this.emit('_rpc', undefined, 'unsubscribe', params, function(error)
    {
      if(error) return self.emit('error', error);

      delete subscriptions[event];
    });
  });

  this.on('newListener', function(event, listener)
  {
    // Blacklisted events
    if(event[0] == '_'
    || event == 'release')
      return;

    var constructor = this.constructor;

    if(constructor.events.indexOf(event) < 0)
      throw new SyntaxError(constructor.name+" doesn't accept events of type '"+event+"'")

    var count = EventEmitter.listenerCount(this, event);
    if(count) return;

    var params =
    {
      object: this,
      type: event
    };

    this.emit('_rpc', undefined, 'subscribe', params, function(error, token)
    {
      if(error) return self.emit('error', error);

      subscriptions[event] = token;
    });
  });
}
73201
function() {
		try {
			var self = this;

			if (this.data.url.match("<blockquote class=['\"]imgur-embed-pub['\"]")){
				var found = this.data.url.match(/(imgur\.com)\/(\w+)/);
				this.media_id = found[2];
				this.data.url = "http://imgur.com/gallery/" + this.media_id;
			}
			else if (this.data.url){
				this.media_id = this.data.url.split('/').slice(-1)[0];
			}

	        TL.Load.js([
						'https://s.imgur.com/min/embed.js'], 
					function(){
						self.createMedia();
					}
			);

		} catch(e) {
		    this.loadErrorDisplay(this._("imgur_invalidurl_err"));
		}
	}
369741
function metaData( $contentObjectAttribute )
    {
        $metaString = "";
        $user = $contentObjectAttribute->content();

        if ( $user instanceof eZUser )
        {
            // create a default user account
            $metaString .= $user->attribute( 'login' ) . " ";
            $metaString .= $user->attribute( 'email' ) . " ";
        }
        return $metaString;
    }
1001599
function createMediaObject(item, callback) {
    var transaction = item.transaction;
    delete item.transaction;

    var constructor = createConstructor(item, strict);

    item = constructor.item;
    delete constructor.item;

    var params = item.params || {};
    delete item.params;

    if (params.mediaPipeline == undefined && host instanceof register.classes
      .MediaPipeline)
      params.mediaPipeline = host;

    var params_ = extend({}, params)
    item.constructorParams = checkParams(params_, constructor.constructorParams,
      item.type);

    if (Object.keys(params_)) {
      item.properties = params_;
    }

    if (!Object.keys(item.constructorParams).length)
      delete item.constructorParams;

    try {
      var mediaObject = createObject(constructor)
    } catch (error) {
      return callback(error)
    };

    Object.defineProperty(item, 'object', {
      value: mediaObject
    });

    encodeCreate(transaction, item, callback);

    return mediaObject
  }
204365
def blog__get_category(id: nil, permalink: nil)
      return {} unless id || permalink

      if id
        category = LatoBlog::Category.find_by(id: id.to_i)
      else
        category = LatoBlog::Category.find_by(meta_permalink: permalink)
      end

      category.serialize
    end
271249
function BuildHead(metaObject = {}) {
    const metaCopy = Object.assign({}, metaObject);
    let finalString = "";
    if (metaCopy.title) {
        finalString += `<title>${metaCopy.title}</title>`;
    }

    if (metaCopy.meta) {
        throw new Error("WARNING - DEPRECATED: It looks like you're using the old meta object, please migrate to the new one");
    }

    if (metaCopy.metas) {
        for (let index = 0; index < metaCopy.metas.length; index++) {
            const headItem = metaCopy.metas[index];
            const processedItem = ProcessMetaItem(headItem);
            if (processedItem !== undefined) {
                finalString += processedItem;
            }
        }
    }

    if (metaCopy.scripts) {
        for (let index = 0; index < metaCopy.scripts.length; index++) {
            const headItem = metaCopy.scripts[index];
            const processedItem = ProcessScriptItem(headItem);
            if (processedItem !== undefined) {
                finalString += processedItem;
            }
        }
    }

    if (metaCopy.styles) {
        for (let index = 0; index < metaCopy.styles.length; index++) {
            const headItem = metaCopy.styles[index];
            const processedItem = ProcessStyleItem(headItem);
            if (processedItem !== undefined) {
                finalString += processedItem;
            }
        }
    }

    if (metaCopy.structuredData) {
        finalString += `<script type="application/ld+json">${JSON.stringify(metaCopy.structuredData)}</script>`;
    }

    return finalString;
}
713523
function bin(argv) {
  // setup config
  var config = require('../config/config.js')

  program
  .option('-d, --database <database>', 'Database')
  .parse(argv)

  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase
  var url = process.argv[2] || 'https://www.reddit.com/r/perfectloops/top/?sort=top&t=all&count=25&after=t3_4j0v4f'

  qpm_media.getLastSeen(function(err, ret){
    if (err) {
      console.error(err)
    } else {
      console.log(ret[0][0].uri);
    }
  })


}
611063
function registerObject(mediaObject, id) {
    var object = objects[id];
    if (object) return object;

    mediaObject.emit('_id', null, id);

    objects[id] = mediaObject;

    /**
     * Remove the object from cache
     */
    mediaObject.once('release', function () {
      delete objects[id];
    });

    return mediaObject;
  }
1064026
def set_meta(self, _props):
        """"""
        if self.is_fake:
            return

        props = {}
        for key, value in _props.items():
            key, value = self.meta_mappings.map_set(key, value)
            props[key] = value

        # Pop out tag which we don't want
        props.pop("tag", None)

        self.journal.update_info({})
        self.journal.update_info(props)
        self.journal.save()
902838
def libvlc_media_save_meta(p_md):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_save_meta', None) or \
        _Cfunction('libvlc_media_save_meta', ((1,),), None,
                    ctypes.c_int, Media)
    return f(p_md)
529666
def get_recent_posts(blog_id, username, password, number):
    
    user = authenticate(username, password)
    site = Site.objects.get_current()
    return [post_structure(entry, site)
            for entry in Entry.objects.filter(authors=user)[:number]]
973300
public Post postReblog(String blogName, Long postId, String reblogKey, Map<String, ?> options) {
        if (options == null) {
            options = new HashMap<String, String>();
        }
        Map<String, Object> soptions = JumblrClient.safeOptionMap(options);
        soptions.put("id", postId.toString());
        soptions.put("reblog_key", reblogKey);
        final Long reblogId = requestBuilder.post(JumblrClient.blogPath(blogName, "/post/reblog"), soptions).getId();
        return this.blogPost(blogName, reblogId);
    }