This commit is contained in:
Ben Sarmiento
2023-10-20 01:27:30 +02:00
parent 987542f89b
commit 1117e777ff
6 changed files with 12 additions and 59 deletions

3
.gitignore vendored
View File

@@ -25,3 +25,6 @@ data/
# Executables # Executables
rclone rclone
main main
zurg
config.yml

View File

@@ -1,50 +0,0 @@
# Zurg configuration version
zurg: v1
# List of directory definitions and their filtering rules
directories:
# Configuration for TV shows
shows:
group: media # directories on different groups have duplicates of the same torrent
filters:
- regex: /season[\s\.]?\d/i # Capture torrent names with the term 'season' in any case
- regex: /Saison[\s\.]?\d/i # For non-English namings
- regex: /stage[\s\.]?\d/i
- regex: /s\d\d/i # Capture common season notations like S01, S02, etc.
# Configuration for movies
movies:
group: media # because movies and shows are in the same group, and shows come first before movies, all torrents that doesn't fall into shows will fall into movies
filters:
- regex: /.*/ # you cannot leave a directory without filters because it will not have any torrents in it
# Configuration for remuxes
remuxes:
group: def
filters:
- contains: remux # Specifically target remuxed content
# Configuration for Dolby Vision content
"dolby vision":
group: random
filters:
- and:
- regex: /\bdovi\b/i # Matches abbreviations of 'dolby vision'
- contains: 4k # you can be quite greedy here, dolby vision + 4k!
# Configuration for children's content
kids:
group: kids
filters:
- or: # you can also group conditions with 'or' which is useful especially inside 'and' conditions
- not_contains: xxx # Ensures adult content is excluded
- not_contains_strict: trailer # strict vs non-strict is just about case sensitivity; this ensures trailers aren't added
- id: XFPQ5UCMUVAEG # Specific inclusion by torrent ID
- id: VDRPYNRPQHEXC
- id: YELNX3XR5XJQM
all:
group: default # because movies and shows are in the same group, and shows come first before movies, all torrents that doesn't fall into shows will fall into movies
filters:
- regex: /.*/

View File

@@ -67,7 +67,7 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent, t
torrentResponses = append(torrentResponses, dav.File( torrentResponses = append(torrentResponses, dav.File(
filePath, filePath,
file.Bytes, file.Bytes,
convertDate(torrent.Added), convertRFC3339toRFC1123(torrent.Added),
file.Link, file.Link,
)) ))
} }

View File

@@ -8,8 +8,8 @@ import (
"github.com/debridmediamanager.com/zurg/internal/torrent" "github.com/debridmediamanager.com/zurg/internal/torrent"
) )
// convertDate converts a date from RFC3339 to RFC1123 // convertRFC3339toRFC1123 converts a date from RFC3339 to RFC1123
func convertDate(input string) string { func convertRFC3339toRFC1123(input string) string {
t, err := time.Parse(time.RFC3339, input) t, err := time.Parse(time.RFC3339, input)
if err != nil { if err != nil {
log.Println("Error:", err) log.Println("Error:", err)

View File

@@ -5,8 +5,7 @@ func Directory(path string) Response {
Href: customPathEscape(path), Href: customPathEscape(path),
Propstat: PropStat{ Propstat: PropStat{
Prop: Prop{ Prop: Prop{
ResourceType: ResourceType{Collection: &struct{}{}}, ResourceType: ResourceType{Value: "<d:collection/>"},
ContentType: "httpd/unix-directory",
}, },
Status: "HTTP/1.1 200 OK", Status: "HTTP/1.1 200 OK",
}, },

View File

@@ -1,6 +1,8 @@
package dav package dav
import "encoding/xml" import (
"encoding/xml"
)
type MultiStatus struct { type MultiStatus struct {
XMLName xml.Name `xml:"d:multistatus"` XMLName xml.Name `xml:"d:multistatus"`
@@ -19,13 +21,12 @@ type PropStat struct {
} }
type Prop struct { type Prop struct {
ResourceType ResourceType `xml:"d:resourcetype,omitempty"` ResourceType ResourceType `xml:"d:resourcetype"`
ContentLength int64 `xml:"d:getcontentlength,omitempty"` ContentLength int64 `xml:"d:getcontentlength,omitempty"`
CreationDate string `xml:"d:creationdate,omitempty"` CreationDate string `xml:"d:creationdate,omitempty"`
LastModified string `xml:"d:getlastmodified,omitempty"` LastModified string `xml:"d:getlastmodified,omitempty"`
ContentType string `xml:"d:getcontenttype,omitempty"`
} }
type ResourceType struct { type ResourceType struct {
Collection *struct{} `xml:"d:collection,omitempty"` Value string `xml:",innerxml"`
} }