apicrud.media.worker_processing

worker_processing.py

Media worker functions to process media

Uploaded videos and photos contain metadata fields that we can parse and store in the database (plus the redis cache). Various sizes of images need to be sent to the storage API for quick retrieval; these functions are the background engine for such longer-running tasks.

created 3-feb-2020 by richb@instantlinux.net

Classes

AccountSettings(account_id, config, models)

Account Settings - converts db record to object attributes.

MediaProcessing(uid, file_id, config, models)

Media Processing

StorageAPI([credential_ttl, redis_conn, …])

Storage API

datetime(year, month, day[, hour[, minute[, …)

The year, month and day arguments are required.

Exceptions

MediaUploadException

class apicrud.media.worker_processing.MediaProcessing(uid, file_id, config, models, db_session=None)

Media Processing

Parameters
  • uid (str) – User ID

  • file_id (str) – ID of record in File model

  • config (obj) – the config-file key-value object

  • models (obj) – the models file object

  • db_session (obj) – database session

photo(uid, meta, db_session)

metadata and scaling for still images

Parameters
  • uid (str) – User ID

  • meta (dict) – Image metadata

  • db_session (obj) – database session

video(uid, meta, db_session)

metadata for videos - construct and save a pictures db record

Parameters
  • uid (str) – User ID

  • meta (dict) – Video metadata

  • db_session (obj) – database session

exception apicrud.media.worker_processing.MediaUploadException