mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-04-07 01:31:56 -04:00
Add channels to audio info
This commit is contained in:
parent
2f2fdfc13c
commit
d868ad9e61
5
transcoder/migrations/000003_add_audio_channels.down.sql
Normal file
5
transcoder/migrations/000003_add_audio_channels.down.sql
Normal file
@ -0,0 +1,5 @@
|
||||
begin;
|
||||
|
||||
alter table gocoder.audios drop column channels;
|
||||
|
||||
commit;
|
||||
5
transcoder/migrations/000003_add_audio_channels.up.sql
Normal file
5
transcoder/migrations/000003_add_audio_channels.up.sql
Normal file
@ -0,0 +1,5 @@
|
||||
begin;
|
||||
|
||||
alter table gocoder.audios add column channels int not null default 2;
|
||||
|
||||
commit;
|
||||
@ -100,11 +100,11 @@ func GetMimeCodec(stream *ffprobe.Stream) *string {
|
||||
return &ret
|
||||
|
||||
case "ac3":
|
||||
ret := "mp4a.a5"
|
||||
ret := "ac-3"
|
||||
return &ret
|
||||
|
||||
case "eac3":
|
||||
ret := "mp4a.a6"
|
||||
ret := "ec-3"
|
||||
return &ret
|
||||
|
||||
case "flac":
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
"gopkg.in/vansante/go-ffprobe.v2"
|
||||
)
|
||||
|
||||
const InfoVersion = 3
|
||||
const InfoVersion = 4
|
||||
|
||||
type Versions struct {
|
||||
Info int32 `json:"info" db:"ver_info"`
|
||||
@ -98,6 +98,8 @@ type Audio struct {
|
||||
Codec string `json:"codec" db:"codec"`
|
||||
/// The codec of this stream (defined as the RFC 6381).
|
||||
MimeCodec *string `json:"mimeCodec" db:"mime_codec"`
|
||||
/// The number of channels that stream has.
|
||||
Channels int `json:"channels" db:"channels"`
|
||||
/// The average bitrate of the audio in bytes/s
|
||||
Bitrate uint32 `json:"bitrate" db:"bitrate"`
|
||||
/// Is this stream the default one of it's type?
|
||||
@ -280,6 +282,7 @@ func RetriveMediaInfo(path string, sha string) (*MediaInfo, error) {
|
||||
Language: NullIfUnd(lang.String()),
|
||||
Codec: stream.CodecName,
|
||||
MimeCodec: GetMimeCodec(stream),
|
||||
Channels: stream.Channels,
|
||||
Bitrate: ParseUint(cmp.Or(stream.BitRate, mi.Format.BitRate)),
|
||||
IsDefault: stream.Disposition.Default != 0,
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ func (s *MetadataService) storeFreshMetadata(ctx context.Context, path string, s
|
||||
ctx,
|
||||
`
|
||||
insert into gocoder.audios(sha, idx, title, language, codec, mime_codec, is_default, bitrate)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
on conflict (sha, idx) do update set
|
||||
sha = excluded.sha,
|
||||
idx = excluded.idx,
|
||||
@ -327,10 +327,11 @@ func (s *MetadataService) storeFreshMetadata(ctx context.Context, path string, s
|
||||
language = excluded.language,
|
||||
codec = excluded.codec,
|
||||
mime_codec = excluded.mime_codec,
|
||||
channels = excluded.channels,
|
||||
is_default = excluded.is_default,
|
||||
bitrate = excluded.bitrate
|
||||
`,
|
||||
ret.Sha, a.Index, a.Title, a.Language, a.Codec, a.MimeCodec, a.IsDefault, a.Bitrate,
|
||||
ret.Sha, a.Index, a.Title, a.Language, a.Codec, a.MimeCodec, a.Channels, a.IsDefault, a.Bitrate,
|
||||
)
|
||||
}
|
||||
for _, s := range ret.Subtitles {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user