Skip to content

Commit

Permalink
Add narrator field for albums
Browse files Browse the repository at this point in the history
  • Loading branch information
Serene-Arc committed Jul 2, 2023
1 parent b22805d commit ad14a6b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion beetsplug/audible.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import yaml
from beets import importer, util
from beets.autotag.hooks import AlbumInfo, TrackInfo
from beets.library import Item
from beets.dbcore.types import STRING
from beets.library import Album, Item
from beets.plugins import BeetsPlugin
from natsort import natsorted

Expand Down Expand Up @@ -152,8 +153,15 @@ def specialised_levenshtein(token1: str, token2: str, ignored_affixes: Optional[
return total_cost


def _get_album_narrator(album: Album):
return album.items()[0]["composer"]


class Audible(BeetsPlugin):
data_source = "Audible"
album_types = {
"narrator": STRING,
}

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -185,6 +193,8 @@ def __init__(self):
# stores paths of downloaded cover art to be used during import
self.cover_art = {}

self.album_template_fields["narrator"] = _get_album_narrator

self.register_listener("write", self.on_write)
self.register_listener("import_task_files", self.on_import_task_files)

Expand Down

0 comments on commit ad14a6b

Please sign in to comment.