Initial commit
This commit is contained in:
commit
aacce6ad4d
4 changed files with 100 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/bin
|
||||
/include
|
||||
/lib
|
||||
/lib64
|
||||
/share
|
||||
/pyvenv.cfg
|
||||
63
metadata_copy.py
Normal file
63
metadata_copy.py
Normal file
|
|
@ -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])
|
||||
21
requirements.txt
Normal file
21
requirements.txt
Normal file
|
|
@ -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
|
||||
10
run_folder.sh
Executable file
10
run_folder.sh
Executable file
|
|
@ -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
|
||||
Loading…
Reference in a new issue