Submodule meta

Class for metadata maniplation

exception mscxyz.meta.UnmatchedFormatStringError(format_string: str, input_string: str)[source]

Bases: Exception

exception mscxyz.meta.FormatStringNoFieldError(format_string: str)[source]

Bases: Exception

class mscxyz.meta.Metatag(score: Score)[source]

Bases: object

The class provides access to the MuseScore metadata fields.

The class should not be renamed to MetaTag because it would conflict with the naming scheme of the fields metatag_title etc.

See:

MuseScore Handbook

The available metaTag fields are:

  • arranger

  • audioComUrl (new in v4)

  • composer

  • copyright

  • creationDate

  • lyricist

  • movementNumber

  • movementTitle

  • mscVersion

  • platform

  • poet (not in v4)

  • source

  • sourceRevisionId

  • subtitle

  • translator

  • workNumber

  • workTitle

version 4

<museScore version="4.20">
    <Score>
        <metaTag name="arranger"></metaTag>
        <metaTag name="audioComUrl"></metaTag>
        <metaTag name="composer">Composer / arranger</metaTag>
        <metaTag name="copyright"></metaTag>
        <metaTag name="creationDate">2024-01-05</metaTag>
        <metaTag name="lyricist"></metaTag>
        <metaTag name="movementNumber"></metaTag>
        <metaTag name="movementTitle"></metaTag>
        <metaTag name="platform">Linux</metaTag>
        <metaTag name="source"></metaTag>
        <metaTag name="sourceRevisionId"></metaTag>
        <metaTag name="subtitle">Subtitle</metaTag>
        <metaTag name="translator"></metaTag>
        <metaTag name="workNumber"></metaTag>
        <metaTag name="workTitle">Untitled score</metaTag>
fields
score: Score
xml_root: _Element
property arranger: str | None
<metaTag name="arranger">...</metaTag>
property audio_com_url: str | None
<metaTag name="audioComUrl">...</metaTag>
property composer: str | None

Same text as “Composer” on the first page of the score

<metaTag name="composer">...</metaTag>
property copyright: str | None

Same text as “Copyright” on the first page of the score.

<metaTag name="copyright">...</metaTag>
property creation_date: str | None

https://github.com/musescore/MuseScore/blob/06793ff5ff3065fe87fe9a8a651a6d20f49fd28c/src/engraving/dom/masterscore.cpp#L93

<metaTag name="creationDate">2024-01-05</metaTag>
property lyricist: str | None

Same text as “Lyricist” on the first page of the score.

<metaTag name="lyricist">...</metaTag>
property movement_number: str | None
<metaTag name="movementNumber">...</metaTag>
property movement_title: str | None
<metaTag name="movementTitle">...</metaTag>
property msc_version: str | None
<metaTag name="mscVersion">4.20</metaTag>
property platform: str | None

The computing platform the score was created on. This might be empty if the score was saved in test mode.

https://github.com/musescore/MuseScore/blob/06793ff5ff3065fe87fe9a8a651a6d20f49fd28c/src/engraving/dom/masterscore.cpp#L74-L81

<metaTag name="platform">Linux</metaTag>
<metaTag name="platform">Apple Macintosh</metaTag>
property poet: str | None
<metaTag name="poet">...</metaTag>
property source: str | None

May contain a URL if the score was downloaded from or Publish to MuseScore.com.

<metaTag name="source">http://musescore.com/isaacweiss/getting-started</metaTag>
<metaTag name="source">http://musescore.com/score/111410</metaTag>
property source_revision_id: str | None
<metaTag name="sourceRevisionId">...</metaTag>
property subtitle: str | None

The subtitle. It has the same text as “Subtitle” on the first page of the score.

<metaTag name="subtitle">Subtitle</metaTag>
property translator: str | None
<metaTag name="translator">...</metaTag>
property work_number: str | None
<metaTag name="workNumber">...</metaTag>
property work_title: str | None

The Work Title. It has the same text as “Title” on the first page of the score.

<metaTag name="workTitle">Untitled score</metaTag>
clean() None[source]
class mscxyz.meta.Vbox(score: Score)[source]

Bases: object

The first vertical box or frame of a score.

Available fields:

  • Composer

  • Lyricist

  • Subtitle

  • Title

Version 2, 3

<Staff id="1">
    <VBox>
        <height>10</height>
        <Text>
            <style>Title</style>
            <text>Title</text>
        </Text>
        <Text>
            <style>Composer</style>
            <text>Composer</text>
        </Text>
    </VBox>
</Staff>

Version 4

<Staff id="1">
    <VBox>
        <height>10</height>
        <boxAutoSize>0</boxAutoSize>
        <eid>4294967418</eid>
        <Text>
            <eid>8589934598</eid>
            <style>title</style>
            <text>Title</text>
        </Text>
        <Text>
            <eid>12884901894</eid>
            <style>composer</style>
            <text>Composer</text>
        </Text>
    </VBox>
</Staff>
fields
score: Score
xml_root: _Element
vbox: _Element
property title: str | None

The title text field of the first vertical box or frame of a score.

<Staff id="1">
    <VBox>
        <height>10</height>
        <boxAutoSize>0</boxAutoSize>
        <eid>4294967418</eid>
        <Text>
            <eid>8589934598</eid>
            <style>title</style>
            <text>Mondscheinsonate</text>
        </Text>
    </VBox>
</Staff>
property subtitle: str | None

The subtitle text field of the first vertical box or frame of a score.

<Staff id="1">
    <VBox>
        <height>10</height>
        <boxAutoSize>0</boxAutoSize>
        <eid>4294967418</eid>
        <Text>
            <eid>8589934598</eid>
            <style>subtitle</style>
            <text>1. Satz</text>
        </Text>
    </VBox>
</Staff>
property composer: str | None

The composer text field of the first vertical box or frame of a score.

<Staff id="1">
    <VBox>
        <height>10</height>
        <boxAutoSize>0</boxAutoSize>
        <eid>4294967418</eid>
        <Text>
            <eid>8589934598</eid>
            <style>composer</style>
            <text>Ludwig van Beethoven</text>
        </Text>
    </VBox>
</Staff>
property lyricist: str | None

The composer text field of the first vertical box or frame of a score.

<Staff id="1">
    <VBox>
        <height>10</height>
        <boxAutoSize>0</boxAutoSize>
        <eid>4294967418</eid>
        <Text>
            <eid>8589934598</eid>
            <style>lyricist</style>
            <text>Johann Wolfgang von Goethe</text>
        </Text>
    </VBox>
</Staff>
clean() None[source]
class mscxyz.meta.Meta(score: Score)[source]

Bases: object

score: Score
metatag: Metatag
vbox: Vbox
sync_fields() None[source]
write_to_log_file(log_file: str, format_string: str) None[source]
clean() None[source]

Clean all metadata fields of the object.

delete_duplicates() None[source]

Delete duplicates in the metadata.

This method checks if the lyricist and composer are the same, and if so, it sets lyricist to an empty string.

It also checks if title is empty but subtitle is not, and if so, it sets title to subtitle.

Finally, it checks if subtitle is the same as title, and if so, it sets subtitle to an empty string.

reload(save: bool = False) Meta[source]

Reload the MuseScore file.

Parameters:

save – Whether to save the changes before reloading. Default is False.

Returns:

The reloaded Meta object.

See:

mscxyz.Score.reload()

property title: str | None

Get and set the value of Vbox.title and Metatag.work_title all at once.

If the attributes have different values, then the attribute Vbox.title is preferred.

property subtitle: str | None

Get and set the value of Vbox.subtitle, Metatag.subtitle and Metatag.movement_title all at once.

If the attributes have different values, then the attribute Vbox.subtitle is preferred.

property composer: str | None

Get and set the value of Vbox.composer and Metatag.composer all at once.

If the attributes have different values, then the attribute Vbox.composer is preferred.

property lyricist: str | None

Get and set the value of Vbox.lyricist and Metatag.lyricist all at once.

If the attributes have different values, then the attribute Vbox.lyricist is preferred.