Resolve "Local collection trait and beets implementation" #9
@ -86,7 +86,7 @@ impl Beets {
|
||||
|
||||
trait LibraryPrivate {
|
||||
const CMD_LIST: &'static str;
|
||||
const SEPARATOR: &'static str;
|
||||
const LIST_FORMAT_SEPARATOR: &'static str;
|
||||
const LIST_FORMAT: &'static str;
|
||||
|
||||
fn list_cmd_and_args(query: &Query) -> Vec<String>;
|
||||
@ -101,7 +101,7 @@ impl Library for Beets {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! separator {
|
||||
macro_rules! list_format_separator {
|
||||
() => {
|
||||
"-*^-"
|
||||
};
|
||||
@ -109,19 +109,19 @@ macro_rules! separator {
|
||||
|
||||
impl LibraryPrivate for Beets {
|
||||
const CMD_LIST: &'static str = "ls";
|
||||
const SEPARATOR: &'static str = separator!();
|
||||
const LIST_FORMAT_SEPARATOR: &'static str = list_format_separator!();
|
||||
const LIST_FORMAT: &'static str = concat!(
|
||||
"--format=",
|
||||
"$albumartist",
|
||||
separator!(),
|
||||
list_format_separator!(),
|
||||
"$year",
|
||||
separator!(),
|
||||
list_format_separator!(),
|
||||
"$album",
|
||||
separator!(),
|
||||
list_format_separator!(),
|
||||
"$track",
|
||||
separator!(),
|
||||
list_format_separator!(),
|
||||
"$title",
|
||||
separator!(),
|
||||
list_format_separator!(),
|
||||
"$artist"
|
||||
);
|
||||
|
||||
@ -137,7 +137,7 @@ impl LibraryPrivate for Beets {
|
||||
let mut album_ids = HashSet::<AlbumId>::new();
|
||||
|
||||
for line in list_output.iter() {
|
||||
let split: Vec<&str> = line.split(Self::SEPARATOR).collect();
|
||||
let split: Vec<&str> = line.split(Self::LIST_FORMAT_SEPARATOR).collect();
|
||||
|
||||
if split.len() != 6 {
|
||||
return Err(Error::InvalidData(line.to_string()));
|
||||
@ -285,7 +285,7 @@ mod tests {
|
||||
strings.push(format!(
|
||||
"{album_artist}{0}{album_year}{0}{album_title}{0}\
|
||||
{track_number}{0}{track_title}{0}{track_artist}",
|
||||
Beets::SEPARATOR,
|
||||
Beets::LIST_FORMAT_SEPARATOR,
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user