refactor: imports
This commit is contained in:
3
cache/cache.go
vendored
3
cache/cache.go
vendored
@@ -3,11 +3,12 @@ package cache
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/lefelys/state"
|
||||
"github.com/rs/zerolog"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
1
cache/delete.go
vendored
1
cache/delete.go
vendored
@@ -2,6 +2,7 @@ package cache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
|
||||
3
cache/delete_test.go
vendored
3
cache/delete_test.go
vendored
@@ -1,8 +1,9 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"testing"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
func TestClient_Delete(t *testing.T) {
|
||||
|
||||
1
cache/get.go
vendored
1
cache/get.go
vendored
@@ -2,6 +2,7 @@ package cache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
|
||||
3
cache/get_test.go
vendored
3
cache/get_test.go
vendored
@@ -1,10 +1,11 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
func TestClient_Get(t *testing.T) {
|
||||
|
||||
3
cache/put.go
vendored
3
cache/put.go
vendored
@@ -2,8 +2,9 @@ package cache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
func (c *Client) Put(bucket string, key string, val []byte, ttl time.Duration) error {
|
||||
|
||||
3
cache/put_test.go
vendored
3
cache/put_test.go
vendored
@@ -1,10 +1,11 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
func TestClient_Put(t *testing.T) {
|
||||
|
||||
3
cache/test.go
vendored
3
cache/test.go
vendored
@@ -1,8 +1,9 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"testing"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
func newDb(t *testing.T) *badger.DB {
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/kirsle/configdir"
|
||||
"golang.org/x/sys/unix"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kirsle/configdir"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func defaultConfigPath() string {
|
||||
|
||||
@@ -3,9 +3,10 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/kirsle/configdir"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kirsle/configdir"
|
||||
)
|
||||
|
||||
func defaultConfigPath() string {
|
||||
|
||||
@@ -3,6 +3,12 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/l3uddz/nabarr"
|
||||
@@ -15,11 +21,6 @@ import (
|
||||
"github.com/natefinch/lumberjack"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
|
||||
@@ -2,13 +2,14 @@ package pvr
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/cache"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/radarr"
|
||||
"github.com/l3uddz/nabarr/sonarr"
|
||||
"github.com/lefelys/state"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type PVR interface {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func waitShutdown() {
|
||||
|
||||
@@ -3,11 +3,12 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
"github.com/blang/semver"
|
||||
"github.com/l3uddz/nabarr/build"
|
||||
"github.com/rhysd/go-github-selfupdate/selfupdate"
|
||||
"os"
|
||||
)
|
||||
|
||||
type updateFlag string
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/alecthomas/kong"
|
||||
)
|
||||
|
||||
|
||||
1
go.sum
1
go.sum
@@ -356,7 +356,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220401154927-543a649e0bdd h1:zYlwaUHTmxuf6H7hwO2dgwqozQmH7zf4x+/qql4oVWc=
|
||||
golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
|
||||
@@ -2,6 +2,7 @@ package media
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/media/omdb"
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
|
||||
@@ -3,9 +3,10 @@ package media
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
)
|
||||
|
||||
func (c *Client) GetMovieInfo(item *FeedItem) (*Item, error) {
|
||||
|
||||
@@ -4,10 +4,11 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package omdb
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"go.uber.org/ratelimit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -3,8 +3,9 @@ package media
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
"strconv"
|
||||
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
)
|
||||
|
||||
func (c *Client) GetShowInfo(item *FeedItem) (*Item, error) {
|
||||
|
||||
@@ -2,12 +2,13 @@ package media
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/media/omdb"
|
||||
"github.com/l3uddz/nabarr/media/tvdb"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/pkg/errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
/* Media Item(s) */
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package trakt
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"go.uber.org/ratelimit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
)
|
||||
|
||||
@@ -2,12 +2,13 @@ package tvdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"go.uber.org/ratelimit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package nabarr
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExprProgram struct {
|
||||
|
||||
@@ -4,13 +4,14 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -2,6 +2,7 @@ package radarr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
|
||||
@@ -3,6 +3,7 @@ package radarr
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/lefelys/state"
|
||||
|
||||
@@ -2,15 +2,16 @@ package radarr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/cache"
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -2,10 +2,11 @@ package rss
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/cmd/nabarr/pvr"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/robfig/cron/v3"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (c *Client) AddJob(feed feedItem) error {
|
||||
|
||||
@@ -3,11 +3,12 @@ package rss
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (j *rssJob) process() error {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package rss
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/cache"
|
||||
"github.com/l3uddz/nabarr/cmd/nabarr/pvr"
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/lefelys/state"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/rs/zerolog"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package rss
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr/cache"
|
||||
"github.com/l3uddz/nabarr/cmd/nabarr/pvr"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/rs/zerolog"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type feedItem struct {
|
||||
|
||||
@@ -4,13 +4,14 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lucperkins/rek"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -2,6 +2,7 @@ package sonarr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
|
||||
@@ -3,11 +3,12 @@ package sonarr
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/lefelys/state"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (c *Client) QueueFeedItem(item *media.FeedItem) {
|
||||
|
||||
@@ -2,15 +2,16 @@ package sonarr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/l3uddz/nabarr"
|
||||
"github.com/l3uddz/nabarr/cache"
|
||||
"github.com/l3uddz/nabarr/logger"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/rs/zerolog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-retryablehttp"
|
||||
"github.com/l3uddz/nabarr/build"
|
||||
"github.com/rs/zerolog"
|
||||
"go.uber.org/ratelimit"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewRetryableHttpClient(timeout time.Duration, rl ratelimit.Limiter, log *zerolog.Logger) *http.Client {
|
||||
|
||||
Reference in New Issue
Block a user