Added FLAC Tagging
This commit is contained in:
parent
7c213fe037
commit
cb8939a3e3
10
README.md
10
README.md
@ -64,17 +64,17 @@ metaflac
|
|||||||
--preserve-modtime
|
--preserve-modtime
|
||||||
--no-utf8-convert
|
--no-utf8-convert
|
||||||
|
|
||||||
// First Step - Remove Tags
|
// First Step - Remove Pictures
|
||||||
|
--remove --block-type=PICTURE
|
||||||
|
|
||||||
|
// Second Step - Remove Tags
|
||||||
--remove-tag=TITLE
|
--remove-tag=TITLE
|
||||||
--remove-tag=ARTIST
|
--remove-tag=ARTIST
|
||||||
--remove-tag=ALBUM
|
--remove-tag=ALBUM
|
||||||
--remove-tag=TRACKNUMBER
|
--remove-tag=TRACKNUMBER
|
||||||
|
|
||||||
// Second Step - Remove Pictures
|
|
||||||
--remove --block-type=PICTURE
|
|
||||||
|
|
||||||
// Third Step - Add
|
// Third Step - Add
|
||||||
--import-picture-from=3|image/jpeg|||"/path/to/cover"
|
"--import-picture-from=3|image/jpeg|||/path/to/cover"
|
||||||
"--set-tag=TITLE=..."
|
"--set-tag=TITLE=..."
|
||||||
"--set-tag=ARTIST=..."
|
"--set-tag=ARTIST=..."
|
||||||
"--set-tag=ALBUM=..."
|
"--set-tag=ALBUM=..."
|
||||||
|
|||||||
6
TODO.md
6
TODO.md
@ -1,5 +1 @@
|
|||||||
* Rate limit
|
* Add API Rate Limit
|
||||||
* Use external tools
|
|
||||||
* Download and resize cover before tracks
|
|
||||||
* Tag tracks
|
|
||||||
* Update README with eyeD3
|
|
||||||
|
|||||||
97
main.cpp
97
main.cpp
@ -65,6 +65,61 @@ string gen_mp3_set_tags(const string& filepath, const string& artist,
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string gen_flac_clear_images(const string& filepath, const string& metaflac_exec)
|
||||||
|
{
|
||||||
|
string cmd;
|
||||||
|
|
||||||
|
cmd = metaflac_exec;
|
||||||
|
cmd += " --preserve-modtime --no-utf8-convert";
|
||||||
|
cmd += " --remove --block-type=PICTURE \"";
|
||||||
|
cmd += filepath;
|
||||||
|
cmd += "\"";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
string gen_flac_clear_tags(const string& filepath, const string& metaflac_exec)
|
||||||
|
{
|
||||||
|
string cmd;
|
||||||
|
|
||||||
|
cmd = metaflac_exec;
|
||||||
|
cmd += " --preserve-modtime --no-utf8-convert";
|
||||||
|
cmd += " --remove-tag=TITLE";
|
||||||
|
cmd += " --remove-tag=ARTIST";
|
||||||
|
// cmd += " --remove-tag=ALBUM";
|
||||||
|
cmd += " --remove-tag=TRACKNUMBER";
|
||||||
|
cmd += " \"";
|
||||||
|
cmd += filepath;
|
||||||
|
cmd += "\"";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
string gen_flac_set_tags(const string& filepath, const string& artist,
|
||||||
|
const string& title, const string& album, int track_num,
|
||||||
|
const string& cover_filepath, string metaflac_exec)
|
||||||
|
{
|
||||||
|
string cmd;
|
||||||
|
|
||||||
|
cmd = metaflac_exec;
|
||||||
|
cmd += " --preserve-modtime --no-utf8-convert";
|
||||||
|
cmd += " \"--import-picture-from=3|image/jpeg|||";
|
||||||
|
cmd += cover_filepath;
|
||||||
|
cmd += "\" \"--set-tag=TITLE=";
|
||||||
|
cmd += title;
|
||||||
|
cmd += "\" \"--set-tag=ARTIST=";
|
||||||
|
cmd += artist;
|
||||||
|
// cmd += "\" \"--set-tag=ALBUM=";
|
||||||
|
// cmd += album;
|
||||||
|
cmd += "\" \"--set-tag=TRACKNUMBER=";
|
||||||
|
cmd += to_string(track_num);
|
||||||
|
cmd += "\" --dont-use-padding \"";
|
||||||
|
cmd += filepath;
|
||||||
|
cmd += "\"";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Config stuff
|
// Config stuff
|
||||||
@ -101,6 +156,10 @@ int main(int argc, char **argv)
|
|||||||
json_extract(config, "Pass", pass);
|
json_extract(config, "Pass", pass);
|
||||||
json_extract(config, "download_path", main_path);
|
json_extract(config, "download_path", main_path);
|
||||||
|
|
||||||
|
json_extract(config, "convert_exec", convert_exec);
|
||||||
|
json_extract(config, "eyed3_exec", eyed3_exec);
|
||||||
|
json_extract(config, "metaflac_exec", metaflac_exec);
|
||||||
|
|
||||||
ok = mcat.login(email, pass);
|
ok = mcat.login(email, pass);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
@ -178,7 +237,7 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean MP3 Images
|
// Clear MP3 Images
|
||||||
ok = exec_cmd(gen_mp3_clear(filepath, eyed3_exec));
|
ok = exec_cmd(gen_mp3_clear(filepath, eyed3_exec));
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
@ -187,7 +246,7 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tag MP3
|
// Set MP3 Tags
|
||||||
ok = exec_cmd(
|
ok = exec_cmd(
|
||||||
gen_mp3_set_tags(filepath,
|
gen_mp3_set_tags(filepath,
|
||||||
track.artist,
|
track.artist,
|
||||||
@ -214,7 +273,39 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Tag FLAC
|
// Clear FLAC Images
|
||||||
|
ok = exec_cmd(gen_flac_clear_images(filepath, metaflac_exec));
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
cout << "Could not clear images for FLAC track " << track.number <<
|
||||||
|
" from release " << release.catalog_id << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear FLAC Tags
|
||||||
|
ok = exec_cmd(gen_flac_clear_tags(filepath, metaflac_exec));
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
cout << "Could not clear tags for FLAC track " << track.number <<
|
||||||
|
" from release " << release.catalog_id << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set FLAC Tags
|
||||||
|
ok = exec_cmd(
|
||||||
|
gen_flac_set_tags(filepath,
|
||||||
|
track.artist,
|
||||||
|
track.title,
|
||||||
|
release.title,
|
||||||
|
track.number,
|
||||||
|
build_fname(release_folder, "", "Cover_small.jpg"),
|
||||||
|
metaflac_exec));
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
cout << "Could not tag FLAC track " << track.number <<
|
||||||
|
" from release " << release.catalog_id << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Download Extended Mix
|
// Download Extended Mix
|
||||||
if (!track.extended_mix_file_id.empty())
|
if (!track.extended_mix_file_id.empty())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user