Add support for rar extraction
This commit is contained in:
@@ -28,7 +28,7 @@ type ConfigInterface interface {
|
||||
GetDownloadTimeoutSecs() int
|
||||
GetRetriesUntilFailed() int
|
||||
GetRateLimitSleepSecs() int
|
||||
ShouldDeleteRarFiles() bool
|
||||
GetRarAction() string
|
||||
GetDownloadsEveryMins() int
|
||||
GetDumpTorrentsEveryMins() int
|
||||
GetPlayableExtensions() []string
|
||||
@@ -41,7 +41,6 @@ type ZurgConfig struct {
|
||||
|
||||
ApiTimeoutSecs int `yaml:"api_timeout_secs" json:"api_timeout_secs"`
|
||||
CanRepair bool `yaml:"enable_repair" json:"enable_repair"`
|
||||
DeleteRarFiles bool `yaml:"auto_delete_rar_torrents" json:"auto_delete_rar_torrents"`
|
||||
DownloadsEveryMins int `yaml:"downloads_every_mins" json:"downloads_every_mins"`
|
||||
DownloadsLimit int `yaml:"downloads_limit" json:"downloads_limit"`
|
||||
DumpTorrentsEveryMins int `yaml:"dump_torrents_every_mins" json:"dump_torrents_every_mins"`
|
||||
@@ -65,6 +64,7 @@ type ZurgConfig struct {
|
||||
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
|
||||
TorrentsCount int `yaml:"get_torrents_count" json:"get_torrents_count"`
|
||||
Username string `yaml:"username" json:"username"`
|
||||
RarAction string `yaml:"rar_action" json:"rar_action"`
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetConfig() ZurgConfig {
|
||||
@@ -205,8 +205,15 @@ func (z *ZurgConfig) GetRateLimitSleepSecs() int {
|
||||
return z.RateLimitSleepSecs
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) ShouldDeleteRarFiles() bool {
|
||||
return z.DeleteRarFiles
|
||||
// GetRarAction returns the action to take when a rar'ed torrent is found
|
||||
// none: do nothing (mark as unrepairable)
|
||||
// extract: extract the rar'ed torrent
|
||||
// delete: delete the rar'ed torrent
|
||||
func (z *ZurgConfig) GetRarAction() string {
|
||||
if z.RarAction == "" {
|
||||
return "none"
|
||||
}
|
||||
return z.RarAction
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetPlayableExtensions() []string {
|
||||
|
||||
@@ -267,6 +267,17 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
|
||||
}
|
||||
return checkArithmeticSequenceInFilenames(fileNames)
|
||||
}
|
||||
if filter.IsMusic {
|
||||
musicExts := []string{".m3u", ".mp3", ".flac"}
|
||||
for _, filename := range fileNames {
|
||||
for _, ext := range musicExts {
|
||||
if strings.HasSuffix(strings.ToLower(filename), ext) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
if filter.FileInsideSizeGreaterThanOrEqual > 0 {
|
||||
for _, fileSize := range fileSizes {
|
||||
if fileSize >= filter.FileInsideSizeGreaterThanOrEqual {
|
||||
|
||||
@@ -41,4 +41,5 @@ type FilterConditionsV1 struct {
|
||||
FileInsideSizeLessThanOrEqual int64 `yaml:"any_file_inside_size_lte"`
|
||||
|
||||
HasEpisodes bool `yaml:"has_episodes"`
|
||||
IsMusic bool `yaml:"is_music"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user