/* * Copyright (c) 2021, Cesar Torres * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include // Extended M3U fields (de facto standard) struct M3UExtendedInfo { Optional track_length_in_seconds; Optional track_display_title; Optional group_name; Optional album_title; Optional album_artist; Optional album_genre; Optional file_size_in_bytes; Optional embedded_mp3; Optional cover_path; }; struct M3UEntry { String path; Optional extended_info; }; class M3UParser { public: static NonnullOwnPtr from_file(String path); static NonnullOwnPtr from_memory(const String& m3u_contents, bool utf8); NonnullOwnPtr> parse(bool include_extended_info); Optional& get_playlist_title_metadata() { return m_parsed_playlist_title; } M3UParser(); private: String m_m3u_raw_data; String m_playlist_path; bool m_use_utf8; Optional m_parsed_playlist_title; };