diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/roster.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/roster.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/roster.py b/packages/meshbay-node/src/meshbay_node/roster.py index b4efb7c..24424ab 100644 --- a/packages/meshbay-node/src/meshbay_node/roster.py +++ b/packages/meshbay-node/src/meshbay_node/roster.py @@ -665,6 +665,39 @@ class Roster: await self.set_setting(group_id, self.SETTING_TMDB_ENABLED, "1" if enabled else "0", set_by) + # The Music app's MusicBrainz contact string (docs/musicbay.md §3.2) — + # node-wide, under the same group_id="" sentinel as the TMDB token/ + # language above, for the identical reason: one operator's User-Agent + # identity, not a per-group concern. Unlike TMDB there is no secret to + # store — this is the contact MusicBrainz's usage policy asks a client + # to identify itself with, not a credential. Unset means "no contact + # configured", which musicbrainz.py treats as "make no calls at all" + # (docs/musicbay.md §3.1) rather than sending an unidentified client. + SETTING_MUSICBRAINZ_CONTACT = "musicbrainz_contact" + + async def musicbrainz_contact(self) -> str | None: + return await self.get_setting( + self.NODE_WIDE_GROUP_ID, self.SETTING_MUSICBRAINZ_CONTACT) or None + + async def set_musicbrainz_contact(self, contact: str | None = None, set_by: str = "") -> None: + """`contact=""` clears it; `contact=None` leaves it unchanged (tmdb_config's shape).""" + if contact is not None: + await self.set_setting(self.NODE_WIDE_GROUP_ID, self.SETTING_MUSICBRAINZ_CONTACT, + contact, set_by) + + # Whether MusicBrainz lookups run for this group at all — per-group from + # the start (unlike tmdb_enabled, which started node-wide and moved + # per-group later once the lesson was already learned). Unset means on, + # same "absent means the old behaviour" discipline as everything else. + SETTING_MUSICBRAINZ_ENABLED = "musicbrainz_enabled" + + async def musicbrainz_enabled(self, group_id: str) -> bool: + return (await self.get_setting(group_id, self.SETTING_MUSICBRAINZ_ENABLED, "1")) != "0" + + async def set_musicbrainz_enabled(self, group_id: str, enabled: bool, set_by: str = "") -> None: + await self.set_setting(group_id, self.SETTING_MUSICBRAINZ_ENABLED, + "1" if enabled else "0", set_by) + # How often the indexer's reconciliation backstop runs, and how long it # waits after the last change on a file before hashing it. Unset means # the indexer's own defaults — an existing group's behaviour must not |