Skip to content

Commit

Permalink
usage of DJ as artist is configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
tardypad committed Oct 4, 2017
1 parent f9f1d4a commit 0b32eeb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.rst
Expand Up @@ -65,6 +65,11 @@ to ``fast``. And afterwards if the preferred encoding is not available for that
quality, it will fallback to using ``mp3``.
It seems that all channels support the combination ``fast`` + ``mp3``

You can also choose to use the channel DJ as the reported track artist (default behavior)::

[somafm]
dj_as_artist = true


Project resources
=================
Expand Down
1 change: 1 addition & 0 deletions mopidy_somafm/__init__.py
Expand Up @@ -22,6 +22,7 @@ def get_config_schema(self):
schema['encoding'] = config.String(choices=('aac', 'mp3', 'aacp'))
schema['quality'] = config.String(
choices=('highest', 'fast', 'slow', 'firewall'))
schema['dj_as_artist'] = config.Boolean()
return schema

def validate_environment(self):
Expand Down
6 changes: 5 additions & 1 deletion mopidy_somafm/actor.py
Expand Up @@ -26,6 +26,7 @@ def __init__(self, config, audio):
self.uri_schemes = ['somafm']
self.quality = config['somafm']['quality']
self.encoding = config['somafm']['encoding']
self.dj_as_artist = config['somafm']['dj_as_artist']

def on_start(self):
self.somafm.refresh(self.encoding, self.quality)
Expand All @@ -46,7 +47,10 @@ def lookup(self, uri):
channel_data = self.backend.somafm.channels[channel_name]

# Artists
artist = Artist(name=channel_data['dj'])
if self.backend.dj_as_artist:
artist = Artist(name=channel_data['dj'])
else:
artist = Artist()

# Build album (idem as playlist, but with more metada)
album = Album(
Expand Down
1 change: 1 addition & 0 deletions mopidy_somafm/ext.conf
Expand Up @@ -2,3 +2,4 @@
enabled = true
encoding = mp3
quality = fast
dj_as_artist = true

0 comments on commit 0b32eeb

Please sign in to comment.