feat: download movie every 1h

This commit is contained in:
Simon Ding
2024-07-20 17:26:09 +08:00
parent 9adc1f418b
commit 2fe0a4187a
15 changed files with 240 additions and 128 deletions

View File

@@ -36,7 +36,7 @@ type Media struct {
// AirDate holds the value of the "air_date" field.
AirDate string `json:"air_date,omitempty"`
// Resolution holds the value of the "resolution" field.
Resolution string `json:"resolution,omitempty"`
Resolution media.Resolution `json:"resolution,omitempty"`
// StorageID holds the value of the "storage_id" field.
StorageID int `json:"storage_id,omitempty"`
// TargetDir holds the value of the "target_dir" field.
@@ -155,7 +155,7 @@ func (m *Media) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field resolution", values[i])
} else if value.Valid {
m.Resolution = value.String
m.Resolution = media.Resolution(value.String)
}
case media.FieldStorageID:
if value, ok := values[i].(*sql.NullInt64); !ok {
@@ -238,7 +238,7 @@ func (m *Media) String() string {
builder.WriteString(m.AirDate)
builder.WriteString(", ")
builder.WriteString("resolution=")
builder.WriteString(m.Resolution)
builder.WriteString(fmt.Sprintf("%v", m.Resolution))
builder.WriteString(", ")
builder.WriteString("storage_id=")
builder.WriteString(fmt.Sprintf("%v", m.StorageID))