diff --git a/transcoder/migrations/000001_init_db.up.sql b/transcoder/migrations/000001_init_db.up.sql index d182de68..06b2c08d 100644 --- a/transcoder/migrations/000001_init_db.up.sql +++ b/transcoder/migrations/000001_init_db.up.sql @@ -1,18 +1,72 @@ begin; -create table if not exists info( +create table info( sha varchar(20) not null primary key, path varchar(4096) not null unique, - extension varchar(256), + extension varchar(16), mime_codec varchar(1024), size bigint not null, duration real not null, - container varchar(256) + container varchar(256), + fonts text[], + ver_ffprobe integer, + ver_extract integer, + ver_thumbs integer, + ver_keyframes integer ); -create table if not exists videos( - sha varchar(20) not null primary key, +create table videos( + sha varchar(20) not null references info(sha) on delete cascade, + idx integer not null, + title varchar(1024), + language varchar(256), + codec varchar(256) not null, + mime_codec varchar(256), + width integer not null, + height integer not null, + bitrate integer not null, -) + keyframes double precision[], + + constraint videos_pk primary key (sha, idx) +); + +create table audios( + sha varchar(20) not null references info(sha) on delete cascade, + idx integer not null, + title varchar(1024), + language varchar(256), + codec varchar(256) not null, + mime_codec varchar(256), + is_default boolean not null, + + keyframes double precision[], + + constraint audios_pk primary key (sha, idx) +); + +create table subtitles( + sha varchar(20) not null references info(sha) on delete cascade, + -- Can be null when is_external is true + idx integer, + title varchar(1024), + language varchar(256), + codec varchar(256) not null, + extension varchar(16), + is_defaut boolean not null, + is_forced boolean not null, + is_external boolean not null, + path varchar(4096) +); + +create type chapter_type as enum('content', 'recap', 'intro', 'credits'); + +create table chapters( + sha varchar(20) not null references info(sha) on delete cascade, + start_time real not null, + end_time real not null, + name varchar(1024), + type chapter_type +); commit; diff --git a/transcoder/src/info.go b/transcoder/src/info.go index a8480fab..a9857984 100644 --- a/transcoder/src/info.go +++ b/transcoder/src/info.go @@ -54,6 +54,8 @@ type Video struct { Codec string `json:"codec"` /// The codec of this stream (defined as the RFC 6381). MimeCodec *string `json:"mimeCodec"` + /// The title of the stream. + Title *string `json:"title"` /// The language of this stream (as a ISO-639-2 language code) Language *string `json:"language"` /// The max quality of this video track. @@ -268,6 +270,7 @@ func getInfo(path string) (*MediaInfo, error) { return Video{ Codec: stream.CodecName, MimeCodec: GetMimeCodec(stream), + Title: OrNull(stream.Tags.Title), Language: NullIfUnd(lang.String()), Quality: QualityFromHeight(uint32(stream.Height)), Width: uint32(stream.Width),