Created
June 5, 2018 23:53
-
-
Save yagihash/691ba83b020378830c3d28cb7a6587fb to your computer and use it in GitHub Desktop.
雑にm3uのプレイリスト作るやつ。
This file contains hidden or 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
<?php | |
$files = glob('*.m4a'); | |
foreach($files as $file) { | |
$duration = `exiftool -Duration '{$file}' | cut -d ':' -f 3,4`; | |
$duration = explode(':', $duration); | |
$extinf = (int)$duration[0]*60 + (int)$duration[1]; | |
$title = substr($file, 3, -4); | |
$album = basename(getcwd()); | |
$artist = basename(dirname(getcwd(), 1)); | |
printf('#EXTINF:%d,%s' . PHP_EOL, $extinf, $title); | |
printf('%s\%s\%s' . PHP_EOL, $artist, $album, $file); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment