Version
Abstract
- The more videos there are, the larger the media_sync table becomes.
- The reason for the bloat is that each metadata json is hundreds of KB.
- It need a way to solve this.
Detail
- I am syncing a source with about 1500 videos.
- Each sync_media record has a data size of approximately 500KB.
- The reason is because of the bloat of metadata, and a way to reduce this is needed.
- The sqlite file reached 700MB, and CPU usage and memory usage were observed to be high due to the overhead caused by - reading/dumping the huge metadata json.
AS-IS

TO-BE
- There are many unverified and unworked Mock parts to create P/R.
- I am attaching a sample of my work locally.

Sample Source
class Source(models.Model):
...
LIGHTWEIGHT_METADATA_TYPE_RAW = 'RAW'
LIGHTWEIGHT_METADATA_TYPE_FEATHER = 'FEATHER'
LIGHTWEIGHT_METADATA_TYPES = (LIGHTWEIGHT_METADATA_TYPE_RAW, LIGHTWEIGHT_METADATA_TYPE_FEATHER)
LIGHTWEIGHT_METADATA_TYPE_CHOICES = (
(LIGHTWEIGHT_METADATA_TYPE_RAW, _("(LARGE) Save raw metadata")),
(LIGHTWEIGHT_METADATA_TYPE_FEATHER, _("(TINY) if the capacity is large, Treeshake it event if it is in use")),
)
lightweight_metadata = models.CharField(
_('lightweight metadata'),
max_length=20,
default=LIGHTWEIGHT_METADATA_TYPE_RAW,
choices=LIGHTWEIGHT_METADATA_TYPE_CHOICES,
help_text=_('Lightweight metadata')
)
if source.lightweight_metadata == Source.LIGHTWEIGHT_METADATA_TYPE_FEATHER:
del media.metadata["formats"]
del media.metadata["thumbnails"]
del media.metadata["automatic_captions"]
del media.metadata["requested_formats"]
del media.metadata["heatmap"]
Sample View
Version
Abstract
Detail
AS-IS
TO-BE
Sample Source
Sample View
Add/Edit source

Media item view (one of the media details)
