rename package
This commit is contained in:
+10
-10
@@ -6,22 +6,22 @@ import (
|
||||
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
v0proto "github.com/owncloud/ocis-thumbnails/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails/imgsource"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails/storage"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail/imgsource"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail/storage"
|
||||
)
|
||||
|
||||
// NewService returns a service implementation for Service.
|
||||
func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
|
||||
options := newOptions(opts...)
|
||||
logger := options.Logger
|
||||
resolutions, err := resolutions.New(options.Config.Thumbnail.Resolutions)
|
||||
resolutions, err := resolution.New(options.Config.Thumbnail.Resolutions)
|
||||
if err != nil {
|
||||
logger.Fatal().Err(err).Msg("resolutions not configured correctly")
|
||||
}
|
||||
svc := Thumbnail{
|
||||
manager: thumbnails.NewSimpleManager(
|
||||
manager: thumbnail.NewSimpleManager(
|
||||
storage.NewFileSystemStorage(
|
||||
options.Config.Thumbnail.FileSystemStorage,
|
||||
logger,
|
||||
@@ -38,21 +38,21 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
|
||||
|
||||
// Thumbnail implements the GRPC handler.
|
||||
type Thumbnail struct {
|
||||
manager thumbnails.Manager
|
||||
resolutions resolutions.Resolutions
|
||||
manager thumbnail.Manager
|
||||
resolutions resolution.Resolutions
|
||||
source imgsource.Source
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
// GetThumbnail retrieves a thumbnail for an image
|
||||
func (g Thumbnail) GetThumbnail(ctx context.Context, req *v0proto.GetRequest, rsp *v0proto.GetResponse) error {
|
||||
encoder := thumbnails.EncoderForType(req.Filetype.String())
|
||||
encoder := thumbnail.EncoderForType(req.Filetype.String())
|
||||
if encoder == nil {
|
||||
// TODO: better error responses
|
||||
return fmt.Errorf("can't be encoded. filetype %s not supported", req.Filetype.String())
|
||||
}
|
||||
r := g.resolutions.ClosestMatch(int(req.Width), int(req.Height))
|
||||
tr := thumbnails.Request{
|
||||
tr := thumbnail.Request{
|
||||
Resolution: r,
|
||||
ImagePath: req.Filepath,
|
||||
Encoder: encoder,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package thumbnails
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"image"
|
||||
@@ -1,4 +1,4 @@
|
||||
package resolutions
|
||||
package resolution
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package resolutions
|
||||
package resolution
|
||||
|
||||
import "testing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package resolutions
|
||||
package resolution
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package resolutions
|
||||
package resolution
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@@ -1,12 +1,12 @@
|
||||
package storage
|
||||
|
||||
import "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions"
|
||||
import "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution"
|
||||
|
||||
// Request combines different attributes needed for storage operations.
|
||||
type Request struct {
|
||||
ETag string
|
||||
Types []string
|
||||
Resolution resolutions.Resolution
|
||||
Resolution resolution.Resolution
|
||||
}
|
||||
|
||||
// Storage defines the interface for a thumbnail store.
|
||||
@@ -1,4 +1,4 @@
|
||||
package thumbnails
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
|
||||
"github.com/nfnt/resize"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnails/storage"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/thumbnail/storage"
|
||||
)
|
||||
|
||||
// Request bundles information needed to generate a thumbnail for afile
|
||||
type Request struct {
|
||||
Resolution resolutions.Resolution
|
||||
Resolution resolution.Resolution
|
||||
ImagePath string
|
||||
Encoder Encoder
|
||||
ETag string
|
||||
Reference in New Issue
Block a user