Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Migrated to ruff
7ff9d471b23c45b6d957e7507035af39885546ab
52 changes: 37 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,46 @@ name: Build
on:
push:
branches:
- master
- master
pull_request:
branches:
- master

jobs:
test:
name: '${{ matrix.os }}: ${{ matrix.tox-env }}'
name: "${{ matrix.os }}: ${{ matrix.tox-env }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
tox-env: [py37-test, py38-test, py39-test,
py310-test, pypy-test]
os: [ubuntu-22.04, windows-latest]
tox-env:
[
py39-test,
py310-test,
py311-test,
py312-test,
py313-test,
pypy-test,
]
os: [ubuntu-24.04, windows-latest]

# Only test on a couple of versions on Windows.
exclude:
- os: windows-latest
tox-env: py37-test
- os: windows-latest
tox-env: pypy-test

# Python interpreter versions. :/
include:
- tox-env: py37-test
python: '3.7'
- tox-env: py38-test
python: '3.8'
- tox-env: py39-test
python: '3.9'
python: "3.9"
- tox-env: py310-test
python: '3.10'
python: "3.10"
- tox-env: py311-test
python: "3.11"
- tox-env: py312-test
python: "3.12"
- tox-env: py313-test
python: "3.13"
- tox-env: pypy-test
python: pypy3.9

Expand All @@ -54,5 +61,20 @@ jobs:
name: Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: TrueBrain/actions-flake8@master
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Check style with Ruff
id: ruff
run: |
ruff check --output-format=github .
- name: Check format with Ruff
id: ruff-format
run: |
ruff format --check .
33 changes: 33 additions & 0 deletions .github/workflows/changelog_reminder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Verify changelog updated

on:
pull_request_target:
types:
- opened
- ready_for_review

jobs:
check_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get all updated Python files
id: changed-python-files
uses: tj-actions/changed-files@v46
with:
files: |
**.py

- name: Check for the changelog update
id: changelog-update
uses: tj-actions/changed-files@v46
with:
files: docs/changelog.rst

- name: Comment under the PR with a reminder
if: steps.changed-python-files.outputs.any_changed == 'true' && steps.changelog-update.outputs.any_changed == 'false'
uses: thollander/actions-comment-pull-request@v2
with:
message: "Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry."
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing to mediafile


First off, thanks for taking the time to contribute! ❤️

Please follow these guidelines to ensure a smooth contribution process.

## Pre-requisites

- Python 3.9 or higher
- Git

## Setup the Development Environment

1. Fork/Clone the repository on GitHub
```bash
git clone <your-fork-url>
cd mediafile
```
2. Install dependencies and set up the development environment
```bash
pip install -e .[dev]
```

## Before submitting a Pull Request

Verify that your code adheres to the project standards and conventions. Run
ruff and pytest to ensure your code is properly formatted and all tests pass.

```bash
ruff check .
ruff format .
pytest .
```
115 changes: 115 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Changelog
---------

Upcoming
'''''''
- Dropped support for Python 3.7 and 3.8


v0.13.0
'''''''

- Add a mapping compatible with Plex and ffmpeg for the "original date"
fields.
- Remove an unnecessary dependency on `six`.
- Replace `imghdr` with `filetype` to support Python 3.13.

v0.12.0
'''''''

- Add the multiple-valued properties ``artists_credit``, ``artists_sort``,
``albumartists_credit``, and ``albumartists_sort``.

v0.11.0
'''''''

- List-valued properties now return ``None`` instead of an empty list when the
underlying tags are missing altogether.

v0.10.1
'''''''

- Fix a test failure that arose with Mutagen 1.46.
- Require Python 3.7 or later.

v0.10.0
'''''''

- Add the multiple-valued properties ``albumtypes``, ``catalognums`` and
``languages``.
- The ``catalognum`` property now refers to additional file tags named
``CATALOGID`` and ``DISCOGS_CATALOG`` (but only for reading, not writing).
- The multi-valued ``albumartists`` property now refers to additional file
tags named ``ALBUM_ARTIST`` and ``ALBUM ARTISTS``. (The latter
is used only for reading.)
- The ``ListMediaField`` class now doesn't concatenate multiple lists if
found. The first available tag is used instead, like with other kinds of
fields.

v0.9.0
''''''

- Add the properties ``bitrate_mode``, ``encoder_info`` and
``encoder_settings``.

v0.8.1
''''''

- Fix a regression in v0.8.0 that caused a crash on Python versions below 3.8.

v0.8.0
''''''

- MediaFile now requires Python 3.6 or later.
- Added support for Wave (`.wav`) files.

v0.7.0
''''''

- Mutagen 1.45.0 or later is now required.
- MediaFile can now use file-like objects (instead of just the filesystem, via
filenames).

v0.6.0
''''''

- Enforce a minimum value for SoundCheck gain values.

v0.5.0
''''''

- Refactored the distribution to use `Flit`_.

.. _Flit: https://flit.readthedocs.io/

v0.4.0
''''''

- Added a ``barcode`` field.
- Added new tag mappings for ``albumtype`` and ``albumstatus``.

v0.3.0
''''''

- Fixed tests for compatibility with Mutagen 1.43.
- Fix the MPEG-4 tag mapping for the ``label`` field to use the right
capitalization.

v0.2.0
''''''

- R128 gain tags are now stored in Q7.8 integer format, as per
`the relevant standard`_.
- Added an ``mb_workid`` field.
- The Python source distribution now includes an ``__init__.py`` file that
makes it easier to run the tests.

.. _the relevant standard: https://tools.ietf.org/html/rfc7845.html#page-25

v0.1.0
''''''

This is the first independent release of MediaFile.
It is now synchronised with the embedded version released with `beets`_ v1.4.8.

.. _beets: https://beets.io
114 changes: 3 additions & 111 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ an exception.

.. toctree::
:maxdepth: 2
:hidden:

changelog

Supported Metadata Fields
-------------------------
Expand Down Expand Up @@ -131,114 +134,3 @@ To copy tags from one MediaFile to another:

g.save()


Changelog
---------

v0.13.0
'''''''

- Add a mapping compatible with Plex and ffmpeg for the "original date"
fields.
- Remove an unnecessary dependency on `six`.
- Replace `imghdr` with `filetype` to support Python 3.13.

v0.12.0
'''''''

- Add the multiple-valued properties ``artists_credit``, ``artists_sort``,
``albumartists_credit``, and ``albumartists_sort``.

v0.11.0
'''''''

- List-valued properties now return ``None`` instead of an empty list when the
underlying tags are missing altogether.

v0.10.1
'''''''

- Fix a test failure that arose with Mutagen 1.46.
- Require Python 3.7 or later.

v0.10.0
'''''''

- Add the multiple-valued properties ``albumtypes``, ``catalognums`` and
``languages``.
- The ``catalognum`` property now refers to additional file tags named
``CATALOGID`` and ``DISCOGS_CATALOG`` (but only for reading, not writing).
- The multi-valued ``albumartists`` property now refers to additional file
tags named ``ALBUM_ARTIST`` and ``ALBUM ARTISTS``. (The latter
is used only for reading.)
- The ``ListMediaField`` class now doesn't concatenate multiple lists if
found. The first available tag is used instead, like with other kinds of
fields.

v0.9.0
''''''

- Add the properties ``bitrate_mode``, ``encoder_info`` and
``encoder_settings``.

v0.8.1
''''''

- Fix a regression in v0.8.0 that caused a crash on Python versions below 3.8.

v0.8.0
''''''

- MediaFile now requires Python 3.6 or later.
- Added support for Wave (`.wav`) files.

v0.7.0
''''''

- Mutagen 1.45.0 or later is now required.
- MediaFile can now use file-like objects (instead of just the filesystem, via
filenames).

v0.6.0
''''''

- Enforce a minimum value for SoundCheck gain values.

v0.5.0
''''''

- Refactored the distribution to use `Flit`_.

.. _Flit: https://flit.readthedocs.io/

v0.4.0
''''''

- Added a ``barcode`` field.
- Added new tag mappings for ``albumtype`` and ``albumstatus``.

v0.3.0
''''''

- Fixed tests for compatibility with Mutagen 1.43.
- Fix the MPEG-4 tag mapping for the ``label`` field to use the right
capitalization.

v0.2.0
''''''

- R128 gain tags are now stored in Q7.8 integer format, as per
`the relevant standard`_.
- Added an ``mb_workid`` field.
- The Python source distribution now includes an ``__init__.py`` file that
makes it easier to run the tests.

.. _the relevant standard: https://tools.ietf.org/html/rfc7845.html#page-25

v0.1.0
''''''

This is the first independent release of MediaFile.
It is now synchronised with the embedded version released with `beets`_ v1.4.8.

.. _beets: https://beets.io
Loading