Skip to content

Instantly share code, notes, and snippets.

@insin
Last active August 29, 2015 14:27
Show Gist options
  • Save insin/805eb331e97a19000968 to your computer and use it in GitHub Desktop.
Save insin/805eb331e97a19000968 to your computer and use it in GitHub Desktop.
Arjuna as a Service - http://babeljs.io/repl/
var trackInfo = `1. Early Bird (0:00)
2. Awaking (2:10)
3. Cloe (10:08)
4. Time to Die (13:29)
5. 2nd Life (16:20)
6. Diving (19:25)
7. Clone (22:02)
8. Feel the Circle (24:08)
9. Aerobics (25:44)
10. Omega Blue (29:11)
11. Drop of Time (32:00)
12. Earth Resonance (32:54)
13. Prophet (34:51)
14. Before Breakfast (39:01)
15. Bells for Her (40:16)
16. Motorcycle (42:20)
17. Diamond (47:32)
18. Mameshiba (48:58)
19. Kookie (55:10)
20. Aqua (56:20)`.split('\n')
var tracks = trackInfo.map(track => {
var [_, num, name, start] = /^(\d+)\. (.+) \((\d{1,2}:\d{2})\)$/.exec(track)
return {name: `"${num < 10 ? '0' + num : num}-${name}.mp3"`, start}
})
console.log('youtube-dl --extract-audio --audio-format mp3 --output input.mp3 https://www.youtube.com/watch?v=dT7wHxZT83A\n')
tracks.forEach(({name, start}, index) => {
var to = tracks[index + 1] ? ` -to ${tracks[index + 1].start}` : ''
console.log(`ffmpeg -i input.mp3 -acodec copy -ss ${start}${to} ${name}\n`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment