/*
 * Tiny layer for interfacing with beefweb. Does basically the
 * bare minimum, and does not expose the whole API.
 *
 * Copyright (C) 2026 Paper
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see
 * <https://www.gnu.org/licenses/>.
*/

mod player;
mod beefweb;

use std::future;

#[tokio::main(flavor = "local")]
async fn main() -> Result<(), anyhow::Error>
{
	let server = mpris_server::LocalServer::new("org.foobar2000.foobar2000", player::BeefwebPlayer::new("http://127.0.0.1:8880/api", format!("{}/beefweb_mpris", dirs::cache_dir().unwrap().to_str().unwrap()).as_str())).await?;

	tokio::task::spawn_local(server.run());

	future::pending::<()>().await;

	return Ok(());
}
