Last active
October 28, 2015 17:49
-
-
Save otofu-square/cacfa509e13988d19687 to your computer and use it in GitHub Desktop.
Apple Loss Less → MP3 translation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'streamio-ffmpeg' | |
require 'yaml' | |
INPUT_PATH = "~/変換元ディレクトリ" | |
OUTPUT_PATH = "~/変換後のファイルを保存するディレクトリ" | |
# YAMLから変換する曲のアーティスト一覧を取得 | |
# example: artists.yml | |
# - Bireli\ Lagrene | |
# - John\ Pizzarreli | |
# - ... etc | |
artists = YAML.load_file("./artists.yml") | |
artists.each do |artist| | |
artist_path = INPUT_PATH+artist | |
output_path = OUTPUT_PATH+artist | |
# アーティストのディレクトリを作成 | |
Dir.mkdir(output_path.gsub("\\", "")) | |
Dir.glob(artist_path+"/*").each do |album| | |
# アルバムのディレクトリを作成 | |
Dir.mkdir(album.sub(INPUT_PATH, OUTPUT_PATH)) | |
Dir.glob(album+"/*").each do |music| | |
FFMPEG::Movie.new(music).transcode(music.gsub(INPUT_PATH, OUTPUT_PATH).gsub(".m4a", ".mp3")) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment