Summary
We now have a multivalued artist tag as shown below that needs to be written.
["小倉朝陽", 遥うみ", 八日堂朔莉", 坂リリ", 大蔵瑠美音", 遥そら", 桜小路亜十礼", "川崎美鳥"]
Under the current model, this is the only way we can write it.
let artists = vec!["小倉朝陽", "遥うみ", "八日堂朔莉", "坂リリ", "大蔵瑠美音", "遥そら", "桜小路亜十礼", "川崎美鳥"];
for artist in artists {
source_tag.push("TrackArtist".to_string(), artist.to_string());
}
If we want to know if the original tag and the written tag are duplicates, we need to read them first and then make the judgment.
let artists = vec!["小倉朝陽", "遥うみ", "八日堂朔莉", "坂リリ", "大蔵瑠美音", "遥そら", "桜小路亜十礼", "川崎美鳥"];
let original_artists = source_tag.get_all("TrackArtist");
for original_artist in original_artists {
if artists.contains(&original_artist) {
...
}
}
If we change the input value into vec, we could parse the value like this. And the set mode is to overwrite, you will not care about whether the value is in original tag.
let artists = vec!["小倉朝陽", "遥うみ", "八日堂朔莉", "坂リリ", "大蔵瑠美音", "遥そら", "桜小路亜十礼", "川崎美鳥"];
source_tag.set_trackartist(&artists);
or
source_tag.set("TrackArtist".to_string(), &artists);
Moreover, there's the need to distinguish between single and multiple values, because even a single value can be passed into the vec, as is shown below.
let artists = vec!["小倉朝陽"];
source_tag.set_trackartist(&artists);
This change also allows for a unified external interface.
API design
pub fn set(&mut self, item_key: ItemKey, values: Vec<ItemValue>) {
....
}
Use this new api to instead the old api.
remove
pub fn insert()
pub fn insert_unchecked()
pub fn push()
pub fn push_unchecked()
Maybe it will remove more methods.
Summary
We now have a multivalued artist tag as shown below that needs to be written.
["小倉朝陽", 遥うみ", 八日堂朔莉", 坂リリ", 大蔵瑠美音", 遥そら", 桜小路亜十礼", "川崎美鳥"]
Under the current model, this is the only way we can write it.
If we want to know if the original tag and the written tag are duplicates, we need to read them first and then make the judgment.
If we change the input value into
vec, we could parse the value like this. And thesetmode is to overwrite, you will not care about whether the value is in original tag.or
Moreover, there's the need to distinguish between single and multiple values, because even a single value can be passed into the vec, as is shown below.
This change also allows for a unified external interface.
API design
Use this new api to instead the old api.
remove
Maybe it will remove more methods.