Update proto structure

This commit is contained in:
Rob Watson 2021-11-01 20:33:45 +01:00
parent 7c5b22a407
commit 49099b12d6
3 changed files with 24 additions and 26 deletions

View File

@ -156,24 +156,21 @@ func (s *MediaSetService) findMediaSet(ctx context.Context, youtubeID string) (*
return nil, fmt.Errorf("error getting existing media set: %v", err)
}
var frames int64
if mediaSet.AudioFramesRaw.Valid {
frames = mediaSet.AudioFramesRaw.Int64
}
return &MediaSet{
Audio: Audio{
YoutubeItag: int(mediaSet.AudioYoutubeItag),
Bytes: 0, // DEPRECATED
Channels: int(mediaSet.AudioChannels),
ApproxFrames: int64(mediaSet.AudioFramesApprox),
Frames: frames,
Frames: mediaSet.AudioFramesRaw.Int64,
SampleRate: int(mediaSet.AudioSampleRateRaw),
MimeType: mediaSet.AudioMimeTypeEncoded,
},
Video: Video{
YoutubeItag: int(mediaSet.VideoYoutubeItag),
Bytes: 0, // DEPRECATED?
Duration: time.Duration(mediaSet.VideoDurationNanos),
MimeType: mediaSet.VideoMimeType,
ThumbnailWidth: 0, // ??
ThumbnailHeight: 0, // ??
},

View File

@ -67,16 +67,17 @@ func (c *mediaSetServiceController) Get(ctx context.Context, request *pbMediaSet
result := pbMediaSet.MediaSet{
Id: mediaSet.YoutubeID,
Audio: &pbMediaSet.MediaSet_Audio{
Bytes: mediaSet.Audio.Bytes,
Channels: int32(mediaSet.Audio.Channels),
Frames: mediaSet.Audio.Frames,
ApproxFrames: mediaSet.Audio.ApproxFrames,
SampleRate: int32(mediaSet.Audio.SampleRate),
YoutubeItag: int32(mediaSet.Audio.YoutubeItag),
MimeType: mediaSet.Audio.MimeType,
},
Video: &pbMediaSet.MediaSet_Video{
Bytes: mediaSet.Video.Bytes,
Duration: durationpb.New(mediaSet.Video.Duration),
ThumbnailWidth: int32(mediaSet.Video.ThumbnailWidth),
ThumbnailHeight: int32(mediaSet.Video.ThumbnailHeight),
YoutubeItag: int32(mediaSet.Video.YoutubeItag),
MimeType: mediaSet.Video.MimeType,
},
}

View File

@ -7,24 +7,24 @@ import "google/protobuf/duration.proto";
message MediaSet {
message Audio {
int64 bytes = 1;
int32 channels = 2;
int64 approx_frames = 3;
int64 frames = 4;
int32 sample_rate = 5;
int32 channels = 1;
int64 approx_frames = 2;
int64 frames = 3;
int32 sample_rate = 4;
int32 youtube_itag = 5;
string mime_type = 6;
};
message Video {
int64 bytes = 1;
google.protobuf.Duration duration = 2;
int32 thumbnail_width = 3;
int32 thumbnail_height = 4;
google.protobuf.Duration duration = 1;
int32 youtube_itag = 2;
string mime_type = 3;
};
string id = 1;
Audio audio = 2;
Video video = 3;
bool loaded = 4;
string youtube_id = 2;
Audio audio = 3;
Video video = 4;
};
message GetAudioProgress {