Skip to content
Snippets Groups Projects
test_metadata_duration.liq 1.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • #!/usr/bin/env liquidsoap
    #
    # Aura Engine (https://gitlab.servus.at/aura/engine)
    #
    # Copyright (C) 2017-now() - The Aura Engine Team.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    
    %include "base_config.liq"
    settings.frame.audio.samplerate.set(44100)
    
    %include "../src/functions.liq"
    
    # Read duration from file => 808
    metadata = [( "track_duration", "808" )]
    duration = get_meta_track_duration(metadata)
    print("Track duration in meta 'track_duration': #{duration}")
    assertEquals(duration, 808)
    
    # Read duration from file => 207
    input_fs = single(id="fs", "assets/audio.mp3")
    def process(metadata) =
        duration = get_meta_track_duration(metadata)
        print("Track duration on file: #{duration}")
        assertEquals(duration, 207)
        shutdown(code=0)
    end
    input_fs.on_metadata(process)
    output.dummy(id="dummy", input_fs)