How to use the mediafile.DateItemField function in mediafile

To help you get started, we’ve selected a few mediafile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beetbox / mediafile / mediafile.py View on Github external
def day_field(self):
        return DateItemField(self, 2)
github beetbox / mediafile / mediafile.py View on Github external
def year_field(self):
        return DateItemField(self, 0)
github beetbox / mediafile / mediafile.py View on Github external
def month_field(self):
        return DateItemField(self, 1)
github beetbox / mediafile / mediafile.py View on Github external
def _field_sort_name(cls, name):
        """Get a sort key for a field name that determines the order
        fields should be written in.

        Fields names are kept unchanged, unless they are instances of
        :class:`DateItemField`, in which case `year`, `month`, and `day`
        are replaced by `date0`, `date1`, and `date2`, respectively, to
        make them appear in that order.
        """
        if isinstance(cls.__dict__[name], DateItemField):
            name = re.sub('year',  'date0', name)
            name = re.sub('month', 'date1', name)
            name = re.sub('day',   'date2', name)
        return name