-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
781ad2b
commit d418b1d
Showing
9 changed files
with
116 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(env | ||
(dev | ||
(flags (:standard -w @A-48-44-45)))) | ||
(flags (:standard -w @A-48-44-45-40-42)))) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
open Containers | ||
|
||
type t = { | ||
title: string; | ||
artist: string; | ||
cover_art: IO.File.t; | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
(libraries | ||
cmdliner | ||
containers | ||
cohttp-lwt | ||
cohttp-lwt-unix | ||
yojson | ||
re)) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,42 @@ | ||
type time = | ||
| Beginning of int (* track's end timestamp in seconds *) | ||
| Middle of int * int (* track's beginning timestamp and end timestamp in seconds *) | ||
| End of int (* track's timestamp (from the beginning!) in seconds *) | ||
open Containers | ||
|
||
module Time = struct | ||
type t = | ||
| Beginning of int (* track's end timestamp in seconds *) | ||
| Middle of int * int (* track's beginning timestamp and end timestamp in seconds *) | ||
| End of int (* track's timestamp (from the beginning!) in seconds *) | ||
end | ||
|
||
type t = { | ||
title: string; | ||
time: time | ||
time: Time.t; | ||
track_num: int; | ||
} | ||
|
||
|
||
let to_string track = | ||
let beg, end_ = | ||
let open Time in | ||
match track.time with | ||
| Beginning x -> 0, x | ||
| Middle (x, y) -> x, y | ||
| End x -> x, -1 | ||
in | ||
Printf.sprintf "%s (%d - %d)" track.title beg end_ | ||
|
||
let extract album_file {title; time} = | ||
let range = match time with | ||
|
||
let extract album_file {title; time; _} = | ||
let range = | ||
let open Time in | ||
match time with | ||
| Beginning end_ -> Printf.sprintf "-t %d" end_ | ||
| Middle (beg, end_) -> Printf.sprintf "-ss %d -to %d" beg end_ | ||
| End beg -> Printf.sprintf "-ss %d" beg | ||
in | ||
let title = String.escaped title in | ||
Sys.command | ||
(Printf.sprintf | ||
"ffmpeg -loglevel fatal -hide_banner -y %s -i '%s' '%s.mp3'" | ||
"ffmpeg -loglevel info -hide_banner -y %s -i '%s' '%s.mp3'" | ||
range | ||
(String.escaped album_file) | ||
(String.escaped title)) | ||
title) |> ignore; |
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