diff --git a/.github/workflows/release-builder-beta.yml b/.github/workflows/release-builder-beta.yml index a12632d8..63dd5303 100644 --- a/.github/workflows/release-builder-beta.yml +++ b/.github/workflows/release-builder-beta.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: api-feature + ref: search-filter-fix - name: Set up Python uses: actions/setup-python@v4 @@ -46,7 +46,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: api-feature + ref: search-filter-fix - name: Run macOS Build Script run: scripts/build_mac.sh @@ -75,7 +75,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: api-feature + ref: search-filter-fix - name: Run macOS Build Script run: scripts/build_mac.sh @@ -104,7 +104,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: api-feature + ref: search-filter-fix - name: Install Dependencies run: | @@ -138,7 +138,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 with: - ref: api-feature + ref: search-filter-fix - name: Install Dependencies run: | diff --git a/src/onthespot/api/apple_music.py b/src/onthespot/api/apple_music.py index 2be7a9b3..a37c2777 100644 --- a/src/onthespot/api/apple_music.py +++ b/src/onthespot/api/apple_music.py @@ -204,6 +204,7 @@ def apple_music_get_track_metadata(session, item_id): info['image_url'] = image_url.replace("{w}", str(max_width)).replace("{h}", str(max_height)) info['writer'] = track_data.get('data', [])[0].get('attributes', {}).get('composerName') + info['composer'] = info['writer'] info['language'] = track_data.get('data', [])[0].get('attributes', {}).get('audioLocale') info['item_url'] = track_data.get('data', [])[0].get('attributes', {}).get('url') info['is_playable'] = True if track_data.get('data', [])[0].get('attributes', {}).get('playParams') else False diff --git a/src/onthespot/api/spotify.py b/src/onthespot/api/spotify.py index c936a5cb..f229074d 100644 --- a/src/onthespot/api/spotify.py +++ b/src/onthespot/api/spotify.py @@ -604,6 +604,7 @@ def spotify_get_track_metadata(token, item_id): info['performers'] = conv_list_format([item for item in credits.get('performers', []) if isinstance(item, str)]) info['producers'] = conv_list_format([item for item in credits.get('producers', []) if isinstance(item, str)]) info['writers'] = conv_list_format([item for item in credits.get('writers', []) if isinstance(item, str)]) + info['composer'] = info['writers'] if track_audio_data: key_mapping = { diff --git a/src/onthespot/otsconfig.py b/src/onthespot/otsconfig.py index bf63c089..fca8e80f 100755 --- a/src/onthespot/otsconfig.py +++ b/src/onthespot/otsconfig.py @@ -170,6 +170,7 @@ def __init__(self, cfg_path=None): "embed_performers": True, "embed_producers": True, "embed_writers": True, + "embed_composer": True, "embed_label": True, "embed_copyright": True, "embed_description": True, diff --git a/src/onthespot/utils.py b/src/onthespot/utils.py index ec470011..1570e729 100644 --- a/src/onthespot/utils.py +++ b/src/onthespot/utils.py @@ -2,6 +2,7 @@ import json import os import platform +import re import requests import ssl import subprocess @@ -148,6 +149,10 @@ def format_item_path(item, item_metadata): elif item['item_type'] == 'episode': path = config.get("show_path_formatter") + # Split composer + composer_full = item_metadata.get('composer', '') + composer_first = re.split(r' [,&;] | & |,|;', composer_full)[0].strip() if composer_full else '' + item_path = path.format( # Universal service=sanitize_data(item.get('item_service')).title(), @@ -156,8 +161,10 @@ def format_item_path(item, item_metadata): year=sanitize_data(item_metadata.get('release_year')), explicit=sanitize_data(str(config.get('explicit_label')) if item_metadata.get('explicit') else ''), + # Audio artist=sanitize_data(item_metadata.get('artists')), + composer=sanitize_data(composer_first), album=sanitize_data(album), album_artist=sanitize_data(item_metadata.get('album_artists')), album_type=item_metadata.get('album_type', 'single').title(), @@ -401,6 +408,12 @@ def embed_metadata(item, metadata): else: command += ['-metadata', 'author={}'.format(value)] + elif key == 'composer' and config.get("embed_composer"): + if filetype == '.mp3': + command += ['-metadata', 'TCOM={}'.format(value)] + else: + command += ['-metadata', 'composer={}'.format(value)] + elif key == 'label' and config.get("embed_label"): if filetype in ['.flac', '.ogg', '.opus']: command += ['-metadata', 'label={}'.format(value)] @@ -663,6 +676,7 @@ def add_to_m3u_file(item, item_metadata): service=item.get('item_service').title(), service_id=str(item.get('item_id')), artist=item_metadata.get('artists'), + composer=item_metadata.get('composer'), album=item_metadata.get('album_name'), album_artist=item_metadata.get('album_artists'), album_type=item_metadata.get('album_type', 'single').title(),