Media Management
  • 21 Dec 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Media Management

  • Dark
    Light
  • PDF

Article Summary

Overview

This section explains how to use SDK and LandingLens CLI to manage your dataset. You will be able to:

  • Upload new media with label, split, and metadata.
  • Set metadata for existing images.

SDK Usage

from landinglens import LandingLens

# Instantiate the llens client - Optionally can provide API Key and Secret
llens = LandingLens()

llens.metadata.upload(media_id=[123, 124], timestamp=12345)
# project_id: 1190
# metadata:   {"timestamp": "12345"}
# media_ids:  [123, 124]

llens.media.ls()
# (lists all media with metadata from a project)
# { medias: [{'id': 4358352, 'mediaType': 'image', 'srcType': 'user', 'srcName': 'Michal', 'properties': {'width': 258, 'height': 176}, 'name': 'n01443537_501.JPEG', 'uploadTime': '2020-09-15T22:29:01.338Z', 'metadata': {'source': 'prod'}, 'media_status': 'raw'}, ...],
# num_requested: 1000,
# count: 300,
# offset: 0,
# limit: 1000 }

# paginate explicitly
llens.media.ls(offset=0, limit=100)

# this one will fetch all
llens.media.ls(no_pagination=True)

# any metadata can be used to filter the media (server side filtering)
llens.media.ls(no_pagination=True, source="prod")

# only single media upload and without metadata
llens.media.upload("~/Documents/image.jpg")

# folder upload, will upload all the media in the folder recursively
llens.media.upload("~/Documents/image_folder")

LandingLens CLI Usage

llens metadata upload --media_id=123,124 --timestamp=12345

# project_id: 1190
# metadata:   {"timestamp": "12345"}
# media_ids:  [123, 124]

llens media ls
# (lists media with metadata from a project)
# { medias: [{'id': 4358352, 'mediaType': 'image', 'srcType': 'user', 'srcName': 'Michal', 'properties': {'width': 258, 'height': 176}, 'name': 'n01443537_501.JPEG', 'uploadTime': '2020-09-15T22:29:01.338Z', 'metadata': {'source': 'prod'}, 'media_status': 'raw'}, ...],
# num_requested: 1000,
# count: 300,
# offset: 0,
# limit: 1000 }

# paginate explicitly
llens media ls --offset 0 --limit 100

# this one will fetch all
llens media ls --no-pagination

# any metadata can be used to filter the media (server side filtering)
llens media ls --no-pagination --source prod

# only single media upload and without metadata
llens media upload ~/Documents/image.jpg

# folder upload, will upload all the media in the folder recursively
llens media upload ~/Documents/image_folder





Was this article helpful?

What's Next