models.go
| 1 | package models |
| 2 | |
| 3 | import ( |
| 4 | "database/sql" |
| 5 | "time" |
| 6 | ) |
| 7 | |
| 8 | type Preset struct { |
| 9 | ID int64 |
| 10 | Name string |
| 11 | Description string |
| 12 | IsDefault bool |
| 13 | FormatMode string |
| 14 | Format string |
| 15 | Quality string |
| 16 | CustomFormat string |
| 17 | ExtractAudio bool |
| 18 | AudioFormat string |
| 19 | EmbedSubs bool |
| 20 | SubLangs string |
| 21 | EmbedThumbnail bool |
| 22 | EmbedMetadata bool |
| 23 | WriteInfoJSON bool |
| 24 | WriteComments bool |
| 25 | CommentSort string |
| 26 | MaxComments int |
| 27 | CommentExtractorArgs string |
| 28 | CustomFlags string |
| 29 | CreatedAt time.Time |
| 30 | } |
| 31 | |
| 32 | type LibraryItem struct { |
| 33 | Name string |
| 34 | RelPath string |
| 35 | DirPath string |
| 36 | SourceURL string |
| 37 | Duration int |
| 38 | Description string |
| 39 | YtdlpFlags string |
| 40 | MediaFiles []MediaFile |
| 41 | } |
| 42 | |
| 43 | type MediaFile struct { |
| 44 | Filename string |
| 45 | Filepath string |
| 46 | IsAudio bool |
| 47 | Duration int |
| 48 | } |
| 49 | |
| 50 | type Download struct { |
| 51 | ID int64 |
| 52 | URL string |
| 53 | Status string |
| 54 | Logs sql.NullString |
| 55 | ErrorMessage sql.NullString |
| 56 | PresetID sql.NullInt64 |
| 57 | FormatOverride string |
| 58 | CustomFlags string |
| 59 | OutputDir sql.NullString |
| 60 | SubscriptionID sql.NullInt64 |
| 61 | StartedAt sql.NullTime |
| 62 | CompletedAt sql.NullTime |
| 63 | CreatedAt time.Time |
| 64 | } |
| 65 | |
| 66 | // Subscription is a saved URL the scheduler re-downloads. Each one owns its |
| 67 | // OutputDir: dedup and pruning are scoped to that directory. |
| 68 | type Subscription struct { |
| 69 | ID int64 |
| 70 | Name string |
| 71 | URL string |
| 72 | Enabled bool |
| 73 | RefreshMode string // "overwrite" | "skip" | "metadata" |
| 74 | ScheduleKind string // "hourly" | "daily" | "weekly" | "monthly" | "cron" |
| 75 | CronExpr string |
| 76 | PresetID sql.NullInt64 |
| 77 | FormatOverride string |
| 78 | CustomFlags string |
| 79 | OutputDir string |
| 80 | PruneRemoved bool |
| 81 | LastRunAt sql.NullTime |
| 82 | NextRunAt sql.NullTime |
| 83 | LastStatus sql.NullString |
| 84 | CreatedAt time.Time |
| 85 | } |
| 86 | |
| 87 | type Settings struct { |
| 88 | RefreshInterval int |
| 89 | AutoRefreshLibrary bool |
| 90 | AutoRefreshDownloads bool |
| 91 | Cookies string |
| 92 | // ToolAutoUpdate lets the scheduler run the managed tools' own updaters once |
| 93 | // a day. ToolsCheckedAt is when it last did, zero if never. |
| 94 | ToolAutoUpdate bool |
| 95 | ToolsCheckedAt time.Time |
| 96 | JSRuntimeEnabled bool |
| 97 | } |
| 98 | |
| 99 | type FormatInfo struct { |
| 100 | ID string |
| 101 | Ext string |
| 102 | Resolution string |
| 103 | FPS string |
| 104 | Channels string |
| 105 | FileSize string |
| 106 | Codec string |
| 107 | Note string |
| 108 | } |
| 109 | |
| 110 | type SubtitleTrack struct { |
| 111 | Lang string |
| 112 | Label string |
| 113 | Src string |
| 114 | } |
| 115 | |
| 116 | type Comment struct { |
| 117 | ID string |
| 118 | Parent string |
| 119 | Author string |
| 120 | Text string |
| 121 | Timestamp int64 |
| 122 | TimeText string |
| 123 | LikeCount int |
| 124 | AuthorIsUploader bool |
| 125 | ReplyTo string |
| 126 | Depth int |
| 127 | } |
| 128 | |
| 129 | type HeatmapSegment struct { |
| 130 | StartTime float64 |
| 131 | EndTime float64 |
| 132 | Value float64 |
| 133 | Width float64 |
| 134 | Height float64 |
| 135 | } |
| 136 | |
| 137 | type ItemMetadata struct { |
| 138 | Name string `toml:"name"` |
| 139 | SourceURL string `toml:"source_url"` |
| 140 | Description string `toml:"description"` |
| 141 | VideoID string `toml:"video_id"` |
| 142 | YtdlpFlags string `toml:"ytdlp_flags"` |
| 143 | FileDurations map[string]int `toml:"file_durations"` |
| 144 | } |
| 145 |