Added MP3 tagging
This commit is contained in:
parent
42ab8dbcb1
commit
7c213fe037
17
README.md
17
README.md
@ -38,7 +38,22 @@ https://github.com/nlohmann/json
|
|||||||
# eyeD3
|
# eyeD3
|
||||||
https://eyed3.readthedocs.io/en/latest/
|
https://eyed3.readthedocs.io/en/latest/
|
||||||
* For MP3 tagging
|
* For MP3 tagging
|
||||||
* TODO: Add info here
|
```
|
||||||
|
// Common
|
||||||
|
--encoding utf8
|
||||||
|
--preserve-file-times
|
||||||
|
|
||||||
|
// First Step - Remove Images
|
||||||
|
--remove-all-images
|
||||||
|
|
||||||
|
// Second Step - Change what is needed
|
||||||
|
--add-image "...":FRONT_COVER
|
||||||
|
--artist "..."
|
||||||
|
--album "..."
|
||||||
|
--title "..."
|
||||||
|
--track ...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
# metaflac
|
# metaflac
|
||||||
https://xiph.org/flac/download.html
|
https://xiph.org/flac/download.html
|
||||||
|
|||||||
62
main.cpp
62
main.cpp
@ -29,6 +29,42 @@ string gen_resize_command(const string& release_folder, const string& convert_ex
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string gen_mp3_clear(const string& filepath, const string& eyed3_exec)
|
||||||
|
{
|
||||||
|
string cmd;
|
||||||
|
|
||||||
|
cmd = eyed3_exec;
|
||||||
|
cmd += " --preserve-file-times --remove-all-images \"";
|
||||||
|
cmd += filepath;
|
||||||
|
cmd += "\" > /dev/null 2>&1";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
string gen_mp3_set_tags(const string& filepath, const string& artist,
|
||||||
|
const string& title, const string& album, int track_num,
|
||||||
|
const string& cover_filepath, string eyed3_exec)
|
||||||
|
{
|
||||||
|
string cmd;
|
||||||
|
|
||||||
|
cmd = eyed3_exec;
|
||||||
|
cmd += " --encoding utf8 --preserve-file-times --add-image \"";
|
||||||
|
cmd += cover_filepath;
|
||||||
|
cmd += "\":FRONT_COVER --artist \"";
|
||||||
|
cmd += artist;
|
||||||
|
// cmd += "\" --album \"";
|
||||||
|
// cmd += album;
|
||||||
|
cmd += "\" --title \"";
|
||||||
|
cmd += title;
|
||||||
|
cmd += "\" --track ";
|
||||||
|
cmd += to_string(track_num);
|
||||||
|
cmd += " \"";
|
||||||
|
cmd += filepath;
|
||||||
|
cmd += "\" > /dev/null 2>&1";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Config stuff
|
// Config stuff
|
||||||
@ -125,7 +161,6 @@ int main(int argc, char **argv)
|
|||||||
cout << "Could not resize cover for release - " << release.catalog_id << endl;
|
cout << "Could not resize cover for release - " << release.catalog_id << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
// Download tracks (1 -- N)
|
// Download tracks (1 -- N)
|
||||||
for (Track& track : release.tracks)
|
for (Track& track : release.tracks)
|
||||||
@ -143,7 +178,30 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Tag MP3
|
// Clean MP3 Images
|
||||||
|
ok = exec_cmd(gen_mp3_clear(filepath, eyed3_exec));
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
cout << "Could not clear images for MP3 track " << track.number <<
|
||||||
|
" from release " << release.catalog_id << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tag MP3
|
||||||
|
ok = exec_cmd(
|
||||||
|
gen_mp3_set_tags(filepath,
|
||||||
|
track.artist,
|
||||||
|
track.title,
|
||||||
|
release.title,
|
||||||
|
track.number,
|
||||||
|
build_fname(release_folder, "", "Cover_small.jpg"),
|
||||||
|
eyed3_exec));
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
cout << "Could not tag MP3 track " << track.number <<
|
||||||
|
" from release " << release.catalog_id << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Download FLAC
|
// Download FLAC
|
||||||
filepath = build_fname(flac_folder, "", filename);
|
filepath = build_fname(flac_folder, "", filename);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user