fix: allow multiple values for tag "musicbrainz-artistid" & "musicbrainz-albumartistid"
issue #2
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
mod config;
|
mod config;
|
||||||
|
mod tag;
|
||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
use crate::config::{Config, Transcode};
|
use crate::config::{Config, Transcode};
|
||||||
@@ -171,6 +172,9 @@ async fn main() -> Result<()> {
|
|||||||
async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
||||||
let (config, conv_args) = task::spawn_blocking(|| -> Result<_> {
|
let (config, conv_args) = task::spawn_blocking(|| -> Result<_> {
|
||||||
gstreamer::init()?;
|
gstreamer::init()?;
|
||||||
|
gstreamer::tags::register::<tag::MbArtistId>();
|
||||||
|
gstreamer::tags::register::<tag::MbAlbumArtistId>();
|
||||||
|
|
||||||
let config = config::config().context("Could not get the config")?;
|
let config = config::config().context("Could not get the config")?;
|
||||||
|
|
||||||
let conv_args = get_conversion_args(&config)
|
let conv_args = get_conversion_args(&config)
|
||||||
|
|||||||
45
src/tag.rs
Normal file
45
src/tag.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
use glib::Value;
|
||||||
|
use gstreamer::{
|
||||||
|
tags::{merge_strings_with_comma, CustomTag},
|
||||||
|
Tag, TagFlag,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct MbArtistId;
|
||||||
|
|
||||||
|
impl<'a> Tag<'a> for MbArtistId {
|
||||||
|
type TagType = &'a str;
|
||||||
|
|
||||||
|
fn tag_name<'b>() -> &'b str {
|
||||||
|
"musicbrainz-artistid"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CustomTag<'_> for MbArtistId {
|
||||||
|
const FLAG: TagFlag = TagFlag::Meta;
|
||||||
|
const NICK: &'static str = "artist ID";
|
||||||
|
const DESCRIPTION: &'static str = "MusicBrainz artist ID";
|
||||||
|
|
||||||
|
fn merge_func(src: &Value) -> Value {
|
||||||
|
merge_strings_with_comma(src)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MbAlbumArtistId;
|
||||||
|
|
||||||
|
impl<'a> Tag<'a> for MbAlbumArtistId {
|
||||||
|
type TagType = &'a str;
|
||||||
|
|
||||||
|
fn tag_name<'b>() -> &'b str {
|
||||||
|
"musicbrainz-albumartistid"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CustomTag<'_> for MbAlbumArtistId {
|
||||||
|
const FLAG: TagFlag = TagFlag::Meta;
|
||||||
|
const NICK: &'static str = "album artist ID";
|
||||||
|
const DESCRIPTION: &'static str = "MusicBrainz album artist ID";
|
||||||
|
|
||||||
|
fn merge_func(src: &Value) -> Value {
|
||||||
|
merge_strings_with_comma(src)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user