mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
@@ -57,6 +57,7 @@ vimeo = "{VIMEO_API_TOKEN}"
|
||||
# cover_art = "{IMAGE_URL}" # Optional URL address of an image file
|
||||
# max_height = "720" # Optional maximal height of video, example: 720, 1080, 1440, 2160, ...
|
||||
# cron_schedule = "@every 12h" # Optional cron expression format. If set then overwrite 'update_period'. See details below
|
||||
# filters = { title = "regex for title here" } # Optional Golang regexp format. If set, then only download episodes with matching titles.
|
||||
```
|
||||
|
||||
Episodes files will be kept at: `/path/to/data/directory/ID1`, feed will be accessible from: `http://localhost/ID1.xml`
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -110,6 +111,18 @@ func (u *Updater) downloadEpisodes(ctx context.Context, feedConfig *config.Feed,
|
||||
return nil
|
||||
}
|
||||
|
||||
if feedConfig.Filters.Title != "" {
|
||||
matched, err := regexp.MatchString(feedConfig.Filters.Title, episode.Title)
|
||||
if err != nil {
|
||||
log.Warnf("Pattern '%s' is not a valid filter for %s Title", feedConfig.Filters.Title, feedConfig.ID)
|
||||
} else {
|
||||
if !matched {
|
||||
log.Infof("Skipping '%s' due to lack of match with '%s'", episode.Title, feedConfig.Filters.Title)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
downloadList = append(downloadList, episode)
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
||||
@@ -36,6 +36,8 @@ type Feed struct {
|
||||
Format model.Format `toml:"format"`
|
||||
// Custom image to use
|
||||
CoverArt string `toml:"cover_art"`
|
||||
// Only download episodes that match this regexp (defaults to matching anything)
|
||||
Filters Filters `toml:"filters"`
|
||||
}
|
||||
|
||||
type Tokens struct {
|
||||
@@ -156,3 +158,8 @@ func (d *Duration) UnmarshalText(text []byte) error {
|
||||
d.Duration, err = time.ParseDuration(string(text))
|
||||
return err
|
||||
}
|
||||
|
||||
type Filters struct {
|
||||
Title string `toml:"title"`
|
||||
// More filters to be added here
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user