Compare commits
No commits in common. "61917432c98786483a0b844a73b75852dd7975c7" and "10cf2f455dc7a28dd7708f6c5d2e7d0170001c8c" have entirely different histories.
61917432c9
...
10cf2f455d
@ -20,8 +20,7 @@ rsync -uvr --progress --delete /mnt/storage/MediaLibrary/{Movies,other,Patreon,S
|
|||||||
rsync -uvrL --progress --delete /home/exu/Musik /mnt/lan1nas1/
|
rsync -uvrL --progress --delete /home/exu/Musik /mnt/lan1nas1/
|
||||||
|
|
||||||
# transfer Music
|
# transfer Music
|
||||||
#rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Musik/ ${user}@${server}:/mnt/media/Musik/
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Musik/ ${user}@${server}:/mnt/media/Musik/
|
||||||
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Musik/ ${user}@${server}:/mnt/media/Musik/
|
|
||||||
|
|
||||||
# transfer Shows
|
# transfer Shows
|
||||||
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Shows/ ${user}@${server}:/mnt/media/Shows/
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Shows/ ${user}@${server}:/mnt/media/Shows/
|
||||||
|
@ -35,9 +35,6 @@ import soundfile
|
|||||||
# loudness normalization
|
# loudness normalization
|
||||||
import pyloudnorm
|
import pyloudnorm
|
||||||
|
|
||||||
# file copy
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Normalize loudness of all music files in a given directory and its subdirectories.
|
Normalize loudness of all music files in a given directory and its subdirectories.
|
||||||
"""
|
"""
|
||||||
@ -114,28 +111,6 @@ def ffmpeg_to_wav(inputfile: str, outputfile: str):
|
|||||||
subprocess.run(ff.cmd, shell=True, capture_output=True)
|
subprocess.run(ff.cmd, shell=True, capture_output=True)
|
||||||
|
|
||||||
|
|
||||||
def ffmpeg_copy_metadata(inputfile: str, outputfile: str):
|
|
||||||
"""
|
|
||||||
Copy all metadata from the input file to the output file.
|
|
||||||
A temporary file is used in an intermediate step
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
inputfile (str): Path to input file
|
|
||||||
outputfile (str): Path to output file
|
|
||||||
"""
|
|
||||||
|
|
||||||
# store output file as temporary file. FFMPEG can't work on files in-place
|
|
||||||
with tempfile.NamedTemporaryFile() as temp_audio:
|
|
||||||
shutil.copyfile(outputfile, temp_audio.name)
|
|
||||||
|
|
||||||
inputcmd = {inputfile: None, temp_audio.name: None}
|
|
||||||
outputcmd = {outputfile: "-map 1 -c copy -map_metadata 0"}
|
|
||||||
|
|
||||||
ff = ffmpy.FFmpeg(inputs=inputcmd, outputs=outputcmd, global_options=("-y"))
|
|
||||||
|
|
||||||
subprocess.run(ff.cmd, shell=True, capture_output=True)
|
|
||||||
|
|
||||||
|
|
||||||
def main(inputfile: str) -> Optional[list[Any]]:
|
def main(inputfile: str) -> Optional[list[Any]]:
|
||||||
"""
|
"""
|
||||||
Main program loop
|
Main program loop
|
||||||
@ -172,14 +147,12 @@ def main(inputfile: str) -> Optional[list[Any]]:
|
|||||||
outputfile: str = os.path.join(outputfolder, infile_noextension + ".flac")
|
outputfile: str = os.path.join(outputfolder, infile_noextension + ".flac")
|
||||||
# direct conversion start
|
# direct conversion start
|
||||||
loudnorm(inputfile=inputfile, outputfile=outputfile)
|
loudnorm(inputfile=inputfile, outputfile=outputfile)
|
||||||
ffmpeg_copy_metadata(inputfile=inputfile, outputfile=outputfile)
|
|
||||||
print("Completed", inputfile)
|
print("Completed", inputfile)
|
||||||
case ".mp3" | ".m4a" | ".aac" | ".opus":
|
case ".mp3" | ".m4a" | ".aac" | ".opus":
|
||||||
print("Working on", inputfile)
|
print("Working on", inputfile)
|
||||||
outputfile: str = os.path.join(outputfolder, infile_noextension + ".opus")
|
outputfile: str = os.path.join(outputfolder, infile_noextension + ".opus")
|
||||||
# conversion is started within the ffmpeg_to_wav function
|
# conversion is started within the ffmpeg_to_wav function
|
||||||
ffmpeg_to_wav(inputfile=inputfile, outputfile=outputfile)
|
ffmpeg_to_wav(inputfile=inputfile, outputfile=outputfile)
|
||||||
ffmpeg_copy_metadata(inputfile=inputfile, outputfile=outputfile)
|
|
||||||
print("Completed", inputfile)
|
print("Completed", inputfile)
|
||||||
case _:
|
case _:
|
||||||
print(
|
print(
|
||||||
|
Loading…
Reference in New Issue
Block a user