How to use the mediafile.MediaFile.readable_fields 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 / test / test_mediafile.py View on Github external
def test_fields_in_readable_fields(self):
        readable = MediaFile.readable_fields()
        for field in MediaFile.fields():
            self.assertIn(field, readable)
github beetbox / mediafile / test / test_mediafile.py View on Github external
def test_properties_from_readable_fields(self):
        path = os.path.join(_common.RSRC, b'full.mp3')
        mediafile = MediaFile(path)
        for field in MediaFile.readable_fields():
            self.assertTrue(hasattr(mediafile, field))
github beetbox / beets / beets / library.py View on Github external
'format':      types.STRING,
        'samplerate':  types.ScaledInt(1000, u'kHz'),
        'bitdepth':    types.INTEGER,
        'channels':    types.INTEGER,
        'mtime':       DateType(),
        'added':       DateType(),
    }

    _search_fields = ('artist', 'title', 'comments',
                      'album', 'albumartist', 'genre')

    _types = {
        'data_source': types.STRING,
    }

    _media_fields = set(MediaFile.readable_fields()) \
        .intersection(_fields.keys())
    """Set of item fields that are backed by `MediaFile` fields.

    Any kind of field (fixed, flexible, and computed) may be a media
    field. Only these fields are read from disk in `read` and written in
    `write`.
    """

    _media_tag_fields = set(MediaFile.fields()).intersection(_fields.keys())
    """Set of item fields that are backed by *writable* `MediaFile` tag
    fields.

    This excludes fields that represent audio data, such as `bitrate` or
    `length`.
    """