From 51fdbb54af66109febb1a94ad4dd5cbe09830cc8 Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 27 May 2024 10:02:07 -0500 Subject: [PATCH] feat: audio only archive support (#431) * feat(ent/vod): tmp paths * feat(archive): use tmp paths on vod object and allow audio_only archives --- ent/chapter.go | 8 +- ent/live.go | 8 +- ent/livecategory.go | 8 +- ent/livetitleregex.go | 8 +- ent/migrate/schema.go | 10 +- ent/mutation.go | 676 +++++++++++++++++++++++++++-- ent/mutedsegment.go | 8 +- ent/queue.go | 8 +- ent/runtime.go | 10 +- ent/runtime/runtime.go | 4 +- ent/schema/vod.go | 8 + ent/vod.go | 106 ++++- ent/vod/vod.go | 64 +++ ent/vod/where.go | 640 +++++++++++++++++++++++++++ ent/vod_create.go | 624 ++++++++++++++++++++++++++ ent/vod_update.go | 416 ++++++++++++++++++ go.sum | 6 + internal/activities/video.go | 42 +- internal/archive/archive.go | 386 +++++----------- internal/exec/exec.go | 29 +- internal/transport/http/archive.go | 45 +- internal/transport/http/handler.go | 1 - internal/transport/http/live.go | 8 +- internal/vod/vod.go | 54 ++- 24 files changed, 2680 insertions(+), 497 deletions(-) diff --git a/ent/chapter.go b/ent/chapter.go index 4db1a96d..afd212bc 100644 --- a/ent/chapter.go +++ b/ent/chapter.go @@ -45,12 +45,10 @@ type ChapterEdges struct { // VodOrErr returns the Vod value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e ChapterEdges) VodOrErr() (*Vod, error) { - if e.loadedTypes[0] { - if e.Vod == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: vod.Label} - } + if e.Vod != nil { return e.Vod, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: vod.Label} } return nil, &NotLoadedError{edge: "vod"} } diff --git a/ent/live.go b/ent/live.go index bf18d157..3659653f 100644 --- a/ent/live.go +++ b/ent/live.go @@ -70,12 +70,10 @@ type LiveEdges struct { // ChannelOrErr returns the Channel value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e LiveEdges) ChannelOrErr() (*Channel, error) { - if e.loadedTypes[0] { - if e.Channel == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: channel.Label} - } + if e.Channel != nil { return e.Channel, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: channel.Label} } return nil, &NotLoadedError{edge: "channel"} } diff --git a/ent/livecategory.go b/ent/livecategory.go index e18f205f..a987d875 100644 --- a/ent/livecategory.go +++ b/ent/livecategory.go @@ -39,12 +39,10 @@ type LiveCategoryEdges struct { // LiveOrErr returns the Live value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e LiveCategoryEdges) LiveOrErr() (*Live, error) { - if e.loadedTypes[0] { - if e.Live == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: live.Label} - } + if e.Live != nil { return e.Live, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: live.Label} } return nil, &NotLoadedError{edge: "live"} } diff --git a/ent/livetitleregex.go b/ent/livetitleregex.go index c149148c..b807e3e8 100644 --- a/ent/livetitleregex.go +++ b/ent/livetitleregex.go @@ -43,12 +43,10 @@ type LiveTitleRegexEdges struct { // LiveOrErr returns the Live value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e LiveTitleRegexEdges) LiveOrErr() (*Live, error) { - if e.loadedTypes[0] { - if e.Live == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: live.Label} - } + if e.Live != nil { return e.Live, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: live.Label} } return nil, &NotLoadedError{edge: "live"} } diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 304da0ef..1c48b9f4 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -264,11 +264,19 @@ var ( {Name: "web_thumbnail_path", Type: field.TypeString}, {Name: "video_path", Type: field.TypeString}, {Name: "chat_path", Type: field.TypeString, Nullable: true}, + {Name: "live_chat_path", Type: field.TypeString, Nullable: true}, + {Name: "live_chat_convert_path", Type: field.TypeString, Nullable: true}, {Name: "chat_video_path", Type: field.TypeString, Nullable: true}, {Name: "info_path", Type: field.TypeString, Nullable: true}, {Name: "caption_path", Type: field.TypeString, Nullable: true}, {Name: "folder_name", Type: field.TypeString, Nullable: true}, {Name: "file_name", Type: field.TypeString, Nullable: true}, + {Name: "tmp_video_download_path", Type: field.TypeString, Nullable: true}, + {Name: "tmp_video_convert_path", Type: field.TypeString, Nullable: true}, + {Name: "tmp_chat_download_path", Type: field.TypeString, Nullable: true}, + {Name: "tmp_live_chat_download_path", Type: field.TypeString, Nullable: true}, + {Name: "tmp_live_chat_convert_path", Type: field.TypeString, Nullable: true}, + {Name: "tmp_chat_render_path", Type: field.TypeString, Nullable: true}, {Name: "locked", Type: field.TypeBool, Default: false}, {Name: "local_views", Type: field.TypeInt, Default: 0}, {Name: "streamed_at", Type: field.TypeTime}, @@ -284,7 +292,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "vods_channels_vods", - Columns: []*schema.Column{VodsColumns[23]}, + Columns: []*schema.Column{VodsColumns[31]}, RefColumns: []*schema.Column{ChannelsColumns[0]}, OnDelete: schema.NoAction, }, diff --git a/ent/mutation.go b/ent/mutation.go index 14f1c3b0..f9e68b44 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -8933,51 +8933,59 @@ func (m *UserMutation) ResetEdge(name string) error { // VodMutation represents an operation that mutates the Vod nodes in the graph. type VodMutation struct { config - op Op - typ string - id *uuid.UUID - ext_id *string - platform *utils.VodPlatform - _type *utils.VodType - title *string - duration *int - addduration *int - views *int - addviews *int - resolution *string - processing *bool - thumbnail_path *string - web_thumbnail_path *string - video_path *string - chat_path *string - chat_video_path *string - info_path *string - caption_path *string - folder_name *string - file_name *string - locked *bool - local_views *int - addlocal_views *int - streamed_at *time.Time - updated_at *time.Time - created_at *time.Time - clearedFields map[string]struct{} - channel *uuid.UUID - clearedchannel bool - queue *uuid.UUID - clearedqueue bool - playlists map[uuid.UUID]struct{} - removedplaylists map[uuid.UUID]struct{} - clearedplaylists bool - chapters map[uuid.UUID]struct{} - removedchapters map[uuid.UUID]struct{} - clearedchapters bool - muted_segments map[uuid.UUID]struct{} - removedmuted_segments map[uuid.UUID]struct{} - clearedmuted_segments bool - done bool - oldValue func(context.Context) (*Vod, error) - predicates []predicate.Vod + op Op + typ string + id *uuid.UUID + ext_id *string + platform *utils.VodPlatform + _type *utils.VodType + title *string + duration *int + addduration *int + views *int + addviews *int + resolution *string + processing *bool + thumbnail_path *string + web_thumbnail_path *string + video_path *string + chat_path *string + live_chat_path *string + live_chat_convert_path *string + chat_video_path *string + info_path *string + caption_path *string + folder_name *string + file_name *string + tmp_video_download_path *string + tmp_video_convert_path *string + tmp_chat_download_path *string + tmp_live_chat_download_path *string + tmp_live_chat_convert_path *string + tmp_chat_render_path *string + locked *bool + local_views *int + addlocal_views *int + streamed_at *time.Time + updated_at *time.Time + created_at *time.Time + clearedFields map[string]struct{} + channel *uuid.UUID + clearedchannel bool + queue *uuid.UUID + clearedqueue bool + playlists map[uuid.UUID]struct{} + removedplaylists map[uuid.UUID]struct{} + clearedplaylists bool + chapters map[uuid.UUID]struct{} + removedchapters map[uuid.UUID]struct{} + clearedchapters bool + muted_segments map[uuid.UUID]struct{} + removedmuted_segments map[uuid.UUID]struct{} + clearedmuted_segments bool + done bool + oldValue func(context.Context) (*Vod, error) + predicates []predicate.Vod } var _ ent.Mutation = (*VodMutation)(nil) @@ -9595,6 +9603,104 @@ func (m *VodMutation) ResetChatPath() { delete(m.clearedFields, vod.FieldChatPath) } +// SetLiveChatPath sets the "live_chat_path" field. +func (m *VodMutation) SetLiveChatPath(s string) { + m.live_chat_path = &s +} + +// LiveChatPath returns the value of the "live_chat_path" field in the mutation. +func (m *VodMutation) LiveChatPath() (r string, exists bool) { + v := m.live_chat_path + if v == nil { + return + } + return *v, true +} + +// OldLiveChatPath returns the old "live_chat_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldLiveChatPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLiveChatPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLiveChatPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLiveChatPath: %w", err) + } + return oldValue.LiveChatPath, nil +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (m *VodMutation) ClearLiveChatPath() { + m.live_chat_path = nil + m.clearedFields[vod.FieldLiveChatPath] = struct{}{} +} + +// LiveChatPathCleared returns if the "live_chat_path" field was cleared in this mutation. +func (m *VodMutation) LiveChatPathCleared() bool { + _, ok := m.clearedFields[vod.FieldLiveChatPath] + return ok +} + +// ResetLiveChatPath resets all changes to the "live_chat_path" field. +func (m *VodMutation) ResetLiveChatPath() { + m.live_chat_path = nil + delete(m.clearedFields, vod.FieldLiveChatPath) +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (m *VodMutation) SetLiveChatConvertPath(s string) { + m.live_chat_convert_path = &s +} + +// LiveChatConvertPath returns the value of the "live_chat_convert_path" field in the mutation. +func (m *VodMutation) LiveChatConvertPath() (r string, exists bool) { + v := m.live_chat_convert_path + if v == nil { + return + } + return *v, true +} + +// OldLiveChatConvertPath returns the old "live_chat_convert_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldLiveChatConvertPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldLiveChatConvertPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldLiveChatConvertPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldLiveChatConvertPath: %w", err) + } + return oldValue.LiveChatConvertPath, nil +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (m *VodMutation) ClearLiveChatConvertPath() { + m.live_chat_convert_path = nil + m.clearedFields[vod.FieldLiveChatConvertPath] = struct{}{} +} + +// LiveChatConvertPathCleared returns if the "live_chat_convert_path" field was cleared in this mutation. +func (m *VodMutation) LiveChatConvertPathCleared() bool { + _, ok := m.clearedFields[vod.FieldLiveChatConvertPath] + return ok +} + +// ResetLiveChatConvertPath resets all changes to the "live_chat_convert_path" field. +func (m *VodMutation) ResetLiveChatConvertPath() { + m.live_chat_convert_path = nil + delete(m.clearedFields, vod.FieldLiveChatConvertPath) +} + // SetChatVideoPath sets the "chat_video_path" field. func (m *VodMutation) SetChatVideoPath(s string) { m.chat_video_path = &s @@ -9840,6 +9946,300 @@ func (m *VodMutation) ResetFileName() { delete(m.clearedFields, vod.FieldFileName) } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (m *VodMutation) SetTmpVideoDownloadPath(s string) { + m.tmp_video_download_path = &s +} + +// TmpVideoDownloadPath returns the value of the "tmp_video_download_path" field in the mutation. +func (m *VodMutation) TmpVideoDownloadPath() (r string, exists bool) { + v := m.tmp_video_download_path + if v == nil { + return + } + return *v, true +} + +// OldTmpVideoDownloadPath returns the old "tmp_video_download_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpVideoDownloadPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpVideoDownloadPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpVideoDownloadPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpVideoDownloadPath: %w", err) + } + return oldValue.TmpVideoDownloadPath, nil +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (m *VodMutation) ClearTmpVideoDownloadPath() { + m.tmp_video_download_path = nil + m.clearedFields[vod.FieldTmpVideoDownloadPath] = struct{}{} +} + +// TmpVideoDownloadPathCleared returns if the "tmp_video_download_path" field was cleared in this mutation. +func (m *VodMutation) TmpVideoDownloadPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpVideoDownloadPath] + return ok +} + +// ResetTmpVideoDownloadPath resets all changes to the "tmp_video_download_path" field. +func (m *VodMutation) ResetTmpVideoDownloadPath() { + m.tmp_video_download_path = nil + delete(m.clearedFields, vod.FieldTmpVideoDownloadPath) +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (m *VodMutation) SetTmpVideoConvertPath(s string) { + m.tmp_video_convert_path = &s +} + +// TmpVideoConvertPath returns the value of the "tmp_video_convert_path" field in the mutation. +func (m *VodMutation) TmpVideoConvertPath() (r string, exists bool) { + v := m.tmp_video_convert_path + if v == nil { + return + } + return *v, true +} + +// OldTmpVideoConvertPath returns the old "tmp_video_convert_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpVideoConvertPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpVideoConvertPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpVideoConvertPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpVideoConvertPath: %w", err) + } + return oldValue.TmpVideoConvertPath, nil +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (m *VodMutation) ClearTmpVideoConvertPath() { + m.tmp_video_convert_path = nil + m.clearedFields[vod.FieldTmpVideoConvertPath] = struct{}{} +} + +// TmpVideoConvertPathCleared returns if the "tmp_video_convert_path" field was cleared in this mutation. +func (m *VodMutation) TmpVideoConvertPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpVideoConvertPath] + return ok +} + +// ResetTmpVideoConvertPath resets all changes to the "tmp_video_convert_path" field. +func (m *VodMutation) ResetTmpVideoConvertPath() { + m.tmp_video_convert_path = nil + delete(m.clearedFields, vod.FieldTmpVideoConvertPath) +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (m *VodMutation) SetTmpChatDownloadPath(s string) { + m.tmp_chat_download_path = &s +} + +// TmpChatDownloadPath returns the value of the "tmp_chat_download_path" field in the mutation. +func (m *VodMutation) TmpChatDownloadPath() (r string, exists bool) { + v := m.tmp_chat_download_path + if v == nil { + return + } + return *v, true +} + +// OldTmpChatDownloadPath returns the old "tmp_chat_download_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpChatDownloadPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpChatDownloadPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpChatDownloadPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpChatDownloadPath: %w", err) + } + return oldValue.TmpChatDownloadPath, nil +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (m *VodMutation) ClearTmpChatDownloadPath() { + m.tmp_chat_download_path = nil + m.clearedFields[vod.FieldTmpChatDownloadPath] = struct{}{} +} + +// TmpChatDownloadPathCleared returns if the "tmp_chat_download_path" field was cleared in this mutation. +func (m *VodMutation) TmpChatDownloadPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpChatDownloadPath] + return ok +} + +// ResetTmpChatDownloadPath resets all changes to the "tmp_chat_download_path" field. +func (m *VodMutation) ResetTmpChatDownloadPath() { + m.tmp_chat_download_path = nil + delete(m.clearedFields, vod.FieldTmpChatDownloadPath) +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (m *VodMutation) SetTmpLiveChatDownloadPath(s string) { + m.tmp_live_chat_download_path = &s +} + +// TmpLiveChatDownloadPath returns the value of the "tmp_live_chat_download_path" field in the mutation. +func (m *VodMutation) TmpLiveChatDownloadPath() (r string, exists bool) { + v := m.tmp_live_chat_download_path + if v == nil { + return + } + return *v, true +} + +// OldTmpLiveChatDownloadPath returns the old "tmp_live_chat_download_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpLiveChatDownloadPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpLiveChatDownloadPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpLiveChatDownloadPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpLiveChatDownloadPath: %w", err) + } + return oldValue.TmpLiveChatDownloadPath, nil +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (m *VodMutation) ClearTmpLiveChatDownloadPath() { + m.tmp_live_chat_download_path = nil + m.clearedFields[vod.FieldTmpLiveChatDownloadPath] = struct{}{} +} + +// TmpLiveChatDownloadPathCleared returns if the "tmp_live_chat_download_path" field was cleared in this mutation. +func (m *VodMutation) TmpLiveChatDownloadPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpLiveChatDownloadPath] + return ok +} + +// ResetTmpLiveChatDownloadPath resets all changes to the "tmp_live_chat_download_path" field. +func (m *VodMutation) ResetTmpLiveChatDownloadPath() { + m.tmp_live_chat_download_path = nil + delete(m.clearedFields, vod.FieldTmpLiveChatDownloadPath) +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (m *VodMutation) SetTmpLiveChatConvertPath(s string) { + m.tmp_live_chat_convert_path = &s +} + +// TmpLiveChatConvertPath returns the value of the "tmp_live_chat_convert_path" field in the mutation. +func (m *VodMutation) TmpLiveChatConvertPath() (r string, exists bool) { + v := m.tmp_live_chat_convert_path + if v == nil { + return + } + return *v, true +} + +// OldTmpLiveChatConvertPath returns the old "tmp_live_chat_convert_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpLiveChatConvertPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpLiveChatConvertPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpLiveChatConvertPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpLiveChatConvertPath: %w", err) + } + return oldValue.TmpLiveChatConvertPath, nil +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (m *VodMutation) ClearTmpLiveChatConvertPath() { + m.tmp_live_chat_convert_path = nil + m.clearedFields[vod.FieldTmpLiveChatConvertPath] = struct{}{} +} + +// TmpLiveChatConvertPathCleared returns if the "tmp_live_chat_convert_path" field was cleared in this mutation. +func (m *VodMutation) TmpLiveChatConvertPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpLiveChatConvertPath] + return ok +} + +// ResetTmpLiveChatConvertPath resets all changes to the "tmp_live_chat_convert_path" field. +func (m *VodMutation) ResetTmpLiveChatConvertPath() { + m.tmp_live_chat_convert_path = nil + delete(m.clearedFields, vod.FieldTmpLiveChatConvertPath) +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (m *VodMutation) SetTmpChatRenderPath(s string) { + m.tmp_chat_render_path = &s +} + +// TmpChatRenderPath returns the value of the "tmp_chat_render_path" field in the mutation. +func (m *VodMutation) TmpChatRenderPath() (r string, exists bool) { + v := m.tmp_chat_render_path + if v == nil { + return + } + return *v, true +} + +// OldTmpChatRenderPath returns the old "tmp_chat_render_path" field's value of the Vod entity. +// If the Vod object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *VodMutation) OldTmpChatRenderPath(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTmpChatRenderPath is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTmpChatRenderPath requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTmpChatRenderPath: %w", err) + } + return oldValue.TmpChatRenderPath, nil +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (m *VodMutation) ClearTmpChatRenderPath() { + m.tmp_chat_render_path = nil + m.clearedFields[vod.FieldTmpChatRenderPath] = struct{}{} +} + +// TmpChatRenderPathCleared returns if the "tmp_chat_render_path" field was cleared in this mutation. +func (m *VodMutation) TmpChatRenderPathCleared() bool { + _, ok := m.clearedFields[vod.FieldTmpChatRenderPath] + return ok +} + +// ResetTmpChatRenderPath resets all changes to the "tmp_chat_render_path" field. +func (m *VodMutation) ResetTmpChatRenderPath() { + m.tmp_chat_render_path = nil + delete(m.clearedFields, vod.FieldTmpChatRenderPath) +} + // SetLocked sets the "locked" field. func (m *VodMutation) SetLocked(b bool) { m.locked = &b @@ -10314,7 +10714,7 @@ func (m *VodMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *VodMutation) Fields() []string { - fields := make([]string, 0, 22) + fields := make([]string, 0, 30) if m.ext_id != nil { fields = append(fields, vod.FieldExtID) } @@ -10351,6 +10751,12 @@ func (m *VodMutation) Fields() []string { if m.chat_path != nil { fields = append(fields, vod.FieldChatPath) } + if m.live_chat_path != nil { + fields = append(fields, vod.FieldLiveChatPath) + } + if m.live_chat_convert_path != nil { + fields = append(fields, vod.FieldLiveChatConvertPath) + } if m.chat_video_path != nil { fields = append(fields, vod.FieldChatVideoPath) } @@ -10366,6 +10772,24 @@ func (m *VodMutation) Fields() []string { if m.file_name != nil { fields = append(fields, vod.FieldFileName) } + if m.tmp_video_download_path != nil { + fields = append(fields, vod.FieldTmpVideoDownloadPath) + } + if m.tmp_video_convert_path != nil { + fields = append(fields, vod.FieldTmpVideoConvertPath) + } + if m.tmp_chat_download_path != nil { + fields = append(fields, vod.FieldTmpChatDownloadPath) + } + if m.tmp_live_chat_download_path != nil { + fields = append(fields, vod.FieldTmpLiveChatDownloadPath) + } + if m.tmp_live_chat_convert_path != nil { + fields = append(fields, vod.FieldTmpLiveChatConvertPath) + } + if m.tmp_chat_render_path != nil { + fields = append(fields, vod.FieldTmpChatRenderPath) + } if m.locked != nil { fields = append(fields, vod.FieldLocked) } @@ -10413,6 +10837,10 @@ func (m *VodMutation) Field(name string) (ent.Value, bool) { return m.VideoPath() case vod.FieldChatPath: return m.ChatPath() + case vod.FieldLiveChatPath: + return m.LiveChatPath() + case vod.FieldLiveChatConvertPath: + return m.LiveChatConvertPath() case vod.FieldChatVideoPath: return m.ChatVideoPath() case vod.FieldInfoPath: @@ -10423,6 +10851,18 @@ func (m *VodMutation) Field(name string) (ent.Value, bool) { return m.FolderName() case vod.FieldFileName: return m.FileName() + case vod.FieldTmpVideoDownloadPath: + return m.TmpVideoDownloadPath() + case vod.FieldTmpVideoConvertPath: + return m.TmpVideoConvertPath() + case vod.FieldTmpChatDownloadPath: + return m.TmpChatDownloadPath() + case vod.FieldTmpLiveChatDownloadPath: + return m.TmpLiveChatDownloadPath() + case vod.FieldTmpLiveChatConvertPath: + return m.TmpLiveChatConvertPath() + case vod.FieldTmpChatRenderPath: + return m.TmpChatRenderPath() case vod.FieldLocked: return m.Locked() case vod.FieldLocalViews: @@ -10466,6 +10906,10 @@ func (m *VodMutation) OldField(ctx context.Context, name string) (ent.Value, err return m.OldVideoPath(ctx) case vod.FieldChatPath: return m.OldChatPath(ctx) + case vod.FieldLiveChatPath: + return m.OldLiveChatPath(ctx) + case vod.FieldLiveChatConvertPath: + return m.OldLiveChatConvertPath(ctx) case vod.FieldChatVideoPath: return m.OldChatVideoPath(ctx) case vod.FieldInfoPath: @@ -10476,6 +10920,18 @@ func (m *VodMutation) OldField(ctx context.Context, name string) (ent.Value, err return m.OldFolderName(ctx) case vod.FieldFileName: return m.OldFileName(ctx) + case vod.FieldTmpVideoDownloadPath: + return m.OldTmpVideoDownloadPath(ctx) + case vod.FieldTmpVideoConvertPath: + return m.OldTmpVideoConvertPath(ctx) + case vod.FieldTmpChatDownloadPath: + return m.OldTmpChatDownloadPath(ctx) + case vod.FieldTmpLiveChatDownloadPath: + return m.OldTmpLiveChatDownloadPath(ctx) + case vod.FieldTmpLiveChatConvertPath: + return m.OldTmpLiveChatConvertPath(ctx) + case vod.FieldTmpChatRenderPath: + return m.OldTmpChatRenderPath(ctx) case vod.FieldLocked: return m.OldLocked(ctx) case vod.FieldLocalViews: @@ -10579,6 +11035,20 @@ func (m *VodMutation) SetField(name string, value ent.Value) error { } m.SetChatPath(v) return nil + case vod.FieldLiveChatPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLiveChatPath(v) + return nil + case vod.FieldLiveChatConvertPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetLiveChatConvertPath(v) + return nil case vod.FieldChatVideoPath: v, ok := value.(string) if !ok { @@ -10614,6 +11084,48 @@ func (m *VodMutation) SetField(name string, value ent.Value) error { } m.SetFileName(v) return nil + case vod.FieldTmpVideoDownloadPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpVideoDownloadPath(v) + return nil + case vod.FieldTmpVideoConvertPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpVideoConvertPath(v) + return nil + case vod.FieldTmpChatDownloadPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpChatDownloadPath(v) + return nil + case vod.FieldTmpLiveChatDownloadPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpLiveChatDownloadPath(v) + return nil + case vod.FieldTmpLiveChatConvertPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpLiveChatConvertPath(v) + return nil + case vod.FieldTmpChatRenderPath: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTmpChatRenderPath(v) + return nil case vod.FieldLocked: v, ok := value.(bool) if !ok { @@ -10727,6 +11239,12 @@ func (m *VodMutation) ClearedFields() []string { if m.FieldCleared(vod.FieldChatPath) { fields = append(fields, vod.FieldChatPath) } + if m.FieldCleared(vod.FieldLiveChatPath) { + fields = append(fields, vod.FieldLiveChatPath) + } + if m.FieldCleared(vod.FieldLiveChatConvertPath) { + fields = append(fields, vod.FieldLiveChatConvertPath) + } if m.FieldCleared(vod.FieldChatVideoPath) { fields = append(fields, vod.FieldChatVideoPath) } @@ -10742,6 +11260,24 @@ func (m *VodMutation) ClearedFields() []string { if m.FieldCleared(vod.FieldFileName) { fields = append(fields, vod.FieldFileName) } + if m.FieldCleared(vod.FieldTmpVideoDownloadPath) { + fields = append(fields, vod.FieldTmpVideoDownloadPath) + } + if m.FieldCleared(vod.FieldTmpVideoConvertPath) { + fields = append(fields, vod.FieldTmpVideoConvertPath) + } + if m.FieldCleared(vod.FieldTmpChatDownloadPath) { + fields = append(fields, vod.FieldTmpChatDownloadPath) + } + if m.FieldCleared(vod.FieldTmpLiveChatDownloadPath) { + fields = append(fields, vod.FieldTmpLiveChatDownloadPath) + } + if m.FieldCleared(vod.FieldTmpLiveChatConvertPath) { + fields = append(fields, vod.FieldTmpLiveChatConvertPath) + } + if m.FieldCleared(vod.FieldTmpChatRenderPath) { + fields = append(fields, vod.FieldTmpChatRenderPath) + } return fields } @@ -10765,6 +11301,12 @@ func (m *VodMutation) ClearField(name string) error { case vod.FieldChatPath: m.ClearChatPath() return nil + case vod.FieldLiveChatPath: + m.ClearLiveChatPath() + return nil + case vod.FieldLiveChatConvertPath: + m.ClearLiveChatConvertPath() + return nil case vod.FieldChatVideoPath: m.ClearChatVideoPath() return nil @@ -10780,6 +11322,24 @@ func (m *VodMutation) ClearField(name string) error { case vod.FieldFileName: m.ClearFileName() return nil + case vod.FieldTmpVideoDownloadPath: + m.ClearTmpVideoDownloadPath() + return nil + case vod.FieldTmpVideoConvertPath: + m.ClearTmpVideoConvertPath() + return nil + case vod.FieldTmpChatDownloadPath: + m.ClearTmpChatDownloadPath() + return nil + case vod.FieldTmpLiveChatDownloadPath: + m.ClearTmpLiveChatDownloadPath() + return nil + case vod.FieldTmpLiveChatConvertPath: + m.ClearTmpLiveChatConvertPath() + return nil + case vod.FieldTmpChatRenderPath: + m.ClearTmpChatRenderPath() + return nil } return fmt.Errorf("unknown Vod nullable field %s", name) } @@ -10824,6 +11384,12 @@ func (m *VodMutation) ResetField(name string) error { case vod.FieldChatPath: m.ResetChatPath() return nil + case vod.FieldLiveChatPath: + m.ResetLiveChatPath() + return nil + case vod.FieldLiveChatConvertPath: + m.ResetLiveChatConvertPath() + return nil case vod.FieldChatVideoPath: m.ResetChatVideoPath() return nil @@ -10839,6 +11405,24 @@ func (m *VodMutation) ResetField(name string) error { case vod.FieldFileName: m.ResetFileName() return nil + case vod.FieldTmpVideoDownloadPath: + m.ResetTmpVideoDownloadPath() + return nil + case vod.FieldTmpVideoConvertPath: + m.ResetTmpVideoConvertPath() + return nil + case vod.FieldTmpChatDownloadPath: + m.ResetTmpChatDownloadPath() + return nil + case vod.FieldTmpLiveChatDownloadPath: + m.ResetTmpLiveChatDownloadPath() + return nil + case vod.FieldTmpLiveChatConvertPath: + m.ResetTmpLiveChatConvertPath() + return nil + case vod.FieldTmpChatRenderPath: + m.ResetTmpChatRenderPath() + return nil case vod.FieldLocked: m.ResetLocked() return nil diff --git a/ent/mutedsegment.go b/ent/mutedsegment.go index ad58a1d3..bc444a55 100644 --- a/ent/mutedsegment.go +++ b/ent/mutedsegment.go @@ -41,12 +41,10 @@ type MutedSegmentEdges struct { // VodOrErr returns the Vod value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e MutedSegmentEdges) VodOrErr() (*Vod, error) { - if e.loadedTypes[0] { - if e.Vod == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: vod.Label} - } + if e.Vod != nil { return e.Vod, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: vod.Label} } return nil, &NotLoadedError{edge: "vod"} } diff --git a/ent/queue.go b/ent/queue.go index ebfe7cbc..baa8dfd7 100644 --- a/ent/queue.go +++ b/ent/queue.go @@ -81,12 +81,10 @@ type QueueEdges struct { // VodOrErr returns the Vod value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e QueueEdges) VodOrErr() (*Vod, error) { - if e.loadedTypes[0] { - if e.Vod == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: vod.Label} - } + if e.Vod != nil { return e.Vod, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: vod.Label} } return nil, &NotLoadedError{edge: "vod"} } diff --git a/ent/runtime.go b/ent/runtime.go index 5fc658ed..36df7b30 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -264,25 +264,25 @@ func init() { // vod.DefaultProcessing holds the default value on creation for the processing field. vod.DefaultProcessing = vodDescProcessing.Default.(bool) // vodDescLocked is the schema descriptor for locked field. - vodDescLocked := vodFields[18].Descriptor() + vodDescLocked := vodFields[26].Descriptor() // vod.DefaultLocked holds the default value on creation for the locked field. vod.DefaultLocked = vodDescLocked.Default.(bool) // vodDescLocalViews is the schema descriptor for local_views field. - vodDescLocalViews := vodFields[19].Descriptor() + vodDescLocalViews := vodFields[27].Descriptor() // vod.DefaultLocalViews holds the default value on creation for the local_views field. vod.DefaultLocalViews = vodDescLocalViews.Default.(int) // vodDescStreamedAt is the schema descriptor for streamed_at field. - vodDescStreamedAt := vodFields[20].Descriptor() + vodDescStreamedAt := vodFields[28].Descriptor() // vod.DefaultStreamedAt holds the default value on creation for the streamed_at field. vod.DefaultStreamedAt = vodDescStreamedAt.Default.(func() time.Time) // vodDescUpdatedAt is the schema descriptor for updated_at field. - vodDescUpdatedAt := vodFields[21].Descriptor() + vodDescUpdatedAt := vodFields[29].Descriptor() // vod.DefaultUpdatedAt holds the default value on creation for the updated_at field. vod.DefaultUpdatedAt = vodDescUpdatedAt.Default.(func() time.Time) // vod.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. vod.UpdateDefaultUpdatedAt = vodDescUpdatedAt.UpdateDefault.(func() time.Time) // vodDescCreatedAt is the schema descriptor for created_at field. - vodDescCreatedAt := vodFields[22].Descriptor() + vodDescCreatedAt := vodFields[30].Descriptor() // vod.DefaultCreatedAt holds the default value on creation for the created_at field. vod.DefaultCreatedAt = vodDescCreatedAt.Default.(func() time.Time) // vodDescID is the schema descriptor for id field. diff --git a/ent/runtime/runtime.go b/ent/runtime/runtime.go index bc1255e9..36ec57d5 100644 --- a/ent/runtime/runtime.go +++ b/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/zibbp/ganymede/ent/runtime.go const ( - Version = "v0.12.5" // Version of ent codegen. - Sum = "h1:KREM5E4CSoej4zeGa88Ou/gfturAnpUv0mzAjch1sj4=" // Sum of ent codegen. + Version = "v0.13.1" // Version of ent codegen. + Sum = "h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=" // Sum of ent codegen. ) diff --git a/ent/schema/vod.go b/ent/schema/vod.go index 8cf4049c..022ceabb 100644 --- a/ent/schema/vod.go +++ b/ent/schema/vod.go @@ -31,11 +31,19 @@ func (Vod) Fields() []ent.Field { field.String("web_thumbnail_path"), field.String("video_path"), field.String("chat_path").Optional(), + field.String("live_chat_path").Optional().Comment("Path to the raw live chat file"), + field.String("live_chat_convert_path").Optional().Comment("Path to the converted live chat file"), field.String("chat_video_path").Optional(), field.String("info_path").Optional(), field.String("caption_path").Optional(), field.String("folder_name").Optional(), field.String("file_name").Optional(), + field.String("tmp_video_download_path").Optional().Comment("The path where the video is downloaded to"), + field.String("tmp_video_convert_path").Optional().Comment("The path where the converted video is"), + field.String("tmp_chat_download_path").Optional().Comment("The path where the chat is downloaded to"), + field.String("tmp_live_chat_download_path").Optional().Comment("The path where the converted chat is"), + field.String("tmp_live_chat_convert_path").Optional().Comment("The path where the converted chat is"), + field.String("tmp_chat_render_path").Optional().Comment("The path where the rendered chat is"), field.Bool("locked").Default(false), field.Int("local_views").Default(0), field.Time("streamed_at").Default(time.Now).Comment("The time the VOD was streamed."), diff --git a/ent/vod.go b/ent/vod.go index c75909cd..5d810c75 100644 --- a/ent/vod.go +++ b/ent/vod.go @@ -45,6 +45,10 @@ type Vod struct { VideoPath string `json:"video_path,omitempty"` // ChatPath holds the value of the "chat_path" field. ChatPath string `json:"chat_path,omitempty"` + // Path to the raw live chat file + LiveChatPath string `json:"live_chat_path,omitempty"` + // Path to the converted live chat file + LiveChatConvertPath string `json:"live_chat_convert_path,omitempty"` // ChatVideoPath holds the value of the "chat_video_path" field. ChatVideoPath string `json:"chat_video_path,omitempty"` // InfoPath holds the value of the "info_path" field. @@ -55,6 +59,18 @@ type Vod struct { FolderName string `json:"folder_name,omitempty"` // FileName holds the value of the "file_name" field. FileName string `json:"file_name,omitempty"` + // The path where the video is downloaded to + TmpVideoDownloadPath string `json:"tmp_video_download_path,omitempty"` + // The path where the converted video is + TmpVideoConvertPath string `json:"tmp_video_convert_path,omitempty"` + // The path where the chat is downloaded to + TmpChatDownloadPath string `json:"tmp_chat_download_path,omitempty"` + // The path where the converted chat is + TmpLiveChatDownloadPath string `json:"tmp_live_chat_download_path,omitempty"` + // The path where the converted chat is + TmpLiveChatConvertPath string `json:"tmp_live_chat_convert_path,omitempty"` + // The path where the rendered chat is + TmpChatRenderPath string `json:"tmp_chat_render_path,omitempty"` // Locked holds the value of the "locked" field. Locked bool `json:"locked,omitempty"` // LocalViews holds the value of the "local_views" field. @@ -92,12 +108,10 @@ type VodEdges struct { // ChannelOrErr returns the Channel value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e VodEdges) ChannelOrErr() (*Channel, error) { - if e.loadedTypes[0] { - if e.Channel == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: channel.Label} - } + if e.Channel != nil { return e.Channel, nil + } else if e.loadedTypes[0] { + return nil, &NotFoundError{label: channel.Label} } return nil, &NotLoadedError{edge: "channel"} } @@ -105,12 +119,10 @@ func (e VodEdges) ChannelOrErr() (*Channel, error) { // QueueOrErr returns the Queue value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e VodEdges) QueueOrErr() (*Queue, error) { - if e.loadedTypes[1] { - if e.Queue == nil { - // Edge was loaded but was not found. - return nil, &NotFoundError{label: queue.Label} - } + if e.Queue != nil { return e.Queue, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: queue.Label} } return nil, &NotLoadedError{edge: "queue"} } @@ -151,7 +163,7 @@ func (*Vod) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullBool) case vod.FieldDuration, vod.FieldViews, vod.FieldLocalViews: values[i] = new(sql.NullInt64) - case vod.FieldExtID, vod.FieldPlatform, vod.FieldType, vod.FieldTitle, vod.FieldResolution, vod.FieldThumbnailPath, vod.FieldWebThumbnailPath, vod.FieldVideoPath, vod.FieldChatPath, vod.FieldChatVideoPath, vod.FieldInfoPath, vod.FieldCaptionPath, vod.FieldFolderName, vod.FieldFileName: + case vod.FieldExtID, vod.FieldPlatform, vod.FieldType, vod.FieldTitle, vod.FieldResolution, vod.FieldThumbnailPath, vod.FieldWebThumbnailPath, vod.FieldVideoPath, vod.FieldChatPath, vod.FieldLiveChatPath, vod.FieldLiveChatConvertPath, vod.FieldChatVideoPath, vod.FieldInfoPath, vod.FieldCaptionPath, vod.FieldFolderName, vod.FieldFileName, vod.FieldTmpVideoDownloadPath, vod.FieldTmpVideoConvertPath, vod.FieldTmpChatDownloadPath, vod.FieldTmpLiveChatDownloadPath, vod.FieldTmpLiveChatConvertPath, vod.FieldTmpChatRenderPath: values[i] = new(sql.NullString) case vod.FieldStreamedAt, vod.FieldUpdatedAt, vod.FieldCreatedAt: values[i] = new(sql.NullTime) @@ -252,6 +264,18 @@ func (v *Vod) assignValues(columns []string, values []any) error { } else if value.Valid { v.ChatPath = value.String } + case vod.FieldLiveChatPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field live_chat_path", values[i]) + } else if value.Valid { + v.LiveChatPath = value.String + } + case vod.FieldLiveChatConvertPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field live_chat_convert_path", values[i]) + } else if value.Valid { + v.LiveChatConvertPath = value.String + } case vod.FieldChatVideoPath: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field chat_video_path", values[i]) @@ -282,6 +306,42 @@ func (v *Vod) assignValues(columns []string, values []any) error { } else if value.Valid { v.FileName = value.String } + case vod.FieldTmpVideoDownloadPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_video_download_path", values[i]) + } else if value.Valid { + v.TmpVideoDownloadPath = value.String + } + case vod.FieldTmpVideoConvertPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_video_convert_path", values[i]) + } else if value.Valid { + v.TmpVideoConvertPath = value.String + } + case vod.FieldTmpChatDownloadPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_chat_download_path", values[i]) + } else if value.Valid { + v.TmpChatDownloadPath = value.String + } + case vod.FieldTmpLiveChatDownloadPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_live_chat_download_path", values[i]) + } else if value.Valid { + v.TmpLiveChatDownloadPath = value.String + } + case vod.FieldTmpLiveChatConvertPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_live_chat_convert_path", values[i]) + } else if value.Valid { + v.TmpLiveChatConvertPath = value.String + } + case vod.FieldTmpChatRenderPath: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tmp_chat_render_path", values[i]) + } else if value.Valid { + v.TmpChatRenderPath = value.String + } case vod.FieldLocked: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field locked", values[i]) @@ -416,6 +476,12 @@ func (v *Vod) String() string { builder.WriteString("chat_path=") builder.WriteString(v.ChatPath) builder.WriteString(", ") + builder.WriteString("live_chat_path=") + builder.WriteString(v.LiveChatPath) + builder.WriteString(", ") + builder.WriteString("live_chat_convert_path=") + builder.WriteString(v.LiveChatConvertPath) + builder.WriteString(", ") builder.WriteString("chat_video_path=") builder.WriteString(v.ChatVideoPath) builder.WriteString(", ") @@ -431,6 +497,24 @@ func (v *Vod) String() string { builder.WriteString("file_name=") builder.WriteString(v.FileName) builder.WriteString(", ") + builder.WriteString("tmp_video_download_path=") + builder.WriteString(v.TmpVideoDownloadPath) + builder.WriteString(", ") + builder.WriteString("tmp_video_convert_path=") + builder.WriteString(v.TmpVideoConvertPath) + builder.WriteString(", ") + builder.WriteString("tmp_chat_download_path=") + builder.WriteString(v.TmpChatDownloadPath) + builder.WriteString(", ") + builder.WriteString("tmp_live_chat_download_path=") + builder.WriteString(v.TmpLiveChatDownloadPath) + builder.WriteString(", ") + builder.WriteString("tmp_live_chat_convert_path=") + builder.WriteString(v.TmpLiveChatConvertPath) + builder.WriteString(", ") + builder.WriteString("tmp_chat_render_path=") + builder.WriteString(v.TmpChatRenderPath) + builder.WriteString(", ") builder.WriteString("locked=") builder.WriteString(fmt.Sprintf("%v", v.Locked)) builder.WriteString(", ") diff --git a/ent/vod/vod.go b/ent/vod/vod.go index 68eb9c8a..52229e4d 100644 --- a/ent/vod/vod.go +++ b/ent/vod/vod.go @@ -41,6 +41,10 @@ const ( FieldVideoPath = "video_path" // FieldChatPath holds the string denoting the chat_path field in the database. FieldChatPath = "chat_path" + // FieldLiveChatPath holds the string denoting the live_chat_path field in the database. + FieldLiveChatPath = "live_chat_path" + // FieldLiveChatConvertPath holds the string denoting the live_chat_convert_path field in the database. + FieldLiveChatConvertPath = "live_chat_convert_path" // FieldChatVideoPath holds the string denoting the chat_video_path field in the database. FieldChatVideoPath = "chat_video_path" // FieldInfoPath holds the string denoting the info_path field in the database. @@ -51,6 +55,18 @@ const ( FieldFolderName = "folder_name" // FieldFileName holds the string denoting the file_name field in the database. FieldFileName = "file_name" + // FieldTmpVideoDownloadPath holds the string denoting the tmp_video_download_path field in the database. + FieldTmpVideoDownloadPath = "tmp_video_download_path" + // FieldTmpVideoConvertPath holds the string denoting the tmp_video_convert_path field in the database. + FieldTmpVideoConvertPath = "tmp_video_convert_path" + // FieldTmpChatDownloadPath holds the string denoting the tmp_chat_download_path field in the database. + FieldTmpChatDownloadPath = "tmp_chat_download_path" + // FieldTmpLiveChatDownloadPath holds the string denoting the tmp_live_chat_download_path field in the database. + FieldTmpLiveChatDownloadPath = "tmp_live_chat_download_path" + // FieldTmpLiveChatConvertPath holds the string denoting the tmp_live_chat_convert_path field in the database. + FieldTmpLiveChatConvertPath = "tmp_live_chat_convert_path" + // FieldTmpChatRenderPath holds the string denoting the tmp_chat_render_path field in the database. + FieldTmpChatRenderPath = "tmp_chat_render_path" // FieldLocked holds the string denoting the locked field in the database. FieldLocked = "locked" // FieldLocalViews holds the string denoting the local_views field in the database. @@ -123,11 +139,19 @@ var Columns = []string{ FieldWebThumbnailPath, FieldVideoPath, FieldChatPath, + FieldLiveChatPath, + FieldLiveChatConvertPath, FieldChatVideoPath, FieldInfoPath, FieldCaptionPath, FieldFolderName, FieldFileName, + FieldTmpVideoDownloadPath, + FieldTmpVideoConvertPath, + FieldTmpChatDownloadPath, + FieldTmpLiveChatDownloadPath, + FieldTmpLiveChatConvertPath, + FieldTmpChatRenderPath, FieldLocked, FieldLocalViews, FieldStreamedAt, @@ -277,6 +301,16 @@ func ByChatPath(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldChatPath, opts...).ToFunc() } +// ByLiveChatPath orders the results by the live_chat_path field. +func ByLiveChatPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLiveChatPath, opts...).ToFunc() +} + +// ByLiveChatConvertPath orders the results by the live_chat_convert_path field. +func ByLiveChatConvertPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLiveChatConvertPath, opts...).ToFunc() +} + // ByChatVideoPath orders the results by the chat_video_path field. func ByChatVideoPath(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldChatVideoPath, opts...).ToFunc() @@ -302,6 +336,36 @@ func ByFileName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFileName, opts...).ToFunc() } +// ByTmpVideoDownloadPath orders the results by the tmp_video_download_path field. +func ByTmpVideoDownloadPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpVideoDownloadPath, opts...).ToFunc() +} + +// ByTmpVideoConvertPath orders the results by the tmp_video_convert_path field. +func ByTmpVideoConvertPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpVideoConvertPath, opts...).ToFunc() +} + +// ByTmpChatDownloadPath orders the results by the tmp_chat_download_path field. +func ByTmpChatDownloadPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpChatDownloadPath, opts...).ToFunc() +} + +// ByTmpLiveChatDownloadPath orders the results by the tmp_live_chat_download_path field. +func ByTmpLiveChatDownloadPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpLiveChatDownloadPath, opts...).ToFunc() +} + +// ByTmpLiveChatConvertPath orders the results by the tmp_live_chat_convert_path field. +func ByTmpLiveChatConvertPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpLiveChatConvertPath, opts...).ToFunc() +} + +// ByTmpChatRenderPath orders the results by the tmp_chat_render_path field. +func ByTmpChatRenderPath(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTmpChatRenderPath, opts...).ToFunc() +} + // ByLocked orders the results by the locked field. func ByLocked(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLocked, opts...).ToFunc() diff --git a/ent/vod/where.go b/ent/vod/where.go index 6219b034..29dd785e 100644 --- a/ent/vod/where.go +++ b/ent/vod/where.go @@ -107,6 +107,16 @@ func ChatPath(v string) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldChatPath, v)) } +// LiveChatPath applies equality check predicate on the "live_chat_path" field. It's identical to LiveChatPathEQ. +func LiveChatPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldLiveChatPath, v)) +} + +// LiveChatConvertPath applies equality check predicate on the "live_chat_convert_path" field. It's identical to LiveChatConvertPathEQ. +func LiveChatConvertPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldLiveChatConvertPath, v)) +} + // ChatVideoPath applies equality check predicate on the "chat_video_path" field. It's identical to ChatVideoPathEQ. func ChatVideoPath(v string) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldChatVideoPath, v)) @@ -132,6 +142,36 @@ func FileName(v string) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldFileName, v)) } +// TmpVideoDownloadPath applies equality check predicate on the "tmp_video_download_path" field. It's identical to TmpVideoDownloadPathEQ. +func TmpVideoDownloadPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoConvertPath applies equality check predicate on the "tmp_video_convert_path" field. It's identical to TmpVideoConvertPathEQ. +func TmpVideoConvertPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpVideoConvertPath, v)) +} + +// TmpChatDownloadPath applies equality check predicate on the "tmp_chat_download_path" field. It's identical to TmpChatDownloadPathEQ. +func TmpChatDownloadPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPath applies equality check predicate on the "tmp_live_chat_download_path" field. It's identical to TmpLiveChatDownloadPathEQ. +func TmpLiveChatDownloadPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatConvertPath applies equality check predicate on the "tmp_live_chat_convert_path" field. It's identical to TmpLiveChatConvertPathEQ. +func TmpLiveChatConvertPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpLiveChatConvertPath, v)) +} + +// TmpChatRenderPath applies equality check predicate on the "tmp_chat_render_path" field. It's identical to TmpChatRenderPathEQ. +func TmpChatRenderPath(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpChatRenderPath, v)) +} + // Locked applies equality check predicate on the "locked" field. It's identical to LockedEQ. func Locked(v bool) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldLocked, v)) @@ -792,6 +832,156 @@ func ChatPathContainsFold(v string) predicate.Vod { return predicate.Vod(sql.FieldContainsFold(FieldChatPath, v)) } +// LiveChatPathEQ applies the EQ predicate on the "live_chat_path" field. +func LiveChatPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldLiveChatPath, v)) +} + +// LiveChatPathNEQ applies the NEQ predicate on the "live_chat_path" field. +func LiveChatPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldLiveChatPath, v)) +} + +// LiveChatPathIn applies the In predicate on the "live_chat_path" field. +func LiveChatPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldLiveChatPath, vs...)) +} + +// LiveChatPathNotIn applies the NotIn predicate on the "live_chat_path" field. +func LiveChatPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldLiveChatPath, vs...)) +} + +// LiveChatPathGT applies the GT predicate on the "live_chat_path" field. +func LiveChatPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldLiveChatPath, v)) +} + +// LiveChatPathGTE applies the GTE predicate on the "live_chat_path" field. +func LiveChatPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldLiveChatPath, v)) +} + +// LiveChatPathLT applies the LT predicate on the "live_chat_path" field. +func LiveChatPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldLiveChatPath, v)) +} + +// LiveChatPathLTE applies the LTE predicate on the "live_chat_path" field. +func LiveChatPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldLiveChatPath, v)) +} + +// LiveChatPathContains applies the Contains predicate on the "live_chat_path" field. +func LiveChatPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldLiveChatPath, v)) +} + +// LiveChatPathHasPrefix applies the HasPrefix predicate on the "live_chat_path" field. +func LiveChatPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldLiveChatPath, v)) +} + +// LiveChatPathHasSuffix applies the HasSuffix predicate on the "live_chat_path" field. +func LiveChatPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldLiveChatPath, v)) +} + +// LiveChatPathIsNil applies the IsNil predicate on the "live_chat_path" field. +func LiveChatPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldLiveChatPath)) +} + +// LiveChatPathNotNil applies the NotNil predicate on the "live_chat_path" field. +func LiveChatPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldLiveChatPath)) +} + +// LiveChatPathEqualFold applies the EqualFold predicate on the "live_chat_path" field. +func LiveChatPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldLiveChatPath, v)) +} + +// LiveChatPathContainsFold applies the ContainsFold predicate on the "live_chat_path" field. +func LiveChatPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldLiveChatPath, v)) +} + +// LiveChatConvertPathEQ applies the EQ predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathNEQ applies the NEQ predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathIn applies the In predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldLiveChatConvertPath, vs...)) +} + +// LiveChatConvertPathNotIn applies the NotIn predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldLiveChatConvertPath, vs...)) +} + +// LiveChatConvertPathGT applies the GT predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathGTE applies the GTE predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathLT applies the LT predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathLTE applies the LTE predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathContains applies the Contains predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathHasPrefix applies the HasPrefix predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathHasSuffix applies the HasSuffix predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathIsNil applies the IsNil predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldLiveChatConvertPath)) +} + +// LiveChatConvertPathNotNil applies the NotNil predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldLiveChatConvertPath)) +} + +// LiveChatConvertPathEqualFold applies the EqualFold predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldLiveChatConvertPath, v)) +} + +// LiveChatConvertPathContainsFold applies the ContainsFold predicate on the "live_chat_convert_path" field. +func LiveChatConvertPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldLiveChatConvertPath, v)) +} + // ChatVideoPathEQ applies the EQ predicate on the "chat_video_path" field. func ChatVideoPathEQ(v string) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldChatVideoPath, v)) @@ -1167,6 +1357,456 @@ func FileNameContainsFold(v string) predicate.Vod { return predicate.Vod(sql.FieldContainsFold(FieldFileName, v)) } +// TmpVideoDownloadPathEQ applies the EQ predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathNEQ applies the NEQ predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathIn applies the In predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpVideoDownloadPath, vs...)) +} + +// TmpVideoDownloadPathNotIn applies the NotIn predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpVideoDownloadPath, vs...)) +} + +// TmpVideoDownloadPathGT applies the GT predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathGTE applies the GTE predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathLT applies the LT predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathLTE applies the LTE predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathContains applies the Contains predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathHasPrefix applies the HasPrefix predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathHasSuffix applies the HasSuffix predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathIsNil applies the IsNil predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpVideoDownloadPath)) +} + +// TmpVideoDownloadPathNotNil applies the NotNil predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpVideoDownloadPath)) +} + +// TmpVideoDownloadPathEqualFold applies the EqualFold predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoDownloadPathContainsFold applies the ContainsFold predicate on the "tmp_video_download_path" field. +func TmpVideoDownloadPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpVideoDownloadPath, v)) +} + +// TmpVideoConvertPathEQ applies the EQ predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathNEQ applies the NEQ predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathIn applies the In predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpVideoConvertPath, vs...)) +} + +// TmpVideoConvertPathNotIn applies the NotIn predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpVideoConvertPath, vs...)) +} + +// TmpVideoConvertPathGT applies the GT predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathGTE applies the GTE predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathLT applies the LT predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathLTE applies the LTE predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathContains applies the Contains predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathHasPrefix applies the HasPrefix predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathHasSuffix applies the HasSuffix predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathIsNil applies the IsNil predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpVideoConvertPath)) +} + +// TmpVideoConvertPathNotNil applies the NotNil predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpVideoConvertPath)) +} + +// TmpVideoConvertPathEqualFold applies the EqualFold predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpVideoConvertPath, v)) +} + +// TmpVideoConvertPathContainsFold applies the ContainsFold predicate on the "tmp_video_convert_path" field. +func TmpVideoConvertPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpVideoConvertPath, v)) +} + +// TmpChatDownloadPathEQ applies the EQ predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathNEQ applies the NEQ predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathIn applies the In predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpChatDownloadPath, vs...)) +} + +// TmpChatDownloadPathNotIn applies the NotIn predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpChatDownloadPath, vs...)) +} + +// TmpChatDownloadPathGT applies the GT predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathGTE applies the GTE predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathLT applies the LT predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathLTE applies the LTE predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathContains applies the Contains predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathHasPrefix applies the HasPrefix predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathHasSuffix applies the HasSuffix predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathIsNil applies the IsNil predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpChatDownloadPath)) +} + +// TmpChatDownloadPathNotNil applies the NotNil predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpChatDownloadPath)) +} + +// TmpChatDownloadPathEqualFold applies the EqualFold predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpChatDownloadPath, v)) +} + +// TmpChatDownloadPathContainsFold applies the ContainsFold predicate on the "tmp_chat_download_path" field. +func TmpChatDownloadPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathEQ applies the EQ predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathNEQ applies the NEQ predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathIn applies the In predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpLiveChatDownloadPath, vs...)) +} + +// TmpLiveChatDownloadPathNotIn applies the NotIn predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpLiveChatDownloadPath, vs...)) +} + +// TmpLiveChatDownloadPathGT applies the GT predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathGTE applies the GTE predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathLT applies the LT predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathLTE applies the LTE predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathContains applies the Contains predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathHasPrefix applies the HasPrefix predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathHasSuffix applies the HasSuffix predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathIsNil applies the IsNil predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpLiveChatDownloadPath)) +} + +// TmpLiveChatDownloadPathNotNil applies the NotNil predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpLiveChatDownloadPath)) +} + +// TmpLiveChatDownloadPathEqualFold applies the EqualFold predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatDownloadPathContainsFold applies the ContainsFold predicate on the "tmp_live_chat_download_path" field. +func TmpLiveChatDownloadPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpLiveChatDownloadPath, v)) +} + +// TmpLiveChatConvertPathEQ applies the EQ predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathNEQ applies the NEQ predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathIn applies the In predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpLiveChatConvertPath, vs...)) +} + +// TmpLiveChatConvertPathNotIn applies the NotIn predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpLiveChatConvertPath, vs...)) +} + +// TmpLiveChatConvertPathGT applies the GT predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathGTE applies the GTE predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathLT applies the LT predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathLTE applies the LTE predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathContains applies the Contains predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathHasPrefix applies the HasPrefix predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathHasSuffix applies the HasSuffix predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathIsNil applies the IsNil predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpLiveChatConvertPath)) +} + +// TmpLiveChatConvertPathNotNil applies the NotNil predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpLiveChatConvertPath)) +} + +// TmpLiveChatConvertPathEqualFold applies the EqualFold predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpLiveChatConvertPath, v)) +} + +// TmpLiveChatConvertPathContainsFold applies the ContainsFold predicate on the "tmp_live_chat_convert_path" field. +func TmpLiveChatConvertPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpLiveChatConvertPath, v)) +} + +// TmpChatRenderPathEQ applies the EQ predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldEQ(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathNEQ applies the NEQ predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathNEQ(v string) predicate.Vod { + return predicate.Vod(sql.FieldNEQ(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathIn applies the In predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldIn(FieldTmpChatRenderPath, vs...)) +} + +// TmpChatRenderPathNotIn applies the NotIn predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathNotIn(vs ...string) predicate.Vod { + return predicate.Vod(sql.FieldNotIn(FieldTmpChatRenderPath, vs...)) +} + +// TmpChatRenderPathGT applies the GT predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathGT(v string) predicate.Vod { + return predicate.Vod(sql.FieldGT(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathGTE applies the GTE predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathGTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldGTE(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathLT applies the LT predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathLT(v string) predicate.Vod { + return predicate.Vod(sql.FieldLT(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathLTE applies the LTE predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathLTE(v string) predicate.Vod { + return predicate.Vod(sql.FieldLTE(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathContains applies the Contains predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathContains(v string) predicate.Vod { + return predicate.Vod(sql.FieldContains(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathHasPrefix applies the HasPrefix predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathHasPrefix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasPrefix(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathHasSuffix applies the HasSuffix predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathHasSuffix(v string) predicate.Vod { + return predicate.Vod(sql.FieldHasSuffix(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathIsNil applies the IsNil predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathIsNil() predicate.Vod { + return predicate.Vod(sql.FieldIsNull(FieldTmpChatRenderPath)) +} + +// TmpChatRenderPathNotNil applies the NotNil predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathNotNil() predicate.Vod { + return predicate.Vod(sql.FieldNotNull(FieldTmpChatRenderPath)) +} + +// TmpChatRenderPathEqualFold applies the EqualFold predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathEqualFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldEqualFold(FieldTmpChatRenderPath, v)) +} + +// TmpChatRenderPathContainsFold applies the ContainsFold predicate on the "tmp_chat_render_path" field. +func TmpChatRenderPathContainsFold(v string) predicate.Vod { + return predicate.Vod(sql.FieldContainsFold(FieldTmpChatRenderPath, v)) +} + // LockedEQ applies the EQ predicate on the "locked" field. func LockedEQ(v bool) predicate.Vod { return predicate.Vod(sql.FieldEQ(FieldLocked, v)) diff --git a/ent/vod_create.go b/ent/vod_create.go index 3d3aeb66..114e8359 100644 --- a/ent/vod_create.go +++ b/ent/vod_create.go @@ -166,6 +166,34 @@ func (vc *VodCreate) SetNillableChatPath(s *string) *VodCreate { return vc } +// SetLiveChatPath sets the "live_chat_path" field. +func (vc *VodCreate) SetLiveChatPath(s string) *VodCreate { + vc.mutation.SetLiveChatPath(s) + return vc +} + +// SetNillableLiveChatPath sets the "live_chat_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableLiveChatPath(s *string) *VodCreate { + if s != nil { + vc.SetLiveChatPath(*s) + } + return vc +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (vc *VodCreate) SetLiveChatConvertPath(s string) *VodCreate { + vc.mutation.SetLiveChatConvertPath(s) + return vc +} + +// SetNillableLiveChatConvertPath sets the "live_chat_convert_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableLiveChatConvertPath(s *string) *VodCreate { + if s != nil { + vc.SetLiveChatConvertPath(*s) + } + return vc +} + // SetChatVideoPath sets the "chat_video_path" field. func (vc *VodCreate) SetChatVideoPath(s string) *VodCreate { vc.mutation.SetChatVideoPath(s) @@ -236,6 +264,90 @@ func (vc *VodCreate) SetNillableFileName(s *string) *VodCreate { return vc } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (vc *VodCreate) SetTmpVideoDownloadPath(s string) *VodCreate { + vc.mutation.SetTmpVideoDownloadPath(s) + return vc +} + +// SetNillableTmpVideoDownloadPath sets the "tmp_video_download_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpVideoDownloadPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpVideoDownloadPath(*s) + } + return vc +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (vc *VodCreate) SetTmpVideoConvertPath(s string) *VodCreate { + vc.mutation.SetTmpVideoConvertPath(s) + return vc +} + +// SetNillableTmpVideoConvertPath sets the "tmp_video_convert_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpVideoConvertPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpVideoConvertPath(*s) + } + return vc +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (vc *VodCreate) SetTmpChatDownloadPath(s string) *VodCreate { + vc.mutation.SetTmpChatDownloadPath(s) + return vc +} + +// SetNillableTmpChatDownloadPath sets the "tmp_chat_download_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpChatDownloadPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpChatDownloadPath(*s) + } + return vc +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (vc *VodCreate) SetTmpLiveChatDownloadPath(s string) *VodCreate { + vc.mutation.SetTmpLiveChatDownloadPath(s) + return vc +} + +// SetNillableTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpLiveChatDownloadPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpLiveChatDownloadPath(*s) + } + return vc +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (vc *VodCreate) SetTmpLiveChatConvertPath(s string) *VodCreate { + vc.mutation.SetTmpLiveChatConvertPath(s) + return vc +} + +// SetNillableTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpLiveChatConvertPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpLiveChatConvertPath(*s) + } + return vc +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (vc *VodCreate) SetTmpChatRenderPath(s string) *VodCreate { + vc.mutation.SetTmpChatRenderPath(s) + return vc +} + +// SetNillableTmpChatRenderPath sets the "tmp_chat_render_path" field if the given value is not nil. +func (vc *VodCreate) SetNillableTmpChatRenderPath(s *string) *VodCreate { + if s != nil { + vc.SetTmpChatRenderPath(*s) + } + return vc +} + // SetLocked sets the "locked" field. func (vc *VodCreate) SetLocked(b bool) *VodCreate { vc.mutation.SetLocked(b) @@ -617,6 +729,14 @@ func (vc *VodCreate) createSpec() (*Vod, *sqlgraph.CreateSpec) { _spec.SetField(vod.FieldChatPath, field.TypeString, value) _node.ChatPath = value } + if value, ok := vc.mutation.LiveChatPath(); ok { + _spec.SetField(vod.FieldLiveChatPath, field.TypeString, value) + _node.LiveChatPath = value + } + if value, ok := vc.mutation.LiveChatConvertPath(); ok { + _spec.SetField(vod.FieldLiveChatConvertPath, field.TypeString, value) + _node.LiveChatConvertPath = value + } if value, ok := vc.mutation.ChatVideoPath(); ok { _spec.SetField(vod.FieldChatVideoPath, field.TypeString, value) _node.ChatVideoPath = value @@ -637,6 +757,30 @@ func (vc *VodCreate) createSpec() (*Vod, *sqlgraph.CreateSpec) { _spec.SetField(vod.FieldFileName, field.TypeString, value) _node.FileName = value } + if value, ok := vc.mutation.TmpVideoDownloadPath(); ok { + _spec.SetField(vod.FieldTmpVideoDownloadPath, field.TypeString, value) + _node.TmpVideoDownloadPath = value + } + if value, ok := vc.mutation.TmpVideoConvertPath(); ok { + _spec.SetField(vod.FieldTmpVideoConvertPath, field.TypeString, value) + _node.TmpVideoConvertPath = value + } + if value, ok := vc.mutation.TmpChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpChatDownloadPath, field.TypeString, value) + _node.TmpChatDownloadPath = value + } + if value, ok := vc.mutation.TmpLiveChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatDownloadPath, field.TypeString, value) + _node.TmpLiveChatDownloadPath = value + } + if value, ok := vc.mutation.TmpLiveChatConvertPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatConvertPath, field.TypeString, value) + _node.TmpLiveChatConvertPath = value + } + if value, ok := vc.mutation.TmpChatRenderPath(); ok { + _spec.SetField(vod.FieldTmpChatRenderPath, field.TypeString, value) + _node.TmpChatRenderPath = value + } if value, ok := vc.mutation.Locked(); ok { _spec.SetField(vod.FieldLocked, field.TypeBool, value) _node.Locked = value @@ -964,6 +1108,42 @@ func (u *VodUpsert) ClearChatPath() *VodUpsert { return u } +// SetLiveChatPath sets the "live_chat_path" field. +func (u *VodUpsert) SetLiveChatPath(v string) *VodUpsert { + u.Set(vod.FieldLiveChatPath, v) + return u +} + +// UpdateLiveChatPath sets the "live_chat_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateLiveChatPath() *VodUpsert { + u.SetExcluded(vod.FieldLiveChatPath) + return u +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (u *VodUpsert) ClearLiveChatPath() *VodUpsert { + u.SetNull(vod.FieldLiveChatPath) + return u +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (u *VodUpsert) SetLiveChatConvertPath(v string) *VodUpsert { + u.Set(vod.FieldLiveChatConvertPath, v) + return u +} + +// UpdateLiveChatConvertPath sets the "live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateLiveChatConvertPath() *VodUpsert { + u.SetExcluded(vod.FieldLiveChatConvertPath) + return u +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (u *VodUpsert) ClearLiveChatConvertPath() *VodUpsert { + u.SetNull(vod.FieldLiveChatConvertPath) + return u +} + // SetChatVideoPath sets the "chat_video_path" field. func (u *VodUpsert) SetChatVideoPath(v string) *VodUpsert { u.Set(vod.FieldChatVideoPath, v) @@ -1054,6 +1234,114 @@ func (u *VodUpsert) ClearFileName() *VodUpsert { return u } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (u *VodUpsert) SetTmpVideoDownloadPath(v string) *VodUpsert { + u.Set(vod.FieldTmpVideoDownloadPath, v) + return u +} + +// UpdateTmpVideoDownloadPath sets the "tmp_video_download_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpVideoDownloadPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpVideoDownloadPath) + return u +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (u *VodUpsert) ClearTmpVideoDownloadPath() *VodUpsert { + u.SetNull(vod.FieldTmpVideoDownloadPath) + return u +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (u *VodUpsert) SetTmpVideoConvertPath(v string) *VodUpsert { + u.Set(vod.FieldTmpVideoConvertPath, v) + return u +} + +// UpdateTmpVideoConvertPath sets the "tmp_video_convert_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpVideoConvertPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpVideoConvertPath) + return u +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (u *VodUpsert) ClearTmpVideoConvertPath() *VodUpsert { + u.SetNull(vod.FieldTmpVideoConvertPath) + return u +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (u *VodUpsert) SetTmpChatDownloadPath(v string) *VodUpsert { + u.Set(vod.FieldTmpChatDownloadPath, v) + return u +} + +// UpdateTmpChatDownloadPath sets the "tmp_chat_download_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpChatDownloadPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpChatDownloadPath) + return u +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (u *VodUpsert) ClearTmpChatDownloadPath() *VodUpsert { + u.SetNull(vod.FieldTmpChatDownloadPath) + return u +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (u *VodUpsert) SetTmpLiveChatDownloadPath(v string) *VodUpsert { + u.Set(vod.FieldTmpLiveChatDownloadPath, v) + return u +} + +// UpdateTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpLiveChatDownloadPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpLiveChatDownloadPath) + return u +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (u *VodUpsert) ClearTmpLiveChatDownloadPath() *VodUpsert { + u.SetNull(vod.FieldTmpLiveChatDownloadPath) + return u +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (u *VodUpsert) SetTmpLiveChatConvertPath(v string) *VodUpsert { + u.Set(vod.FieldTmpLiveChatConvertPath, v) + return u +} + +// UpdateTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpLiveChatConvertPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpLiveChatConvertPath) + return u +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (u *VodUpsert) ClearTmpLiveChatConvertPath() *VodUpsert { + u.SetNull(vod.FieldTmpLiveChatConvertPath) + return u +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (u *VodUpsert) SetTmpChatRenderPath(v string) *VodUpsert { + u.Set(vod.FieldTmpChatRenderPath, v) + return u +} + +// UpdateTmpChatRenderPath sets the "tmp_chat_render_path" field to the value that was provided on create. +func (u *VodUpsert) UpdateTmpChatRenderPath() *VodUpsert { + u.SetExcluded(vod.FieldTmpChatRenderPath) + return u +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (u *VodUpsert) ClearTmpChatRenderPath() *VodUpsert { + u.SetNull(vod.FieldTmpChatRenderPath) + return u +} + // SetLocked sets the "locked" field. func (u *VodUpsert) SetLocked(v bool) *VodUpsert { u.Set(vod.FieldLocked, v) @@ -1362,6 +1650,48 @@ func (u *VodUpsertOne) ClearChatPath() *VodUpsertOne { }) } +// SetLiveChatPath sets the "live_chat_path" field. +func (u *VodUpsertOne) SetLiveChatPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetLiveChatPath(v) + }) +} + +// UpdateLiveChatPath sets the "live_chat_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateLiveChatPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateLiveChatPath() + }) +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (u *VodUpsertOne) ClearLiveChatPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearLiveChatPath() + }) +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (u *VodUpsertOne) SetLiveChatConvertPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetLiveChatConvertPath(v) + }) +} + +// UpdateLiveChatConvertPath sets the "live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateLiveChatConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateLiveChatConvertPath() + }) +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (u *VodUpsertOne) ClearLiveChatConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearLiveChatConvertPath() + }) +} + // SetChatVideoPath sets the "chat_video_path" field. func (u *VodUpsertOne) SetChatVideoPath(v string) *VodUpsertOne { return u.Update(func(s *VodUpsert) { @@ -1467,6 +1797,132 @@ func (u *VodUpsertOne) ClearFileName() *VodUpsertOne { }) } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (u *VodUpsertOne) SetTmpVideoDownloadPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpVideoDownloadPath(v) + }) +} + +// UpdateTmpVideoDownloadPath sets the "tmp_video_download_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpVideoDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpVideoDownloadPath() + }) +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (u *VodUpsertOne) ClearTmpVideoDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpVideoDownloadPath() + }) +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (u *VodUpsertOne) SetTmpVideoConvertPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpVideoConvertPath(v) + }) +} + +// UpdateTmpVideoConvertPath sets the "tmp_video_convert_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpVideoConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpVideoConvertPath() + }) +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (u *VodUpsertOne) ClearTmpVideoConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpVideoConvertPath() + }) +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (u *VodUpsertOne) SetTmpChatDownloadPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpChatDownloadPath(v) + }) +} + +// UpdateTmpChatDownloadPath sets the "tmp_chat_download_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpChatDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpChatDownloadPath() + }) +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (u *VodUpsertOne) ClearTmpChatDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpChatDownloadPath() + }) +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (u *VodUpsertOne) SetTmpLiveChatDownloadPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpLiveChatDownloadPath(v) + }) +} + +// UpdateTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpLiveChatDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpLiveChatDownloadPath() + }) +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (u *VodUpsertOne) ClearTmpLiveChatDownloadPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpLiveChatDownloadPath() + }) +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (u *VodUpsertOne) SetTmpLiveChatConvertPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpLiveChatConvertPath(v) + }) +} + +// UpdateTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpLiveChatConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpLiveChatConvertPath() + }) +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (u *VodUpsertOne) ClearTmpLiveChatConvertPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpLiveChatConvertPath() + }) +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (u *VodUpsertOne) SetTmpChatRenderPath(v string) *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.SetTmpChatRenderPath(v) + }) +} + +// UpdateTmpChatRenderPath sets the "tmp_chat_render_path" field to the value that was provided on create. +func (u *VodUpsertOne) UpdateTmpChatRenderPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpChatRenderPath() + }) +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (u *VodUpsertOne) ClearTmpChatRenderPath() *VodUpsertOne { + return u.Update(func(s *VodUpsert) { + s.ClearTmpChatRenderPath() + }) +} + // SetLocked sets the "locked" field. func (u *VodUpsertOne) SetLocked(v bool) *VodUpsertOne { return u.Update(func(s *VodUpsert) { @@ -1951,6 +2407,48 @@ func (u *VodUpsertBulk) ClearChatPath() *VodUpsertBulk { }) } +// SetLiveChatPath sets the "live_chat_path" field. +func (u *VodUpsertBulk) SetLiveChatPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetLiveChatPath(v) + }) +} + +// UpdateLiveChatPath sets the "live_chat_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateLiveChatPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateLiveChatPath() + }) +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (u *VodUpsertBulk) ClearLiveChatPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearLiveChatPath() + }) +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (u *VodUpsertBulk) SetLiveChatConvertPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetLiveChatConvertPath(v) + }) +} + +// UpdateLiveChatConvertPath sets the "live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateLiveChatConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateLiveChatConvertPath() + }) +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (u *VodUpsertBulk) ClearLiveChatConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearLiveChatConvertPath() + }) +} + // SetChatVideoPath sets the "chat_video_path" field. func (u *VodUpsertBulk) SetChatVideoPath(v string) *VodUpsertBulk { return u.Update(func(s *VodUpsert) { @@ -2056,6 +2554,132 @@ func (u *VodUpsertBulk) ClearFileName() *VodUpsertBulk { }) } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (u *VodUpsertBulk) SetTmpVideoDownloadPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpVideoDownloadPath(v) + }) +} + +// UpdateTmpVideoDownloadPath sets the "tmp_video_download_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpVideoDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpVideoDownloadPath() + }) +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (u *VodUpsertBulk) ClearTmpVideoDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpVideoDownloadPath() + }) +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (u *VodUpsertBulk) SetTmpVideoConvertPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpVideoConvertPath(v) + }) +} + +// UpdateTmpVideoConvertPath sets the "tmp_video_convert_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpVideoConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpVideoConvertPath() + }) +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (u *VodUpsertBulk) ClearTmpVideoConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpVideoConvertPath() + }) +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (u *VodUpsertBulk) SetTmpChatDownloadPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpChatDownloadPath(v) + }) +} + +// UpdateTmpChatDownloadPath sets the "tmp_chat_download_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpChatDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpChatDownloadPath() + }) +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (u *VodUpsertBulk) ClearTmpChatDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpChatDownloadPath() + }) +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (u *VodUpsertBulk) SetTmpLiveChatDownloadPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpLiveChatDownloadPath(v) + }) +} + +// UpdateTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpLiveChatDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpLiveChatDownloadPath() + }) +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (u *VodUpsertBulk) ClearTmpLiveChatDownloadPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpLiveChatDownloadPath() + }) +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (u *VodUpsertBulk) SetTmpLiveChatConvertPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpLiveChatConvertPath(v) + }) +} + +// UpdateTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpLiveChatConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpLiveChatConvertPath() + }) +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (u *VodUpsertBulk) ClearTmpLiveChatConvertPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpLiveChatConvertPath() + }) +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (u *VodUpsertBulk) SetTmpChatRenderPath(v string) *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.SetTmpChatRenderPath(v) + }) +} + +// UpdateTmpChatRenderPath sets the "tmp_chat_render_path" field to the value that was provided on create. +func (u *VodUpsertBulk) UpdateTmpChatRenderPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.UpdateTmpChatRenderPath() + }) +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (u *VodUpsertBulk) ClearTmpChatRenderPath() *VodUpsertBulk { + return u.Update(func(s *VodUpsert) { + s.ClearTmpChatRenderPath() + }) +} + // SetLocked sets the "locked" field. func (u *VodUpsertBulk) SetLocked(v bool) *VodUpsertBulk { return u.Update(func(s *VodUpsert) { diff --git a/ent/vod_update.go b/ent/vod_update.go index 4a819c4e..e66876f4 100644 --- a/ent/vod_update.go +++ b/ent/vod_update.go @@ -235,6 +235,46 @@ func (vu *VodUpdate) ClearChatPath() *VodUpdate { return vu } +// SetLiveChatPath sets the "live_chat_path" field. +func (vu *VodUpdate) SetLiveChatPath(s string) *VodUpdate { + vu.mutation.SetLiveChatPath(s) + return vu +} + +// SetNillableLiveChatPath sets the "live_chat_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableLiveChatPath(s *string) *VodUpdate { + if s != nil { + vu.SetLiveChatPath(*s) + } + return vu +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (vu *VodUpdate) ClearLiveChatPath() *VodUpdate { + vu.mutation.ClearLiveChatPath() + return vu +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (vu *VodUpdate) SetLiveChatConvertPath(s string) *VodUpdate { + vu.mutation.SetLiveChatConvertPath(s) + return vu +} + +// SetNillableLiveChatConvertPath sets the "live_chat_convert_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableLiveChatConvertPath(s *string) *VodUpdate { + if s != nil { + vu.SetLiveChatConvertPath(*s) + } + return vu +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (vu *VodUpdate) ClearLiveChatConvertPath() *VodUpdate { + vu.mutation.ClearLiveChatConvertPath() + return vu +} + // SetChatVideoPath sets the "chat_video_path" field. func (vu *VodUpdate) SetChatVideoPath(s string) *VodUpdate { vu.mutation.SetChatVideoPath(s) @@ -335,6 +375,126 @@ func (vu *VodUpdate) ClearFileName() *VodUpdate { return vu } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (vu *VodUpdate) SetTmpVideoDownloadPath(s string) *VodUpdate { + vu.mutation.SetTmpVideoDownloadPath(s) + return vu +} + +// SetNillableTmpVideoDownloadPath sets the "tmp_video_download_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpVideoDownloadPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpVideoDownloadPath(*s) + } + return vu +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (vu *VodUpdate) ClearTmpVideoDownloadPath() *VodUpdate { + vu.mutation.ClearTmpVideoDownloadPath() + return vu +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (vu *VodUpdate) SetTmpVideoConvertPath(s string) *VodUpdate { + vu.mutation.SetTmpVideoConvertPath(s) + return vu +} + +// SetNillableTmpVideoConvertPath sets the "tmp_video_convert_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpVideoConvertPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpVideoConvertPath(*s) + } + return vu +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (vu *VodUpdate) ClearTmpVideoConvertPath() *VodUpdate { + vu.mutation.ClearTmpVideoConvertPath() + return vu +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (vu *VodUpdate) SetTmpChatDownloadPath(s string) *VodUpdate { + vu.mutation.SetTmpChatDownloadPath(s) + return vu +} + +// SetNillableTmpChatDownloadPath sets the "tmp_chat_download_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpChatDownloadPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpChatDownloadPath(*s) + } + return vu +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (vu *VodUpdate) ClearTmpChatDownloadPath() *VodUpdate { + vu.mutation.ClearTmpChatDownloadPath() + return vu +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (vu *VodUpdate) SetTmpLiveChatDownloadPath(s string) *VodUpdate { + vu.mutation.SetTmpLiveChatDownloadPath(s) + return vu +} + +// SetNillableTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpLiveChatDownloadPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpLiveChatDownloadPath(*s) + } + return vu +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (vu *VodUpdate) ClearTmpLiveChatDownloadPath() *VodUpdate { + vu.mutation.ClearTmpLiveChatDownloadPath() + return vu +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (vu *VodUpdate) SetTmpLiveChatConvertPath(s string) *VodUpdate { + vu.mutation.SetTmpLiveChatConvertPath(s) + return vu +} + +// SetNillableTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpLiveChatConvertPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpLiveChatConvertPath(*s) + } + return vu +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (vu *VodUpdate) ClearTmpLiveChatConvertPath() *VodUpdate { + vu.mutation.ClearTmpLiveChatConvertPath() + return vu +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (vu *VodUpdate) SetTmpChatRenderPath(s string) *VodUpdate { + vu.mutation.SetTmpChatRenderPath(s) + return vu +} + +// SetNillableTmpChatRenderPath sets the "tmp_chat_render_path" field if the given value is not nil. +func (vu *VodUpdate) SetNillableTmpChatRenderPath(s *string) *VodUpdate { + if s != nil { + vu.SetTmpChatRenderPath(*s) + } + return vu +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (vu *VodUpdate) ClearTmpChatRenderPath() *VodUpdate { + vu.mutation.ClearTmpChatRenderPath() + return vu +} + // SetLocked sets the "locked" field. func (vu *VodUpdate) SetLocked(b bool) *VodUpdate { vu.mutation.SetLocked(b) @@ -662,6 +822,18 @@ func (vu *VodUpdate) sqlSave(ctx context.Context) (n int, err error) { if vu.mutation.ChatPathCleared() { _spec.ClearField(vod.FieldChatPath, field.TypeString) } + if value, ok := vu.mutation.LiveChatPath(); ok { + _spec.SetField(vod.FieldLiveChatPath, field.TypeString, value) + } + if vu.mutation.LiveChatPathCleared() { + _spec.ClearField(vod.FieldLiveChatPath, field.TypeString) + } + if value, ok := vu.mutation.LiveChatConvertPath(); ok { + _spec.SetField(vod.FieldLiveChatConvertPath, field.TypeString, value) + } + if vu.mutation.LiveChatConvertPathCleared() { + _spec.ClearField(vod.FieldLiveChatConvertPath, field.TypeString) + } if value, ok := vu.mutation.ChatVideoPath(); ok { _spec.SetField(vod.FieldChatVideoPath, field.TypeString, value) } @@ -692,6 +864,42 @@ func (vu *VodUpdate) sqlSave(ctx context.Context) (n int, err error) { if vu.mutation.FileNameCleared() { _spec.ClearField(vod.FieldFileName, field.TypeString) } + if value, ok := vu.mutation.TmpVideoDownloadPath(); ok { + _spec.SetField(vod.FieldTmpVideoDownloadPath, field.TypeString, value) + } + if vu.mutation.TmpVideoDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpVideoDownloadPath, field.TypeString) + } + if value, ok := vu.mutation.TmpVideoConvertPath(); ok { + _spec.SetField(vod.FieldTmpVideoConvertPath, field.TypeString, value) + } + if vu.mutation.TmpVideoConvertPathCleared() { + _spec.ClearField(vod.FieldTmpVideoConvertPath, field.TypeString) + } + if value, ok := vu.mutation.TmpChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpChatDownloadPath, field.TypeString, value) + } + if vu.mutation.TmpChatDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpChatDownloadPath, field.TypeString) + } + if value, ok := vu.mutation.TmpLiveChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatDownloadPath, field.TypeString, value) + } + if vu.mutation.TmpLiveChatDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpLiveChatDownloadPath, field.TypeString) + } + if value, ok := vu.mutation.TmpLiveChatConvertPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatConvertPath, field.TypeString, value) + } + if vu.mutation.TmpLiveChatConvertPathCleared() { + _spec.ClearField(vod.FieldTmpLiveChatConvertPath, field.TypeString) + } + if value, ok := vu.mutation.TmpChatRenderPath(); ok { + _spec.SetField(vod.FieldTmpChatRenderPath, field.TypeString, value) + } + if vu.mutation.TmpChatRenderPathCleared() { + _spec.ClearField(vod.FieldTmpChatRenderPath, field.TypeString) + } if value, ok := vu.mutation.Locked(); ok { _spec.SetField(vod.FieldLocked, field.TypeBool, value) } @@ -1120,6 +1328,46 @@ func (vuo *VodUpdateOne) ClearChatPath() *VodUpdateOne { return vuo } +// SetLiveChatPath sets the "live_chat_path" field. +func (vuo *VodUpdateOne) SetLiveChatPath(s string) *VodUpdateOne { + vuo.mutation.SetLiveChatPath(s) + return vuo +} + +// SetNillableLiveChatPath sets the "live_chat_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableLiveChatPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetLiveChatPath(*s) + } + return vuo +} + +// ClearLiveChatPath clears the value of the "live_chat_path" field. +func (vuo *VodUpdateOne) ClearLiveChatPath() *VodUpdateOne { + vuo.mutation.ClearLiveChatPath() + return vuo +} + +// SetLiveChatConvertPath sets the "live_chat_convert_path" field. +func (vuo *VodUpdateOne) SetLiveChatConvertPath(s string) *VodUpdateOne { + vuo.mutation.SetLiveChatConvertPath(s) + return vuo +} + +// SetNillableLiveChatConvertPath sets the "live_chat_convert_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableLiveChatConvertPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetLiveChatConvertPath(*s) + } + return vuo +} + +// ClearLiveChatConvertPath clears the value of the "live_chat_convert_path" field. +func (vuo *VodUpdateOne) ClearLiveChatConvertPath() *VodUpdateOne { + vuo.mutation.ClearLiveChatConvertPath() + return vuo +} + // SetChatVideoPath sets the "chat_video_path" field. func (vuo *VodUpdateOne) SetChatVideoPath(s string) *VodUpdateOne { vuo.mutation.SetChatVideoPath(s) @@ -1220,6 +1468,126 @@ func (vuo *VodUpdateOne) ClearFileName() *VodUpdateOne { return vuo } +// SetTmpVideoDownloadPath sets the "tmp_video_download_path" field. +func (vuo *VodUpdateOne) SetTmpVideoDownloadPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpVideoDownloadPath(s) + return vuo +} + +// SetNillableTmpVideoDownloadPath sets the "tmp_video_download_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpVideoDownloadPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpVideoDownloadPath(*s) + } + return vuo +} + +// ClearTmpVideoDownloadPath clears the value of the "tmp_video_download_path" field. +func (vuo *VodUpdateOne) ClearTmpVideoDownloadPath() *VodUpdateOne { + vuo.mutation.ClearTmpVideoDownloadPath() + return vuo +} + +// SetTmpVideoConvertPath sets the "tmp_video_convert_path" field. +func (vuo *VodUpdateOne) SetTmpVideoConvertPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpVideoConvertPath(s) + return vuo +} + +// SetNillableTmpVideoConvertPath sets the "tmp_video_convert_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpVideoConvertPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpVideoConvertPath(*s) + } + return vuo +} + +// ClearTmpVideoConvertPath clears the value of the "tmp_video_convert_path" field. +func (vuo *VodUpdateOne) ClearTmpVideoConvertPath() *VodUpdateOne { + vuo.mutation.ClearTmpVideoConvertPath() + return vuo +} + +// SetTmpChatDownloadPath sets the "tmp_chat_download_path" field. +func (vuo *VodUpdateOne) SetTmpChatDownloadPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpChatDownloadPath(s) + return vuo +} + +// SetNillableTmpChatDownloadPath sets the "tmp_chat_download_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpChatDownloadPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpChatDownloadPath(*s) + } + return vuo +} + +// ClearTmpChatDownloadPath clears the value of the "tmp_chat_download_path" field. +func (vuo *VodUpdateOne) ClearTmpChatDownloadPath() *VodUpdateOne { + vuo.mutation.ClearTmpChatDownloadPath() + return vuo +} + +// SetTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field. +func (vuo *VodUpdateOne) SetTmpLiveChatDownloadPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpLiveChatDownloadPath(s) + return vuo +} + +// SetNillableTmpLiveChatDownloadPath sets the "tmp_live_chat_download_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpLiveChatDownloadPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpLiveChatDownloadPath(*s) + } + return vuo +} + +// ClearTmpLiveChatDownloadPath clears the value of the "tmp_live_chat_download_path" field. +func (vuo *VodUpdateOne) ClearTmpLiveChatDownloadPath() *VodUpdateOne { + vuo.mutation.ClearTmpLiveChatDownloadPath() + return vuo +} + +// SetTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field. +func (vuo *VodUpdateOne) SetTmpLiveChatConvertPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpLiveChatConvertPath(s) + return vuo +} + +// SetNillableTmpLiveChatConvertPath sets the "tmp_live_chat_convert_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpLiveChatConvertPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpLiveChatConvertPath(*s) + } + return vuo +} + +// ClearTmpLiveChatConvertPath clears the value of the "tmp_live_chat_convert_path" field. +func (vuo *VodUpdateOne) ClearTmpLiveChatConvertPath() *VodUpdateOne { + vuo.mutation.ClearTmpLiveChatConvertPath() + return vuo +} + +// SetTmpChatRenderPath sets the "tmp_chat_render_path" field. +func (vuo *VodUpdateOne) SetTmpChatRenderPath(s string) *VodUpdateOne { + vuo.mutation.SetTmpChatRenderPath(s) + return vuo +} + +// SetNillableTmpChatRenderPath sets the "tmp_chat_render_path" field if the given value is not nil. +func (vuo *VodUpdateOne) SetNillableTmpChatRenderPath(s *string) *VodUpdateOne { + if s != nil { + vuo.SetTmpChatRenderPath(*s) + } + return vuo +} + +// ClearTmpChatRenderPath clears the value of the "tmp_chat_render_path" field. +func (vuo *VodUpdateOne) ClearTmpChatRenderPath() *VodUpdateOne { + vuo.mutation.ClearTmpChatRenderPath() + return vuo +} + // SetLocked sets the "locked" field. func (vuo *VodUpdateOne) SetLocked(b bool) *VodUpdateOne { vuo.mutation.SetLocked(b) @@ -1577,6 +1945,18 @@ func (vuo *VodUpdateOne) sqlSave(ctx context.Context) (_node *Vod, err error) { if vuo.mutation.ChatPathCleared() { _spec.ClearField(vod.FieldChatPath, field.TypeString) } + if value, ok := vuo.mutation.LiveChatPath(); ok { + _spec.SetField(vod.FieldLiveChatPath, field.TypeString, value) + } + if vuo.mutation.LiveChatPathCleared() { + _spec.ClearField(vod.FieldLiveChatPath, field.TypeString) + } + if value, ok := vuo.mutation.LiveChatConvertPath(); ok { + _spec.SetField(vod.FieldLiveChatConvertPath, field.TypeString, value) + } + if vuo.mutation.LiveChatConvertPathCleared() { + _spec.ClearField(vod.FieldLiveChatConvertPath, field.TypeString) + } if value, ok := vuo.mutation.ChatVideoPath(); ok { _spec.SetField(vod.FieldChatVideoPath, field.TypeString, value) } @@ -1607,6 +1987,42 @@ func (vuo *VodUpdateOne) sqlSave(ctx context.Context) (_node *Vod, err error) { if vuo.mutation.FileNameCleared() { _spec.ClearField(vod.FieldFileName, field.TypeString) } + if value, ok := vuo.mutation.TmpVideoDownloadPath(); ok { + _spec.SetField(vod.FieldTmpVideoDownloadPath, field.TypeString, value) + } + if vuo.mutation.TmpVideoDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpVideoDownloadPath, field.TypeString) + } + if value, ok := vuo.mutation.TmpVideoConvertPath(); ok { + _spec.SetField(vod.FieldTmpVideoConvertPath, field.TypeString, value) + } + if vuo.mutation.TmpVideoConvertPathCleared() { + _spec.ClearField(vod.FieldTmpVideoConvertPath, field.TypeString) + } + if value, ok := vuo.mutation.TmpChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpChatDownloadPath, field.TypeString, value) + } + if vuo.mutation.TmpChatDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpChatDownloadPath, field.TypeString) + } + if value, ok := vuo.mutation.TmpLiveChatDownloadPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatDownloadPath, field.TypeString, value) + } + if vuo.mutation.TmpLiveChatDownloadPathCleared() { + _spec.ClearField(vod.FieldTmpLiveChatDownloadPath, field.TypeString) + } + if value, ok := vuo.mutation.TmpLiveChatConvertPath(); ok { + _spec.SetField(vod.FieldTmpLiveChatConvertPath, field.TypeString, value) + } + if vuo.mutation.TmpLiveChatConvertPathCleared() { + _spec.ClearField(vod.FieldTmpLiveChatConvertPath, field.TypeString) + } + if value, ok := vuo.mutation.TmpChatRenderPath(); ok { + _spec.SetField(vod.FieldTmpChatRenderPath, field.TypeString, value) + } + if vuo.mutation.TmpChatRenderPathCleared() { + _spec.ClearField(vod.FieldTmpChatRenderPath, field.TypeString) + } if value, ok := vuo.mutation.Locked(); ok { _spec.SetField(vod.FieldLocked, field.TypeBool, value) } diff --git a/go.sum b/go.sum index 9a93360e..d80816af 100644 --- a/go.sum +++ b/go.sum @@ -139,12 +139,16 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= @@ -190,6 +194,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= diff --git a/internal/activities/video.go b/internal/activities/video.go index 533f7cca..3837bcbc 100644 --- a/internal/activities/video.go +++ b/internal/activities/video.go @@ -392,7 +392,7 @@ func DownloadTwitchLiveVideo(ctx context.Context, input dto.ArchiveVideoInput, c } // Update video duration with duration from downloaded video - duration, err := exec.GetVideoDuration(fmt.Sprintf("/tmp/%s_%s-video.mp4", input.Vod.ExtID, input.Vod.ID)) + duration, err := exec.GetVideoDuration(input.Vod.TmpVideoDownloadPath) if err != nil { stopHeartbeat <- true return temporal.NewApplicationError(err.Error(), "", nil) @@ -490,6 +490,7 @@ func MoveVideo(ctx context.Context, input dto.ArchiveVideoInput) error { go sendHeartbeat(ctx, fmt.Sprintf("move-video-%s", input.VideoID), stopHeartbeat) if viper.GetBool("archive.save_as_hls") { + // todo: variablies paths? sourcePath := fmt.Sprintf("/tmp/%s_%s-video_hls0", input.Vod.ExtID, input.Vod.ID) destPath := fmt.Sprintf("/vods/%s/%s/%s-video_hls", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) err := utils.MoveFolder(sourcePath, destPath) @@ -509,10 +510,7 @@ func MoveVideo(ctx context.Context, input dto.ArchiveVideoInput) error { return dbErr } } else { - sourcePath := fmt.Sprintf("/tmp/%s_%s-video-convert.mp4", input.Vod.ExtID, input.Vod.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-video.mp4", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err := utils.MoveFile(sourcePath, destPath) + err := utils.MoveFile(input.Vod.TmpVideoConvertPath, input.Vod.VideoPath) if err != nil { _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskVideoMove(utils.Failed).Save(ctx) if dbErr != nil { @@ -526,7 +524,7 @@ func MoveVideo(ctx context.Context, input dto.ArchiveVideoInput) error { // Clean up files // Delete source file - err := utils.DeleteFile(fmt.Sprintf("/tmp/%s_%s-video.mp4", input.Vod.ExtID, input.Vod.ID)) + err := utils.DeleteFile(input.Vod.TmpVideoDownloadPath) if err != nil { log.Info().Err(err).Msgf("error deleting source file for vod %s", input.Vod.ID) } @@ -564,10 +562,7 @@ func DownloadTwitchChat(ctx context.Context, input dto.ArchiveVideoInput) error } // copy json to vod folder - sourcePath := fmt.Sprintf("/tmp/%s_%s-chat.json", input.Vod.ExtID, input.Vod.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-chat.json", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err = utils.CopyFile(sourcePath, destPath) + err = utils.CopyFile(input.Vod.TmpChatDownloadPath, input.Vod.ChatPath) if err != nil { _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatDownload(utils.Failed).Save(ctx) if dbErr != nil { @@ -611,10 +606,7 @@ func DownloadTwitchLiveChat(ctx context.Context, input dto.ArchiveVideoInput) er } // copy json to vod folder - sourcePath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", input.Vod.ExtID, input.Vod.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-live-chat.json", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err = utils.CopyFile(sourcePath, destPath) + err = utils.CopyFile(input.Vod.TmpLiveChatDownloadPath, input.Vod.ChatPath) if err != nil { _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatDownload(utils.Failed).Save(ctx) if dbErr != nil { @@ -678,10 +670,7 @@ func MoveChat(ctx context.Context, input dto.ArchiveVideoInput) error { stopHeartbeat := make(chan bool) go sendHeartbeat(ctx, fmt.Sprintf("move-chat-%s", input.VideoID), stopHeartbeat) - sourcePath := fmt.Sprintf("/tmp/%s_%s-chat.json", input.Vod.ExtID, input.Vod.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-chat.json", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err := utils.MoveFile(sourcePath, destPath) + err := utils.MoveFile(input.Vod.TmpChatDownloadPath, input.Vod.ChatPath) if err != nil { _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatMove(utils.Failed).Save(ctx) if dbErr != nil { @@ -693,10 +682,7 @@ func MoveChat(ctx context.Context, input dto.ArchiveVideoInput) error { } if input.Queue.RenderChat { - sourcePath = fmt.Sprintf("/tmp/%s_%s-chat.mp4", input.Vod.ExtID, input.Vod.ID) - destPath = fmt.Sprintf("/vods/%s/%s/%s-chat.mp4", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err = utils.MoveFile(sourcePath, destPath) + err = utils.MoveFile(input.Vod.TmpChatRenderPath, input.Vod.ChatVideoPath) if err != nil { _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatMove(utils.Failed).Save(ctx) if dbErr != nil { @@ -761,9 +747,8 @@ func ConvertTwitchLiveChat(ctx context.Context, input dto.ArchiveVideoInput) err go sendHeartbeat(ctx, fmt.Sprintf("convert-livechat-%s", input.VideoID), stopHeartbeat) // Check if chat file exists - chatPath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", input.Vod.ExtID, input.Vod.ID) - if !utils.FileExists(chatPath) { - log.Debug().Msgf("chat file does not exist %s - this means there were no chat messages - setting chat to complete", chatPath) + if !utils.FileExists(input.Vod.TmpLiveChatDownloadPath) { + log.Debug().Msgf("chat file does not exist %s - this means there were no chat messages - setting chat to complete", input.Vod.TmpLiveChatDownloadPath) // Set queue chat task to complete _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatConvert(utils.Success).SetTaskChatRender(utils.Success).SetTaskChatMove((utils.Success)).Save(ctx) if dbErr != nil { @@ -832,7 +817,7 @@ func ConvertTwitchLiveChat(ctx context.Context, input dto.ArchiveVideoInput) err previousVideoID = "132195945" } - err = utils.ConvertTwitchLiveChatToVodChat(fmt.Sprintf("/tmp/%s_%s-live-chat.json", input.Vod.ExtID, input.Vod.ID), input.Channel.Name, input.Vod.ID.String(), input.Vod.ExtID, cID, input.Queue.ChatStart, string(previousVideoID)) + err = utils.ConvertTwitchLiveChatToVodChat(input.Vod.TmpLiveChatDownloadPath, input.Channel.Name, input.Vod.ID.String(), input.Vod.ExtID, cID, input.Queue.ChatStart, string(previousVideoID)) if err != nil { log.Error().Err(err).Msg("error converting chat") _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatConvert(utils.Failed).Save(ctx) @@ -859,10 +844,7 @@ func ConvertTwitchLiveChat(ctx context.Context, input dto.ArchiveVideoInput) err } // copy converted chat - sourcePath := fmt.Sprintf("/tmp/%s_%s-chat-convert.json", input.Vod.ExtID, input.Vod.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-chat-convert.json", input.Channel.Name, input.Vod.FolderName, input.Vod.FileName) - - err = utils.CopyFile(sourcePath, destPath) + err = utils.CopyFile(input.Vod.TmpLiveChatConvertPath, input.Vod.LiveChatConvertPath) if err != nil { log.Error().Err(err).Msg("error copying chat convert") _, dbErr := database.DB().Client.Queue.UpdateOneID(input.Queue.ID).SetTaskChatConvert(utils.Failed).Save(ctx) diff --git a/internal/archive/archive.go b/internal/archive/archive.go index fad340f3..cda3ff74 100644 --- a/internal/archive/archive.go +++ b/internal/archive/archive.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/uuid" - "github.com/labstack/echo/v4" "github.com/rs/zerolog/log" "github.com/spf13/viper" "github.com/zibbp/ganymede/ent" @@ -141,16 +140,17 @@ func (s *Service) ArchiveTwitchVod(vID string, quality string, chat bool, render // Sets rootVodPath := fmt.Sprintf("/vods/%s/%s", tVod.UserLogin, folderName) - var chatPath string - var chatVideoPath string + chatPath := "" + chatVideoPath := "" + liveChatPath := "" + liveChatConvertPath := "" + if chat { chatPath = fmt.Sprintf("%s/%s-chat.json", rootVodPath, fileName) chatVideoPath = fmt.Sprintf("%s/%s-chat.mp4", rootVodPath, fileName) - } else { - chatPath = "" - chatVideoPath = "" + liveChatPath = fmt.Sprintf("%s/%s-live-chat.json", rootVodPath, fileName) + liveChatConvertPath = fmt.Sprintf("%s/%s-chat-convert.json", rootVodPath, fileName) } - // Parse new Twitch API duration parsedDuration, err := time.ParseDuration(tVod.Duration) if err != nil { @@ -163,27 +163,39 @@ func (s *Service) ArchiveTwitchVod(vID string, quality string, chat bool, render return nil, fmt.Errorf("error parsing date: %v", err) } + videoExtension := "mp4" + // Create VOD in DB vodDTO := vod.Vod{ - ID: vUUID, - ExtID: tVod.ID, - Platform: "twitch", - Type: utils.VodType(tVod.Type), - Title: tVod.Title, - Duration: int(parsedDuration.Seconds()), - Views: int(tVod.ViewCount), - Resolution: quality, - Processing: true, - ThumbnailPath: fmt.Sprintf("%s/%s-thumbnail.jpg", rootVodPath, fileName), - WebThumbnailPath: fmt.Sprintf("%s/%s-web_thumbnail.jpg", rootVodPath, fileName), - VideoPath: fmt.Sprintf("%s/%s-video.mp4", rootVodPath, fileName), - ChatPath: chatPath, - ChatVideoPath: chatVideoPath, - InfoPath: fmt.Sprintf("%s/%s-info.json", rootVodPath, fileName), - StreamedAt: parsedDate, - FolderName: folderName, - FileName: fileName, + ID: vUUID, + ExtID: tVod.ID, + Platform: "twitch", + Type: utils.VodType(tVod.Type), + Title: tVod.Title, + Duration: int(parsedDuration.Seconds()), + Views: int(tVod.ViewCount), + Resolution: quality, + Processing: true, + ThumbnailPath: fmt.Sprintf("%s/%s-thumbnail.jpg", rootVodPath, fileName), + WebThumbnailPath: fmt.Sprintf("%s/%s-web_thumbnail.jpg", rootVodPath, fileName), + VideoPath: fmt.Sprintf("%s/%s-video.%s", rootVodPath, fileName, videoExtension), + ChatPath: chatPath, + LiveChatPath: liveChatPath, + ChatVideoPath: chatVideoPath, + LiveChatConvertPath: liveChatConvertPath, + InfoPath: fmt.Sprintf("%s/%s-info.json", rootVodPath, fileName), + StreamedAt: parsedDate, + FolderName: folderName, + FileName: fileName, + // create temporary paths + TmpVideoDownloadPath: fmt.Sprintf("/tmp/%s_%s-video.%s", tVod.ID, vUUID, videoExtension), + TmpVideoConvertPath: fmt.Sprintf("/tmp/%s_%s-video-convert.%s", tVod.ID, vUUID, videoExtension), + TmpChatDownloadPath: fmt.Sprintf("/tmp/%s_%s-chat.json", tVod.ID, vUUID), + TmpLiveChatDownloadPath: fmt.Sprintf("/tmp/%s_%s-live-chat.json", tVod.ID, vUUID), + TmpLiveChatConvertPath: fmt.Sprintf("/tmp/%s_%s-chat-convert.json", tVod.ID, vUUID), + TmpChatRenderPath: fmt.Sprintf("/tmp/%s_%s-chat.mp4", tVod.ID, vUUID), } + v, err := s.VodService.CreateVod(vodDTO, dbC.ID) if err != nil { return nil, fmt.Errorf("error creating vod: %v", err) @@ -310,18 +322,18 @@ func (s *Service) CheckOnHold() { } -func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodResponse, error) { +func (s *Service) ArchiveTwitchLive(lwc *ent.Live, live twitch.Live) (*TwitchVodResponse, error) { // Check if channel exists - cCheck := s.ChannelService.CheckChannelExists(ts.UserLogin) + cCheck := s.ChannelService.CheckChannelExists(live.UserLogin) if !cCheck { - log.Debug().Msgf("channel does not exist: %s while archiving live stream. creating now.", ts.UserLogin) - _, err := s.ArchiveTwitchChannel(ts.UserLogin) + log.Debug().Msgf("channel does not exist: %s while archiving live stream. creating now.", live.UserLogin) + _, err := s.ArchiveTwitchChannel(live.UserLogin) if err != nil { return nil, fmt.Errorf("error creating channel: %v", err) } } // Fetch channel - dbC, err := s.ChannelService.GetChannelByName(ts.UserLogin) + dbC, err := s.ChannelService.GetChannelByName(live.UserLogin) if err != nil { return nil, fmt.Errorf("error fetching channel: %v", err) } @@ -334,11 +346,11 @@ func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodRe // Create vodDto for storage templates tVodDto := twitch.Vod{ - ID: ts.ID, - UserLogin: ts.UserLogin, - Title: ts.Title, + ID: live.ID, + UserLogin: live.UserLogin, + Title: live.Title, Type: "live", - CreatedAt: ts.StartedAt, + CreatedAt: live.StartedAt, } folderName, err := GetFolderName(vUUID, tVodDto) if err != nil { @@ -352,37 +364,50 @@ func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodRe } // Sets - rootVodPath := fmt.Sprintf("/vods/%s/%s", ts.UserLogin, folderName) - var chatPath string - var chatVideoPath string + rootVodPath := fmt.Sprintf("/vods/%s/%s", live.UserLogin, folderName) + chatPath := "" + chatVideoPath := "" + liveChatPath := "" + liveChatConvertPath := "" + if lwc.ArchiveChat { chatPath = fmt.Sprintf("%s/%s-chat.json", rootVodPath, fileName) chatVideoPath = fmt.Sprintf("%s/%s-chat.mp4", rootVodPath, fileName) - } else { - chatPath = "" - chatVideoPath = "" + liveChatPath = fmt.Sprintf("%s/%s-live-chat.json", rootVodPath, fileName) + liveChatConvertPath = fmt.Sprintf("%s/%s-chat-convert.json", rootVodPath, fileName) } + videoExtension := "mp4" + // Create VOD in DB vodDTO := vod.Vod{ - ID: vUUID, - ExtID: ts.ID, - Platform: "twitch", - Type: utils.VodType("live"), - Title: ts.Title, - Duration: 1, - Views: 1, - Resolution: lwc.Resolution, - Processing: true, - ThumbnailPath: fmt.Sprintf("%s/%s-thumbnail.jpg", rootVodPath, fileName), - WebThumbnailPath: fmt.Sprintf("%s/%s-web_thumbnail.jpg", rootVodPath, fileName), - VideoPath: fmt.Sprintf("%s/%s-video.mp4", rootVodPath, fileName), - ChatPath: chatPath, - ChatVideoPath: chatVideoPath, - InfoPath: fmt.Sprintf("%s/%s-info.json", rootVodPath, fileName), - StreamedAt: time.Now(), - FolderName: folderName, - FileName: fileName, + ID: vUUID, + ExtID: live.ID, + Platform: "twitch", + Type: utils.VodType("live"), + Title: live.Title, + Duration: 1, + Views: 1, + Resolution: lwc.Resolution, + Processing: true, + ThumbnailPath: fmt.Sprintf("%s/%s-thumbnail.jpg", rootVodPath, fileName), + WebThumbnailPath: fmt.Sprintf("%s/%s-web_thumbnail.jpg", rootVodPath, fileName), + VideoPath: fmt.Sprintf("%s/%s-video.%s", rootVodPath, fileName, videoExtension), + ChatPath: chatPath, + LiveChatPath: liveChatPath, + ChatVideoPath: chatVideoPath, + LiveChatConvertPath: liveChatConvertPath, + InfoPath: fmt.Sprintf("%s/%s-info.json", rootVodPath, fileName), + StreamedAt: time.Now(), + FolderName: folderName, + FileName: fileName, + // create temporary paths + TmpVideoDownloadPath: fmt.Sprintf("/tmp/%s_%s-video.%s", live.ID, vUUID, videoExtension), + TmpVideoConvertPath: fmt.Sprintf("/tmp/%s_%s-video-convert.%s", live.ID, vUUID, videoExtension), + TmpChatDownloadPath: fmt.Sprintf("/tmp/%s_%s-chat.json", live.ID, vUUID), + TmpLiveChatDownloadPath: fmt.Sprintf("/tmp/%s_%s-live-chat.json", live.ID, vUUID), + TmpLiveChatConvertPath: fmt.Sprintf("/tmp/%s_%s-chat-convert.json", live.ID, vUUID), + TmpChatRenderPath: fmt.Sprintf("/tmp/%s_%s-chat.mp4", live.ID, vUUID), } v, err := s.VodService.CreateVod(vodDTO, dbC.ID) if err != nil { @@ -432,7 +457,7 @@ func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodRe } input := dto.ArchiveVideoInput{ - VideoID: ts.ID, + VideoID: live.ID, Type: "live", Platform: "twitch", Resolution: lwc.Resolution, @@ -450,7 +475,7 @@ func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodRe return nil, fmt.Errorf("error starting workflow: %v", err) } - log.Debug().Msgf("workflow id %s started for live stream %s", we.GetID(), ts.ID) + log.Debug().Msgf("workflow id %s started for live stream %s", we.GetID(), live.ID) // set IDs in queue _, err = q.Update().SetWorkflowID(we.GetID()).SetWorkflowRunID(we.GetRunID()).Save(context.Background()) @@ -467,69 +492,6 @@ func (s *Service) ArchiveTwitchLive(lwc *ent.Live, ts twitch.Live) (*TwitchVodRe }, nil } -func (s *Service) RestartTask(c echo.Context, qID uuid.UUID, task string, cont bool) error { - q, err := s.QueueService.GetQueueItem(qID) - if err != nil { - return err - } - v, err := s.VodService.GetVod(q.Edges.Vod.ID, true, false, false) - if err != nil { - return err - } - ch, err := s.ChannelService.GetChannel(v.Edges.Channel.ID) - if err != nil { - return err - } - - log.Debug().Msgf("restarting task: %s for queue id: continue: ", task) - - switch task { - case "vod_create_folder": - go s.TaskVodCreateFolder(ch, v, q, cont) - case "vod_download_thumbnail": - if q.LiveArchive { - go s.TaskVodDownloadLiveThumbnail(ch, v, q, cont) - } else { - go s.TaskVodDownloadThumbnail(ch, v, q, cont) - } - case "vod_save_info": - if q.LiveArchive { - err = s.TaskVodSaveLiveInfo(ch, v, q, cont) - if err != nil { - log.Error().Err(err).Msg("error saving live info") - q.Update().SetTaskVodSaveInfo(utils.Failed).SaveX(context.Background()) - s.TaskError(ch, v, q, "vod_save_info") - return err - } - q.Update().SetTaskVodSaveInfo(utils.Success).SaveX(context.Background()) - } else { - go s.TaskVodSaveInfo(ch, v, q, cont) - } - case "video_download": - go s.TaskVideoDownload(ch, v, q, cont) - case "video_convert": - go s.TaskVideoConvert(ch, v, q, cont) - case "video_move": - go s.TaskVideoMove(ch, v, q, cont) - case "chat_convert": - go s.TaskChatConvertRestart(ch, v, q, cont) - case "chat_download": - go s.TaskChatDownload(ch, v, q, cont) - case "chat_render": - go s.TaskChatRender(ch, v, q, cont) - case "chat_move": - if q.LiveArchive { - go s.TaskLiveChatMove(ch, v, q, cont) - } else { - go s.TaskChatMove(ch, v, q, cont) - } - default: - return fmt.Errorf("task not found") - } - - return nil -} - func (s *Service) TaskVodCreateFolder(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont bool) { log.Debug().Msgf("starting task vod create folder for vod %s", v.ID) q.Update().SetTaskVodCreateFolder(utils.Running).SaveX(context.Background()) @@ -779,7 +741,7 @@ func (s *Service) TaskLiveVideoDownload(ch *ent.Channel, v *ent.Vod, q *ent.Queu } // Update video duration with duration from video - duration, err := exec.GetVideoDuration(fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)) + duration, err := exec.GetVideoDuration(v.TmpVideoDownloadPath) if err != nil { log.Error().Err(err).Msg("error getting video duration") @@ -860,10 +822,7 @@ func (s *Service) TaskVideoMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont // Update video path to hls path v.Update().SetVideoPath(fmt.Sprintf("/vods/%s/%s/%s-video_hls/%s-video.m3u8", ch.Name, v.FolderName, v.FileName, v.ExtID)).SaveX(context.Background()) } else { - sourcePath := fmt.Sprintf("/tmp/%s_%s-video-convert.mp4", v.ExtID, v.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-video.mp4", ch.Name, v.FolderName, v.FileName) - - err := utils.MoveFile(sourcePath, destPath) + err := utils.MoveFile(v.TmpVideoConvertPath, v.VideoPath) if err != nil { log.Error().Err(err).Msg("error moving video") q.Update().SetTaskVideoMove(utils.Failed).SaveX(context.Background()) @@ -874,12 +833,12 @@ func (s *Service) TaskVideoMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont // Clean up files // Delete source file - err := utils.DeleteFile(fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)) + err := utils.DeleteFile(v.TmpVideoDownloadPath) if err != nil { log.Info().Err(err).Msgf("error deleting source file for vod %s", v.ID) } // Ensure the converted file is deleted - err = utils.DeleteFile(fmt.Sprintf("/tmp/%s_%s-video-convert.mp4", v.ExtID, v.ID)) + err = utils.DeleteFile(v.TmpVideoConvertPath) if err != nil { log.Debug().Msgf("error deleting converted file for vod %s", v.ID) } @@ -912,10 +871,7 @@ func (s *Service) TaskChatDownload(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co q.Update().SetTaskChatDownload(utils.Success).SaveX(context.Background()) // copy chat json - sourcePath := fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-chat.json", ch.Name, v.FolderName, v.FileName) - - err = utils.CopyFile(sourcePath, destPath) + err = utils.CopyFile(v.TmpChatDownloadPath, v.ChatPath) if err != nil { log.Error().Err(err).Msg("error copying chat") } @@ -925,134 +881,6 @@ func (s *Service) TaskChatDownload(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co } } -// func (s *Service) TaskLiveChatDownload(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont bool, busC chan bool, startChatDownloadChannel chan bool, waitForVideo bool) { -// log.Debug().Msgf("starting task chat download for live stream %s", v.ID) -// q.Update().SetTaskChatDownload(utils.Running).SaveX(context.Background()) - -// err := exec.DownloadTwitchLiveChat(v, ch, q, busC, startChatDownloadChannel, waitForVideo) -// if err != nil { -// log.Error().Err(err).Msg("error downloading live chat") -// q.Update().SetTaskChatDownload(utils.Failed).SaveX(context.Background()) -// s.TaskError(ch, v, q, "chat_download") -// return -// } - -// q.Update().SetTaskChatDownload(utils.Success).SaveX(context.Background()) - -// // copy live chat -// sourcePath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID) -// destPath := fmt.Sprintf("/vods/%s/%s/%s-live-chat.json", ch.Name, v.FolderName, v.FileName) - -// err = utils.CopyFile(sourcePath, destPath) -// if err != nil { -// log.Error().Err(err).Msg("error moving live chat") -// } - -// // Always convert live chat to vod chat -// go s.TaskLiveChatConvert(ch, v, q, true) - -// } - -func (s *Service) TaskChatConvertRestart(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont bool) { - // Check if chat file exists - chatPath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID) - if !utils.FileExists(chatPath) { - storageChatPath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID) - if utils.FileExists(storageChatPath) { - err := utils.CopyFile(storageChatPath, chatPath) - if err != nil { - log.Error().Err(err).Msg("error copying live chat") - } - } else { - log.Error().Msgf("chat file does not exist %s", chatPath) - q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) - s.TaskError(ch, v, q, "chat_convert") - return - } - } - - // go s.TaskLiveChatConvert(ch, v, q, cont) -} - -// func (s *Service) TaskLiveChatConvert(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont bool) { -// log.Debug().Msgf("starting task chat convert for vod %s", v.ID) -// q.Update().SetTaskChatConvert(utils.Running).SaveX(context.Background()) - -// // Check if chat file exists -// chatPath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID) -// if !utils.FileExists(chatPath) { -// log.Debug().Msgf("chat file does not exist %s - this means there were no chat messages - setting chat to complete", chatPath) -// // Set queue chat task to complete -// q.Update().SetChatProcessing(false).SetTaskChatConvert(utils.Success).SetTaskChatRender(utils.Success).SetTaskChatMove(utils.Success).SaveX(context.Background()) -// // Set VOD chat to empty -// v.Update().SetChatPath("").SetChatVideoPath("").SaveX(context.Background()) -// // Check if all task are done -// go s.CheckIfLiveTasksAreDone(ch, v, q) -// return -// } - -// // // Fetch streamer from Twitch API for their user ID -// // streamer, err := twitch.API.GetUserByLogin(ch.Name) -// // if err != nil { -// // log.Error().Err(err).Msg("error getting streamer from Twitch API") -// // q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) -// // s.TaskError(ch, v, q, "chat_convert") -// // return -// // } -// // cID, err := strconv.Atoi(streamer.ID) -// // if err != nil { -// // log.Error().Err(err).Msg("error converting streamer ID to int") -// // q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) -// // s.TaskError(ch, v, q, "chat_convert") -// // return -// // } - -// // Get queue item (refresh) -// q, err = s.QueueService.GetQueueItem(q.ID) -// if err != nil { -// log.Error().Err(err).Msg("error getting queue item") -// q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) -// s.TaskError(ch, v, q, "chat_convert") -// return -// } - -// // err = utils.ConvertTwitchLiveChatToVodChat(fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID), ch.Name, v.ID.String(), v.ExtID, cID, q.ChatStart) -// // if err != nil { -// // log.Error().Err(err).Msg("error converting chat") -// // q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) -// // s.TaskError(ch, v, q, "chat_convert") -// // log.Info().Msgf("livestream chat task failed - setting vod to processed so it can be viewed") -// // v.Update().SetProcessing(false).SaveX(context.Background()) -// // return -// // } - -// // TwitchDownloader "chatupdate" -// // Embeds emotes and badges into the chat file -// err = exec.TwitchChatUpdate(v) -// if err != nil { -// log.Error().Err(err).Msg("error updating chat") -// q.Update().SetTaskChatConvert(utils.Failed).SaveX(context.Background()) -// s.TaskError(ch, v, q, "chat_convert") -// log.Info().Msgf("livestream chat task failed - setting vod to processed so it can be viewed") -// v.Update().SetProcessing(false).SaveX(context.Background()) -// return -// } - -// q.Update().SetTaskChatConvert(utils.Success).SaveX(context.Background()) - -// // copy converted chat -// sourcePath := fmt.Sprintf("/tmp/%s_%s-chat-convert.json", v.ExtID, v.ID) -// destPath := fmt.Sprintf("/vods/%s/%s/%s-chat-convert.json", ch.Name, v.FolderName, v.FileName) - -// err = utils.CopyFile(sourcePath, destPath) -// if err != nil { -// log.Error().Err(err).Msg("error copying chat convert") -// } - -// // Always render chat -// go s.TaskChatRender(ch, v, q, true) -// } - func (s *Service) TaskChatRender(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont bool) { var renderContinue bool if !q.RenderChat { @@ -1095,23 +923,17 @@ func (s *Service) TaskChatMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, cont b log.Debug().Msgf("starting task chat move for vod %s", v.ID) q.Update().SetTaskChatMove(utils.Running).SaveX(context.Background()) - // Chat JSON - sourcePath := fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-chat.json", ch.Name, v.FolderName, v.FileName) - - err := utils.MoveFile(sourcePath, destPath) + // chat JSON + err := utils.MoveFile(v.TmpChatDownloadPath, v.ChatPath) if err != nil { log.Error().Err(err).Msg("error moving chat") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) s.TaskError(ch, v, q, "chat_move") return } + // chat video if q.RenderChat { - // Chat Video - sourcePath = fmt.Sprintf("/tmp/%s_%s-chat.mp4", v.ExtID, v.ID) - destPath = fmt.Sprintf("/vods/%s/%s/%s-chat.mp4", ch.Name, v.FolderName, v.FileName) - - err = utils.MoveFile(sourcePath, destPath) + err = utils.MoveFile(v.TmpChatRenderPath, v.ChatVideoPath) if err != nil { log.Error().Err(err).Msg("error moving chat") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) @@ -1134,10 +956,7 @@ func (s *Service) TaskLiveChatMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co q.Update().SetTaskChatMove(utils.Running).SaveX(context.Background()) // live chat JSON - sourcePath := fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID) - destPath := fmt.Sprintf("/vods/%s/%s/%s-live-chat.json", ch.Name, v.FolderName, v.FileName) - - err := utils.MoveFile(sourcePath, destPath) + err := utils.MoveFile(v.TmpLiveChatDownloadPath, v.LiveChatPath) if err != nil { log.Error().Err(err).Msg("error moving live chat") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) @@ -1146,10 +965,7 @@ func (s *Service) TaskLiveChatMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co } // converted chat JSON - sourcePath = fmt.Sprintf("/tmp/%s_%s-chat-convert.json", v.ExtID, v.ID) - destPath = fmt.Sprintf("/vods/%s/%s/%s-chat-convert.json", ch.Name, v.FolderName, v.FileName) - - err = utils.MoveFile(sourcePath, destPath) + err = utils.MoveFile(v.TmpLiveChatConvertPath, v.LiveChatConvertPath) if err != nil { log.Error().Err(err).Msg("error moving chat convert") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) @@ -1158,10 +974,7 @@ func (s *Service) TaskLiveChatMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co } // parsed chat JSON - sourcePath = fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID) - destPath = fmt.Sprintf("/vods/%s/%s/%s-chat.json", ch.Name, v.FolderName, v.FileName) - - err = utils.MoveFile(sourcePath, destPath) + err = utils.MoveFile(v.TmpChatDownloadPath, v.ChatPath) if err != nil { log.Error().Err(err).Msg("error moving live parsed chat") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) @@ -1171,10 +984,7 @@ func (s *Service) TaskLiveChatMove(ch *ent.Channel, v *ent.Vod, q *ent.Queue, co if q.RenderChat { // Chat Video - sourcePath = fmt.Sprintf("/tmp/%s_%s-chat.mp4", v.ExtID, v.ID) - destPath = fmt.Sprintf("/vods/%s/%s/%s-chat.mp4", ch.Name, v.FolderName, v.FileName) - - err = utils.MoveFile(sourcePath, destPath) + err = utils.MoveFile(v.TmpChatRenderPath, v.ChatVideoPath) if err != nil { log.Error().Err(err).Msg("error moving chat") q.Update().SetTaskChatMove(utils.Failed).SaveX(context.Background()) diff --git a/internal/exec/exec.go b/internal/exec/exec.go index 3f0301db..f4fff45c 100644 --- a/internal/exec/exec.go +++ b/internal/exec/exec.go @@ -36,7 +36,7 @@ func DownloadTwitchVodVideo(v *ent.Vod) error { argArr = append(argArr, fmt.Sprintf("--twitch-api-header=Authorization=OAuth %s", twitchToken)) } - argArr = append(argArr, "-o", fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)) + argArr = append(argArr, "-o", v.TmpVideoDownloadPath) log.Debug().Msgf("running streamlink for vod video download: %s", strings.Join(argArr, " ")) @@ -64,7 +64,7 @@ func DownloadTwitchVodVideo(v *ent.Vod) error { } func DownloadTwitchVodChat(v *ent.Vod) error { - cmd := osExec.Command("TwitchDownloaderCLI", "chatdownload", "--id", v.ExtID, "--embed-images", "-o", fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID)) + cmd := osExec.Command("TwitchDownloaderCLI", "chatdownload", "--id", v.ExtID, "--embed-images", "-o", v.TmpChatDownloadPath) chatLogfile, err := os.Create(fmt.Sprintf("/logs/%s-chat.log", v.ID)) if err != nil { @@ -93,11 +93,11 @@ func RenderTwitchVodChat(v *ent.Vod) (error, bool) { // Split supplied params into array arr := strings.Fields(chatRenderParams) // Generate args for exec - argArr := []string{"chatrender", "-i", fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID)} + argArr := []string{"chatrender", "-i", v.TmpChatDownloadPath} // add each config param to arg argArr = append(argArr, arr...) // add output file - argArr = append(argArr, "-o", fmt.Sprintf("/tmp/%s_%s-chat.mp4", v.ExtID, v.ID)) + argArr = append(argArr, "-o", v.TmpChatRenderPath) log.Debug().Msgf("chat render args: %v", argArr) // Execute chat render cmd := osExec.Command("TwitchDownloaderCLI", argArr...) @@ -142,11 +142,11 @@ func ConvertTwitchVodVideo(v *ent.Vod) error { // Split supplied params into array arr := strings.Fields(ffmpegParams) // Generate args for exec - argArr := []string{"-y", "-hide_banner", "-i", fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)} + argArr := []string{"-y", "-hide_banner", "-i", v.TmpVideoDownloadPath} // add each config param to arg argArr = append(argArr, arr...) // add output file - argArr = append(argArr, fmt.Sprintf("/tmp/%s_%s-video-convert.mp4", v.ExtID, v.ID)) + argArr = append(argArr, v.TmpVideoConvertPath) log.Debug().Msgf("video convert args: %v", argArr) // Execute ffmpeg cmd := osExec.Command("ffmpeg", argArr...) @@ -172,12 +172,12 @@ func ConvertTwitchVodVideo(v *ent.Vod) error { func ConvertToHLS(v *ent.Vod) error { // Delete original video file to save space log.Debug().Msgf("deleting original video file for %s to save space", v.ExtID) - if err := os.Remove(fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)); err != nil { + if err := os.Remove(v.TmpVideoDownloadPath); err != nil { log.Error().Err(err).Msg("error deleting original video file") return err } - cmd := osExec.Command("ffmpeg", "-y", "-hide_banner", "-i", fmt.Sprintf("/tmp/%s_%s-video-convert.mp4", v.ExtID, v.ID), "-c", "copy", "-start_number", "0", "-hls_time", "10", "-hls_list_size", "0", "-hls_segment_filename", fmt.Sprintf("/tmp/%s_%s-video_hls%s/%s_segment%s.ts", v.ExtID, v.ID, "%v", v.ExtID, "%d"), "-f", "hls", fmt.Sprintf("/tmp/%s_%s-video_hls%s/%s-video.m3u8", v.ExtID, v.ID, "%v", v.ExtID)) + cmd := osExec.Command("ffmpeg", "-y", "-hide_banner", "-i", v.TmpVideoConvertPath, "-c", "copy", "-start_number", "0", "-hls_time", "10", "-hls_list_size", "0", "-hls_segment_filename", fmt.Sprintf("/tmp/%s_%s-video_hls%s/%s_segment%s.ts", v.ExtID, v.ID, "%v", v.ExtID, "%d"), "-f", "hls", fmt.Sprintf("/tmp/%s_%s-video_hls%s/%s-video.m3u8", v.ExtID, v.ID, "%v", v.ExtID)) videoConverLogFile, err := os.Open(fmt.Sprintf("/logs/%s-video-convert.log", v.ID)) if err != nil { @@ -271,9 +271,14 @@ func DownloadTwitchLiveVideo(ctx context.Context, v *ent.Vod, ch *ent.Channel, l streamURL = fmt.Sprintf("https://twitch.tv/%s", ch.Name) } - // streamlink livestreams do not use the 30 fps suffic + // streamlink livestreams do not use the 30 fps suffix v.Resolution = strings.Replace(v.Resolution, "30", "", 1) + // streamlink livestreams expect 'audio_only' instead of 'audio' + if v.Resolution == "audio" { + v.Resolution = "audio_only" + } + // Generate args for exec args := []string{"--progress=force", "--force", streamURL, fmt.Sprintf("%s,best", v.Resolution)} @@ -297,7 +302,7 @@ func DownloadTwitchLiveVideo(ctx context.Context, v *ent.Vod, ch *ent.Channel, l } } - cmdArgs := append(filteredArgs, "-o", fmt.Sprintf("/tmp/%s_%s-video.mp4", v.ExtID, v.ID)) + cmdArgs := append(filteredArgs, "-o", v.TmpVideoDownloadPath) log.Debug().Msgf("streamlink live args: %v", cmdArgs) log.Debug().Msgf("running: streamlink %s", strings.Join(cmdArgs, " ")) @@ -359,7 +364,7 @@ func DownloadTwitchLiveChat(ctx context.Context, v *ent.Vod, ch *ent.Channel, q return err } - cmd := osExec.Command("chat_downloader", fmt.Sprintf("https://twitch.tv/%s", ch.Name), "--output", fmt.Sprintf("/tmp/%s_%s-live-chat.json", v.ExtID, v.ID), "-q") + cmd := osExec.Command("chat_downloader", fmt.Sprintf("https://twitch.tv/%s", ch.Name), "--output", v.TmpLiveChatDownloadPath, "-q") chatLogfile, err := os.Create(fmt.Sprintf("/logs/%s-chat.log", v.ID)) if err != nil { @@ -434,7 +439,7 @@ func GetFfprobeData(path string) (map[string]interface{}, error) { func TwitchChatUpdate(v *ent.Vod) error { - cmd := osExec.Command("TwitchDownloaderCLI", "chatupdate", "-i", fmt.Sprintf("/tmp/%s_%s-chat-convert.json", v.ExtID, v.ID), "--embed-missing", "-o", fmt.Sprintf("/tmp/%s_%s-chat.json", v.ExtID, v.ID)) + cmd := osExec.Command("TwitchDownloaderCLI", "chatupdate", "-i", v.TmpLiveChatConvertPath, "--embed-missing", "-o", v.TmpChatDownloadPath) chatLogfile, err := os.Create(fmt.Sprintf("/logs/%s-chat-convert.log", v.ID)) if err != nil { diff --git a/internal/transport/http/archive.go b/internal/transport/http/archive.go index 172d2c7e..6f956784 100644 --- a/internal/transport/http/archive.go +++ b/internal/transport/http/archive.go @@ -3,7 +3,6 @@ package http import ( "net/http" - "github.com/google/uuid" "github.com/labstack/echo/v4" "github.com/zibbp/ganymede/ent" "github.com/zibbp/ganymede/internal/archive" @@ -13,7 +12,6 @@ import ( type ArchiveService interface { ArchiveTwitchChannel(cName string) (*ent.Channel, error) ArchiveTwitchVod(vID string, quality string, chat bool, renderChat bool) (*archive.TwitchVodResponse, error) - RestartTask(c echo.Context, qID uuid.UUID, task string, cont bool) error } type ArchiveChannelRequest struct { @@ -21,17 +19,11 @@ type ArchiveChannelRequest struct { } type ArchiveVodRequest struct { VodID string `json:"vod_id" validate:"required"` - Quality utils.VodQuality `json:"quality" validate:"required,oneof=best source 720p60 480p30 360p30 160p30 480p 360p 160p"` + Quality utils.VodQuality `json:"quality" validate:"required,oneof=best source 720p60 480p30 360p30 160p30 480p 360p 160p audio"` Chat bool `json:"chat"` RenderChat bool `json:"render_chat"` } -type RestartTaskRequest struct { - QueueID string `json:"queue_id" validate:"required"` - Task string `json:"task" validate:"required,oneof=vod_create_folder vod_download_thumbnail vod_save_info video_download video_convert video_move chat_download chat_convert chat_render chat_move"` - Cont bool `json:"cont"` -} - // ArchiveTwitchChannel godoc // // @Summary Archive a twitch channel @@ -87,38 +79,3 @@ func (h *Handler) ArchiveTwitchVod(c echo.Context) error { } return c.JSON(http.StatusOK, vod) } - -// RestartTask godoc -// -// @Summary Restart a task -// @Description Restart a task -// @Tags archive -// @Accept json -// @Produce json -// @Param queue_id path string true "Queue ID" -// @Param task body RestartTaskRequest true "Task" -// @Success 200 -// @Failure 400 {object} utils.ErrorResponse -// @Failure 500 {object} utils.ErrorResponse -// @Router /archive/restart [post] -// @Security ApiKeyCookieAuth -func (h *Handler) RestartTask(c echo.Context) error { - rtr := new(RestartTaskRequest) - if err := c.Bind(rtr); err != nil { - return echo.NewHTTPError(http.StatusBadRequest, err.Error()) - } - if err := c.Validate(rtr); err != nil { - return echo.NewHTTPError(http.StatusBadRequest, err.Error()) - } - qUUID, err := uuid.Parse(rtr.QueueID) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, err.Error()) - } - - err = h.Service.ArchiveService.RestartTask(c, qUUID, rtr.Task, rtr.Cont) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) - } - - return c.NoContent(http.StatusOK) -} diff --git a/internal/transport/http/handler.go b/internal/transport/http/handler.go index 9efdae77..19d84394 100644 --- a/internal/transport/http/handler.go +++ b/internal/transport/http/handler.go @@ -205,7 +205,6 @@ func groupV1Routes(e *echo.Group, h *Handler) { archiveGroup := e.Group("/archive") archiveGroup.POST("/channel", h.ArchiveTwitchChannel, auth.GuardMiddleware, auth.GetUserMiddleware, auth.UserRoleMiddleware(utils.ArchiverRole)) archiveGroup.POST("/vod", h.ArchiveTwitchVod, auth.GuardMiddleware, auth.GetUserMiddleware, auth.UserRoleMiddleware(utils.ArchiverRole)) - archiveGroup.POST("/restart", h.RestartTask, auth.GuardMiddleware, auth.GetUserMiddleware, auth.UserRoleMiddleware(utils.ArchiverRole)) // Admin adminGroup := e.Group("/admin") diff --git a/internal/transport/http/live.go b/internal/transport/http/live.go index d38cec01..118c07f4 100644 --- a/internal/transport/http/live.go +++ b/internal/transport/http/live.go @@ -26,7 +26,7 @@ type AddWatchedChannelRequest struct { DownloadHighlights bool `json:"download_highlights" validate:"boolean"` DownloadUploads bool `json:"download_uploads" validate:"boolean"` ChannelID string `json:"channel_id" validate:"required"` - Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30"` + Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30 audio"` ArchiveChat bool `json:"archive_chat" validate:"boolean"` RenderChat bool `json:"render_chat" validate:"boolean"` DownloadSubOnly bool `json:"download_sub_only" validate:"boolean"` @@ -48,7 +48,7 @@ type AddMultipleWatchedChannelRequest struct { DownloadHighlights bool `json:"download_highlights" ` DownloadUploads bool `json:"download_uploads"` ChannelID []string `json:"channel_id" validate:"required"` - Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30"` + Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30 audio"` ArchiveChat bool `json:"archive_chat"` RenderChat bool `json:"render_chat"` DownloadSubOnly bool `json:"download_sub_only"` @@ -62,7 +62,7 @@ type UpdateWatchedChannelRequest struct { DownloadArchives bool `json:"download_archives" validate:"boolean"` DownloadHighlights bool `json:"download_highlights" validate:"boolean"` DownloadUploads bool `json:"download_uploads" validate:"boolean"` - Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30"` + Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30 audio"` ArchiveChat bool `json:"archive_chat" validate:"boolean"` RenderChat bool `json:"render_chat" validate:"boolean"` DownloadSubOnly bool `json:"download_sub_only" validate:"boolean"` @@ -82,7 +82,7 @@ type ConvertChatRequest struct { type ArchiveLiveChannelRequest struct { ChannelID string `json:"channel_id" validate:"required"` - Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30"` + Resolution string `json:"resolution" validate:"required,oneof=best source 720p60 480p 360p 160p 480p30 360p30 160p30 audio"` ArchiveChat bool `json:"archive_chat"` RenderChat bool `json:"render_chat"` } diff --git a/internal/vod/vod.go b/internal/vod/vod.go index da2e28cf..5d78f943 100644 --- a/internal/vod/vod.go +++ b/internal/vod/vod.go @@ -34,28 +34,36 @@ func NewService(store *database.Database) *Service { } type Vod struct { - ID uuid.UUID `json:"id"` - ExtID string `json:"ext_id"` - Platform utils.VodPlatform `json:"platform"` - Type utils.VodType `json:"type"` - Title string `json:"title"` - Duration int `json:"duration"` - Views int `json:"views"` - Resolution string `json:"resolution"` - Processing bool `json:"processing"` - ThumbnailPath string `json:"thumbnail_path"` - WebThumbnailPath string `json:"web_thumbnail_path"` - VideoPath string `json:"video_path"` - ChatPath string `json:"chat_path"` - ChatVideoPath string `json:"chat_video_path"` - InfoPath string `json:"info_path"` - CaptionPath string `json:"caption_path"` - StreamedAt time.Time `json:"streamed_at"` - UpdatedAt time.Time `json:"updated_at"` - CreatedAt time.Time `json:"created_at"` - FolderName string `json:"folder_name"` - FileName string `json:"file_name"` - Locked bool `json:"locked"` + ID uuid.UUID `json:"id"` + ExtID string `json:"ext_id"` + Platform utils.VodPlatform `json:"platform"` + Type utils.VodType `json:"type"` + Title string `json:"title"` + Duration int `json:"duration"` + Views int `json:"views"` + Resolution string `json:"resolution"` + Processing bool `json:"processing"` + ThumbnailPath string `json:"thumbnail_path"` + WebThumbnailPath string `json:"web_thumbnail_path"` + VideoPath string `json:"video_path"` + ChatPath string `json:"chat_path"` + LiveChatPath string `json:"live_chat_path"` + LiveChatConvertPath string `json:"live_chat_convert_path"` + ChatVideoPath string `json:"chat_video_path"` + InfoPath string `json:"info_path"` + CaptionPath string `json:"caption_path"` + StreamedAt time.Time `json:"streamed_at"` + UpdatedAt time.Time `json:"updated_at"` + CreatedAt time.Time `json:"created_at"` + FolderName string `json:"folder_name"` + FileName string `json:"file_name"` + Locked bool `json:"locked"` + TmpVideoDownloadPath string `json:"tmp_video_download_path"` + TmpVideoConvertPath string `json:"tmp_video_convert_path"` + TmpChatDownloadPath string `json:"tmp_chat_download_path"` + TmpLiveChatDownloadPath string `json:"tmp_live_chat_download_path"` + TmpLiveChatConvertPath string `json:"tmp_live_chat_convert_path"` + TmpChatRenderPath string `json:"tmp_chat_render_path"` } type Pagination struct { @@ -73,7 +81,7 @@ type MutedSegment struct { } func (s *Service) CreateVod(vodDto Vod, cUUID uuid.UUID) (*ent.Vod, error) { - v, err := s.Store.Client.Vod.Create().SetID(vodDto.ID).SetChannelID(cUUID).SetExtID(vodDto.ExtID).SetPlatform(vodDto.Platform).SetType(vodDto.Type).SetTitle(vodDto.Title).SetDuration(vodDto.Duration).SetViews(vodDto.Views).SetResolution(vodDto.Resolution).SetProcessing(vodDto.Processing).SetThumbnailPath(vodDto.ThumbnailPath).SetWebThumbnailPath(vodDto.WebThumbnailPath).SetVideoPath(vodDto.VideoPath).SetChatPath(vodDto.ChatPath).SetChatVideoPath(vodDto.ChatVideoPath).SetInfoPath(vodDto.InfoPath).SetCaptionPath(vodDto.CaptionPath).SetStreamedAt(vodDto.StreamedAt).SetFolderName(vodDto.FolderName).SetFileName(vodDto.FileName).SetLocked(vodDto.Locked).Save(context.Background()) + v, err := s.Store.Client.Vod.Create().SetID(vodDto.ID).SetChannelID(cUUID).SetExtID(vodDto.ExtID).SetPlatform(vodDto.Platform).SetType(vodDto.Type).SetTitle(vodDto.Title).SetDuration(vodDto.Duration).SetViews(vodDto.Views).SetResolution(vodDto.Resolution).SetProcessing(vodDto.Processing).SetThumbnailPath(vodDto.ThumbnailPath).SetWebThumbnailPath(vodDto.WebThumbnailPath).SetVideoPath(vodDto.VideoPath).SetChatPath(vodDto.ChatPath).SetChatVideoPath(vodDto.ChatVideoPath).SetInfoPath(vodDto.InfoPath).SetCaptionPath(vodDto.CaptionPath).SetStreamedAt(vodDto.StreamedAt).SetFolderName(vodDto.FolderName).SetFileName(vodDto.FileName).SetLocked(vodDto.Locked).SetTmpVideoDownloadPath(vodDto.TmpVideoDownloadPath).SetTmpVideoConvertPath(vodDto.TmpVideoConvertPath).SetTmpChatDownloadPath(vodDto.TmpChatDownloadPath).SetTmpLiveChatDownloadPath(vodDto.TmpLiveChatDownloadPath).SetTmpLiveChatConvertPath(vodDto.TmpLiveChatConvertPath).SetTmpChatRenderPath(vodDto.TmpChatRenderPath).SetLiveChatPath(vodDto.LiveChatPath).SetLiveChatConvertPath(vodDto.LiveChatConvertPath).Save(context.Background()) if err != nil { log.Debug().Err(err).Msg("error creating vod") if _, ok := err.(*ent.ConstraintError); ok {