mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(release): edge case resolution parsing (#243)
This commit is contained in:
parent
2a3b5ce448
commit
8592787b8b
2 changed files with 23 additions and 2 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/net/publicsuffix"
|
|
||||||
"html"
|
"html"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -18,6 +17,8 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/publicsuffix"
|
||||||
|
|
||||||
"github.com/autobrr/autobrr/pkg/wildcard"
|
"github.com/autobrr/autobrr/pkg/wildcard"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
|
@ -191,7 +192,7 @@ func (r *Release) extractEpisode() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Release) extractResolution() error {
|
func (r *Release) extractResolution() error {
|
||||||
v, err := findLast(r.TorrentName, `\b(?i)(([0-9]{3,4}p|i))\b`)
|
v, err := findLast(r.TorrentName, `\b(?i)[0-9]{3,4}(?:p|i)\b`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,26 @@ func TestRelease_Parse(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "parse_movies_case_1",
|
||||||
|
fields: Release{
|
||||||
|
TorrentName: "I Am Movie 2007 Theatrical UHD BluRay 2160p DTS-HD MA 5.1 DV HEVC HYBRID REMUX-GROUP1",
|
||||||
|
},
|
||||||
|
want: Release{
|
||||||
|
TorrentName: "I Am Movie 2007 Theatrical UHD BluRay 2160p DTS-HD MA 5.1 DV HEVC HYBRID REMUX-GROUP1",
|
||||||
|
Clean: "I Am Movie 2007 Theatrical UHD BluRay 2160p DTS HD MA 5 1 DV HEVC HYBRID REMUX GROUP1",
|
||||||
|
Resolution: "2160p",
|
||||||
|
Source: "BluRay",
|
||||||
|
Codec: "HEVC",
|
||||||
|
HDR: "DV",
|
||||||
|
Audio: "DTS-HD MA 5.1", // need to fix audio parsing
|
||||||
|
Edition: "Theatrical",
|
||||||
|
Hybrid: true,
|
||||||
|
Year: 2007,
|
||||||
|
Group: "GROUP1",
|
||||||
|
},
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue