Song Metadata Issue

Hi,

I’ve done some more poking around. It does look like there’s a portion of code in telnetliquidsoap.py which looks like it should override the media metadata with that from the Libretime Library. I am trying to understand what this code does, my python knowledge isn’t great but I’ll try :slight_smile:

def create_liquidsoap_annotation(media):
    # We need liq_start_next value in the annotate. That is the value that controls overlap duration of crossfade.

    filename = media['dst']
    annotation = ('annotate:media_id="%s",liq_start_next="0",liq_fade_in="%s",' + \
            'liq_fade_out="%s",liq_cue_in="%s",liq_cue_out="%s",' + \
            'schedule_table_id="%s",replay_gain="%s dB"') % \
            (media['id'],
                    float(media['fade_in']) / 1000,
                    float(media['fade_out']) / 1000,
                    float(media['cue_in']),
                    float(media['cue_out']),
                    media['row_id'],
                    media['replay_gain'])

    # Override the the artist/title that Liquidsoap extracts from a file's metadata
    # with the metadata we get from Airtime. (You can modify metadata in Airtime's library,
    # which doesn't get saved back to the file.)
    if 'metadata' in media:

        if 'artist_name' in media['metadata']:
            artist_name = media['metadata']['artist_name']
            if isinstance(artist_name, str):
                annotation += ',artist="%s"' % (artist_name.replace('"', '\\"'))
        if 'track_title' in media['metadata']:
            track_title =  media['metadata']['track_title']
            if isinstance(track_title, str):
                annotation += ',title="%s"' % (track_title.replace('"', '\\"'))

    annotation += ":" + filename

    return annotation