commit aacce6ad4d03b78dde461fd7506d7241a49074a8 Author: oitsjustjose Date: Sat Oct 12 07:10:50 2024 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d2389d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/bin +/include +/lib +/lib64 +/share +/pyvenv.cfg \ No newline at end of file diff --git a/metadata_copy.py b/metadata_copy.py new file mode 100644 index 0000000..5e1c19e --- /dev/null +++ b/metadata_copy.py @@ -0,0 +1,63 @@ +import eyed3 +import sys +from pathlib import Path +import shutil +from eyed3.id3 import ID3_V2_4 + + +def main(original_dir_path: str): + """No u""" + resolved_root = Path(original_dir_path).resolve() + + for filename in resolved_root.iterdir(): + orig_path = resolved_root.joinpath(filename) + without_drums_path = ( + Path("./separated/htdemucs") + .resolve() + .joinpath(orig_path.stem) + .joinpath("no_drums.mp3") + ) + just_drums_path = ( + Path("./separated/htdemucs") + .resolve() + .joinpath(orig_path.stem) + .joinpath("drums.mp3") + ) + + orig_afile = eyed3.load(str(orig_path)) + + # Copy over the metadata from the original song to the one without drums + without_drums_afile = eyed3.load(str(without_drums_path)) + without_drums_afile.tag = orig_afile.tag + without_drums_afile.tag.title = f"{orig_afile.tag.title} (No Drums)" + without_drums_afile.tag.save(version=ID3_V2_4) + + # Reload the original audio file to make sure we revert any changes to the tag + del orig_afile + orig_afile = eyed3.load(str(orig_path)) + + # Same for the one that's _JUST_ drums + just_drums_afile = eyed3.load(str(just_drums_path)) + just_drums_afile.tag = orig_afile.tag + just_drums_afile.tag.title = f"{orig_afile.tag.title} (Just Drums)" + just_drums_afile.tag.save(version=ID3_V2_4) + + # Now we want to move the files to a version + + shutil.move( + without_drums_path, + without_drums_path.joinpath("..") + .joinpath(f"{without_drums_afile.tag.title}.mp3") + .resolve(), + ) + shutil.move( + just_drums_path, + just_drums_path.joinpath("..") + .joinpath(f"{just_drums_afile.tag.title}.mp3") + .resolve(), + ) + + +if __name__ == "__main__": + if len(sys.argv) == 2: + main(sys.argv[1]) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..de820d1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +astroid==3.2.4 +black==24.8.0 +click==8.1.7 +coverage==5.5 +deprecation==2.1.0 +dill==0.3.9 +eyed3==0.9.7 +filetype==1.2.0 +isort==5.13.2 +mccabe==0.7.0 +mypy-extensions==1.0.0 +packaging==24.1 +pathspec==0.12.1 +platformdirs==4.3.6 +pylint==3.2.7 +pytoolconfig==1.3.1 +rope==1.13.0 +toml==0.10.2 +tomli==2.0.2 +tomlkit==0.13.2 +typing-extensions==4.12.2 diff --git a/run_folder.sh b/run_folder.sh new file mode 100755 index 0000000..7352464 --- /dev/null +++ b/run_folder.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +SOURCE_PATH="$(realpath $1)" +echo "Working through files in $SOURCE_PATH" + +for filename in "$SOURCE_PATH"/*; do + sudo python3 -m demucs --mp3 --two-stems=drums "$filename"; +done + +sudo chown "$USER" -R ./separated