mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Create complete mediainfo/keyframe migration
This commit is contained in:
parent
5854c731a3
commit
9f7607cb87
@ -1,18 +1,72 @@
|
|||||||
begin;
|
begin;
|
||||||
|
|
||||||
create table if not exists info(
|
create table info(
|
||||||
sha varchar(20) not null primary key,
|
sha varchar(20) not null primary key,
|
||||||
path varchar(4096) not null unique,
|
path varchar(4096) not null unique,
|
||||||
extension varchar(256),
|
extension varchar(16),
|
||||||
mime_codec varchar(1024),
|
mime_codec varchar(1024),
|
||||||
size bigint not null,
|
size bigint not null,
|
||||||
duration real 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(
|
create table videos(
|
||||||
sha varchar(20) not null primary key,
|
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;
|
commit;
|
||||||
|
@ -54,6 +54,8 @@ type Video struct {
|
|||||||
Codec string `json:"codec"`
|
Codec string `json:"codec"`
|
||||||
/// The codec of this stream (defined as the RFC 6381).
|
/// The codec of this stream (defined as the RFC 6381).
|
||||||
MimeCodec *string `json:"mimeCodec"`
|
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)
|
/// The language of this stream (as a ISO-639-2 language code)
|
||||||
Language *string `json:"language"`
|
Language *string `json:"language"`
|
||||||
/// The max quality of this video track.
|
/// The max quality of this video track.
|
||||||
@ -268,6 +270,7 @@ func getInfo(path string) (*MediaInfo, error) {
|
|||||||
return Video{
|
return Video{
|
||||||
Codec: stream.CodecName,
|
Codec: stream.CodecName,
|
||||||
MimeCodec: GetMimeCodec(stream),
|
MimeCodec: GetMimeCodec(stream),
|
||||||
|
Title: OrNull(stream.Tags.Title),
|
||||||
Language: NullIfUnd(lang.String()),
|
Language: NullIfUnd(lang.String()),
|
||||||
Quality: QualityFromHeight(uint32(stream.Height)),
|
Quality: QualityFromHeight(uint32(stream.Height)),
|
||||||
Width: uint32(stream.Width),
|
Width: uint32(stream.Width),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user