Skip to content

atypes not defined in python inline #5000

@Gremious

Description

@Gremious

Problem

beet fields lists albumtype, albumtypes, and atypes as available tags.

albumtype and albumtypes, are well and usable within the inline python script, however, atypes is not, and crashes with:

NameError: name 'atypes' is not defined

example:

album_fields:
   test: |
     import platform
     log = open("log.txt", "a")
     log.write("type:" + albumtype + '\n') // ok
     log.write("types:" + albumtypes + '\n') // ok
     log.write("atypes:" + atypes + '\n') // NameError: name 'atypes' is not defined

I have tried using it first e.g.

paths:
  default: ${atypes}${test}/...

just to see if it makes a difference, but no go.

${atypes} itself in path does work completely fine.

I don't know if this is intentional, but it would be nice to be able to use the renamed values, e.g. compilation: Anthology / dj-mix: DJ-Mix inline without doing a match.

Setup

  • OS: Debian
    beets version 1.6.0
    Python version 3.9.2
    plugins: albumtypes, bandcamp, chroma, copyartifacts, discogs, edit, fromfilename, inline, lastgenre, the
  • Turning off plugins made problem go away (yes/no): N/A

My configuration (output of beet config) is:

Click to expand
directory: ~/data/user/gremious/public/beets_music
library: ~/data/user/gremious/public/beets_music/library.db

plugins: albumtypes fromfilename inline discogs chroma copyartifacts lastgenre bandcamp edit the
languages: en
per_disc_numbering: yes
chroma:
    auto: yes
copyartifacts:
    print_ignored: yes
    extensions: .*
lastgenre:
    count: 99
    force: no
    whitelist: yes
    min_weight: 10
    fallback:
    canonical: no
    source: album
    auto: yes
    separator: ', '
    prefer_specific: no
    title_case: yes
albumtypes:
    types:
    -   album: Album
    -   ep: EP
    -   single: Single
    -   soundtrack: OST
    -   remix: Remix
    -   live: Live
    -   mixtape: Mixtape
    -   compilation: Compilation
    -   dj-mix: DJ-Mix
    -   demo: Demo
    -   other: Other
    ignore_va: ''
    bracket: '  '

album_fields:
    test: "import platform\nlog = open(\"log.txt\", \"a\")\nlog.write(\"type:\" + albumtype + '\\n')\nlog.write(\"types:\" + albumtypes + '\\n')\nlog.write(\"atypes:\" + atypes + '\\n')\n\nret = \"\"\ntypes = albumtypes.split(' ')\n\nif len(types) <= 1:\n  return albumtypes\n\n# if types[0] == \"Album\":\n    # types.pop(0)\n    # return types\n# else:\n    # return albumtypes\n"

paths:
    default: ${albumartist}/${atypes}$album/${track}. $title
    comp: ${test}/${track}. $title
    singleton: Misc Tracks/${artist} - ${title}
    albumtype:soundtrack: Soundtracks/${albumartist} - ${album}/${track}. $artist - $title
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
    separator: ', '
    index_tracks: no
edit:
    albumfields: album albumartist
    itemfields: track title artist album
    ignore_fields: id path
the:
    the: yes
    a: yes
    format: '{0}, {1}'
    strip: no
    patterns: []
bandcamp:
    include_digital_only_tracks: yes
    search_max: 2
    art: no
    exclude_extra_fields: []
    genre:
        capitalize: no
        maximum: 0
        mode: progressive
        always_include: []
    comments_separator: '

        ---

        '
pathfields: {}
item_fields: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    needinfoWe need more details or follow-up from the filer before this can be tagged "bug" or "feature."

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions