Provide a keyboard shortcut to sync all existing albums with MusicBrainz #167

Merged
wojtek merged 13 commits from 166---provide-a-keyboard-shortcut-to-sync-all-existing-albums-with-musicbrainz into main 2024-08-27 17:55:53 +02:00
2 changed files with 15 additions and 14 deletions
Showing only changes of commit 3c29fda119 - Show all commits

View File

@ -7,13 +7,13 @@ use musichoard::{
}; };
use crate::tui::{ use crate::tui::{
app::{ app::{
machine::{matches::AppMatchInfo, App, AppInner, AppMachine}, machine::{matches::AppMatchInfo, App, AppInner, AppMachine},
selection::{Delta, ListSelection}, selection::{Delta, ListSelection},
AppPublic, AppState, IAppInteractBrowse, AppPublic, AppState, IAppInteractBrowse,
}, },
lib::IMusicHoard, lib::IMusicHoard, MUSICHOARD_TUI_HTTP_USER_AGENT,
}; };
pub struct AppBrowse; pub struct AppBrowse;
@ -90,13 +90,8 @@ impl<MH: IMusicHoard> IAppInteractBrowse for AppMachine<MH, AppBrowse> {
} }
fn fetch_musicbrainz(self) -> Self::APP { fn fetch_musicbrainz(self) -> Self::APP {
const USER_AGENT: &str = concat!( let client = MusicBrainzApiClient::new(MUSICHOARD_TUI_HTTP_USER_AGENT)
"MusicHoard/", .expect("failed to create API client");
env!("CARGO_PKG_VERSION"),
" ( musichoard@thenineworlds.net )"
);
let client = MusicBrainzApiClient::new(USER_AGENT).expect("failed to create API client");
let mut api = MusicBrainzApi::new(client); let mut api = MusicBrainzApi::new(client);
let coll = self.inner.music_hoard.get_collection(); let coll = self.inner.music_hoard.get_collection();

View File

@ -26,6 +26,12 @@ use crate::tui::{
ui::IUi, ui::IUi,
}; };
const MUSICHOARD_TUI_HTTP_USER_AGENT: &str = concat!(
"MusicHoard/",
env!("CARGO_PKG_VERSION"),
" ( musichoard@thenineworlds.net )"
);
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub enum Error { pub enum Error {
Io(String), Io(String),