mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 01:59:00 +08:00
Merge d101fb2a5d575e2157f11891b60995c904ebe357 into 267eebe5c9f360afc2b7ec0658f3133bc51215e0
This commit is contained in:
commit
9e8fd5fe0d
@ -34,6 +34,8 @@ import (
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"golang.org/x/oauth2/google"
|
||||
|
||||
"github.com/barasher/go-exiftool"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -1022,6 +1024,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
||||
// input to the batcher
|
||||
type uploadedItem struct {
|
||||
AlbumID string // desired album
|
||||
ImageTitle string // Title taken from the EXIF XMP Title
|
||||
UploadToken string // upload ID
|
||||
}
|
||||
|
||||
@ -1039,6 +1042,7 @@ func (f *Fs) commitBatchAlbumID(ctx context.Context, items []uploadedItem, resul
|
||||
for i := range items {
|
||||
if items[i].AlbumID == albumID {
|
||||
request.NewMediaItems = append(request.NewMediaItems, api.NewMediaItem{
|
||||
Description: items[i].ImageTitle,
|
||||
SimpleMediaItem: api.SimpleMediaItem{
|
||||
UploadToken: items[i].UploadToken,
|
||||
},
|
||||
@ -1155,8 +1159,13 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
return errors.New("empty upload token")
|
||||
}
|
||||
|
||||
et, err := exiftool.NewExiftool()
|
||||
fileInfos := et.ExtractMetadata(fileName)
|
||||
exifTitle, err := fileInfos[0].GetString("Title")
|
||||
|
||||
uploaded := uploadedItem{
|
||||
AlbumID: albumID,
|
||||
ImageTitle: exifTitle,
|
||||
UploadToken: uploadToken,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user