From 1117e777ff3482a0844078744d56fc2875698c57 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Fri, 20 Oct 2023 01:27:30 +0200 Subject: [PATCH] cleanup --- .gitignore | 3 +++ config.yml | 50 ---------------------------------------- internal/dav/response.go | 2 +- internal/dav/util.go | 4 ++-- pkg/dav/response.go | 3 +-- pkg/dav/types.go | 9 ++++---- 6 files changed, 12 insertions(+), 59 deletions(-) delete mode 100644 config.yml diff --git a/.gitignore b/.gitignore index dd3533c..a81ef8d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ data/ # Executables rclone main +zurg + +config.yml diff --git a/config.yml b/config.yml deleted file mode 100644 index 91a80c3..0000000 --- a/config.yml +++ /dev/null @@ -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: /.*/ diff --git a/internal/dav/response.go b/internal/dav/response.go index 83089b1..0a1c660 100644 --- a/internal/dav/response.go +++ b/internal/dav/response.go @@ -67,7 +67,7 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent, t torrentResponses = append(torrentResponses, dav.File( filePath, file.Bytes, - convertDate(torrent.Added), + convertRFC3339toRFC1123(torrent.Added), file.Link, )) } diff --git a/internal/dav/util.go b/internal/dav/util.go index 97ebba7..8e0770b 100644 --- a/internal/dav/util.go +++ b/internal/dav/util.go @@ -8,8 +8,8 @@ import ( "github.com/debridmediamanager.com/zurg/internal/torrent" ) -// convertDate converts a date from RFC3339 to RFC1123 -func convertDate(input string) string { +// convertRFC3339toRFC1123 converts a date from RFC3339 to RFC1123 +func convertRFC3339toRFC1123(input string) string { t, err := time.Parse(time.RFC3339, input) if err != nil { log.Println("Error:", err) diff --git a/pkg/dav/response.go b/pkg/dav/response.go index 549c4fc..14a1ca3 100644 --- a/pkg/dav/response.go +++ b/pkg/dav/response.go @@ -5,8 +5,7 @@ func Directory(path string) Response { Href: customPathEscape(path), Propstat: PropStat{ Prop: Prop{ - ResourceType: ResourceType{Collection: &struct{}{}}, - ContentType: "httpd/unix-directory", + ResourceType: ResourceType{Value: ""}, }, Status: "HTTP/1.1 200 OK", }, diff --git a/pkg/dav/types.go b/pkg/dav/types.go index 007934a..352df72 100644 --- a/pkg/dav/types.go +++ b/pkg/dav/types.go @@ -1,6 +1,8 @@ package dav -import "encoding/xml" +import ( + "encoding/xml" +) type MultiStatus struct { XMLName xml.Name `xml:"d:multistatus"` @@ -19,13 +21,12 @@ type PropStat struct { } type Prop struct { - ResourceType ResourceType `xml:"d:resourcetype,omitempty"` + ResourceType ResourceType `xml:"d:resourcetype"` ContentLength int64 `xml:"d:getcontentlength,omitempty"` CreationDate string `xml:"d:creationdate,omitempty"` LastModified string `xml:"d:getlastmodified,omitempty"` - ContentType string `xml:"d:getcontenttype,omitempty"` } type ResourceType struct { - Collection *struct{} `xml:"d:collection,omitempty"` + Value string `xml:",innerxml"` }