Documentation ¶
Index ¶
- Variables
- func DatabaseNewFunc(dataSourceName string, newDB func(dataSourceName string) (Database, error)) func() (Database, error)
- func StorageNewFunc(root string, newStorage func(root string) (Storage, error)) func() (Storage, error)
- type Branch
- type Commit
- type DCIMDriver
- type DCIMSearchSuffix
- type DCIMSearchType
- type Database
- type Device
- type Dir
- type DirCalculatedInfo
- type DirItem
- func (d DirItem) GetAccessTime() uint64
- func (d DirItem) GetChangeTime() uint64
- func (d DirItem) GetCount() uint64
- func (d DirItem) GetCreateTime() uint64
- func (d DirItem) GetHash() string
- func (d DirItem) GetMode() uint64
- func (d DirItem) GetModifyTime() uint64
- func (d DirItem) GetName() string
- func (d DirItem) GetSize() uint64
- func (d DirItem) GetTotalCount() uint64
- type DirItemCheck
- type DirItemOpened
- type Driver
- type DriverFile
- func (d DriverFile) GetAccessTime() uint64
- func (d DriverFile) GetChangeTime() uint64
- func (d DriverFile) GetCreateTime() uint64
- func (d DriverFile) GetDirPath() []string
- func (d DriverFile) GetDriverId() uint64
- func (d DriverFile) GetHash() string
- func (d DriverFile) GetMode() uint64
- func (d DriverFile) GetModifyTime() uint64
- func (d DriverFile) GetName() string
- func (d DriverFile) GetSize() uint64
- type Exif
- type File
- type FileOrDir
- type FileType
- type HeightWidth
- type IBranch
- type IDirItem
- type IDriverFile
- type IFileOrDir
- type Metadata
- type SizedReadCloser
- type Storage
- type VideoMetadata
- type VideoMetadataFfmpeg
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrExpectedDir = errors.New("expected dir")
)
Functions ¶
func DatabaseNewFunc ¶
Types ¶
type Branch ¶
type Branch struct { Name string `json:"name"` Description string `json:"description"` CommitId uint64 `json:"commitId"` Size uint64 `json:"size"` Count uint64 `json:"count"` }
func (Branch) GetCommitId ¶
func (Branch) GetDescription ¶
type DCIMDriver ¶
type DCIMSearchSuffix ¶
type DCIMSearchType ¶
type Database ¶
type Database interface { IsSqlite() bool DataSourceName() string Size() (int64, error) Remove() error Create() error Close() error ResetBranch(ctx context.Context, branchName string) error NewBranch(ctx context.Context, branchName string) (exist bool, err error) DeleteBranch(ctx context.Context, branchName string) error BranchInfo(ctx context.Context, branchName string) (branch Branch, err error) BranchList(ctx context.Context) (branches []IBranch, err error) WriteCommit(ctx context.Context, commit *Commit) error WriteDir(ctx context.Context, dirItems []DirItem) (dir Dir, err error) RemoveDirItem(ctx context.Context, branchName string, splitPath []string) (commit Commit, branch Branch, err error) WriteFile(ctx context.Context, file File) error UpsertDirItem(ctx context.Context, branchName string, splitPath []string, item DirItem) (commit Commit, branch Branch, err error) UpsertDirItems(ctx context.Context, branchName string, splitPath []string, items []DirItem) (commit Commit, branch Branch, err error) GetFileHashMode(ctx context.Context, branchName string, splitPath []string) (hash string, mode os.FileMode, err error) List(ctx context.Context, branchName string, splitPath []string) (dirItems []DirItem, err error) ListByHash(ctx context.Context, hash string) (dirItems []DirItem, err error) Open(ctx context.Context, branchName string, splitPath []string) (hash string, mode os.FileMode, dirItems []DirItem, err error) Open2(ctx context.Context, branchName string, splitPath []string) (dirItem DirItem, dirItems []DirItem, err error) FileCount(ctx context.Context) (int, error) DirCount(ctx context.Context) (int, error) DirItemCount(ctx context.Context) (int, error) BranchCount(ctx context.Context) (int, error) InsertDevice(ctx context.Context, id string, name string, os string, userAgent string, hostname string) error DeleteDevice(ctx context.Context, deviceId string) error ListDevice(ctx context.Context) (devices []Device, err error) InsertDriver(ctx context.Context, driverName string, description string) (exist bool, err error) InsertDriverBaiduPhoto(ctx context.Context, driverName string, description string, accessToken string, refreshToken string) (exist bool, err error) InsertDriverLocalFile(ctx context.Context, driverName string, description string, deviceId string, srcPath string, ignores string, encoder string) (exist bool, err error) UpdateDriverSync(ctx context.Context, driverId uint64, sync bool, h int64, m int64) error UpdateDriverLocalFile(ctx context.Context, driverId uint64, srcPath, ignores, encoder string) error ResetDriver(ctx context.Context, driverId uint64) error DeleteDriver(ctx context.Context, driverId uint64) error ListDriver(ctx context.Context) (drivers []Driver, err error) GetDriver(ctx context.Context, driverId uint64) (driver Driver, err error) GetDriverToken(ctx context.Context, driverId uint64) (driver Driver, err error) GetDriverSync(ctx context.Context, driverId uint64) (driver Driver, err error) ListCloudDriverSync(ctx context.Context) (drivers []Driver, err error) ListLocalFileDriver(ctx context.Context, deviceId string) (drivers []Driver, err error) GetDriverLocalFile(ctx context.Context, driverId uint64) (driver *Driver, err error) GetDriverDirCalculatedInfo(ctx context.Context, driverId uint64, filePath []string) (info DirCalculatedInfo, err error) InsertFile(ctx context.Context, hash string, size uint64) error InsertFileMd5(ctx context.Context, hash string, hashMd5 string) error ListFileMd5(ctx context.Context, md5List []string) (m map[string]string, err error) SumFileSize(ctx context.Context) (size uint64, err error) UpsertDriverFile(ctx context.Context, f DriverFile, mkdir bool) error UpsertDriverFiles(ctx context.Context, files []DriverFile) error ListDriverFile(ctx context.Context, driverId uint64, filePath []string) (files []DriverFile, err error) GetDriverFile(ctx context.Context, driverId uint64, filePath []string) (file DriverFile, err error) ListDriverFileByHash(ctx context.Context, hash string) (files []DriverFile, err error) CheckExists(ctx context.Context, driverId uint64, dirPath []string, checks []DirItemCheck, hashList []string) error InsertHeightWidth(ctx context.Context, hash string, hw HeightWidth) error InsertNullVideoMetadata(ctx context.Context, hash string) (exist bool, err error) InsertVideoMetadata(ctx context.Context, hash string, m VideoMetadata) (exist bool, err error) InsertDCIMMetadataTime(ctx context.Context, hash string, t int64) (exist bool, err error) UpsertDCIMMetadataTime(ctx context.Context, hash string, t int64) error GetEarliestCrated(ctx context.Context, hash string) (t int64, err error) ListMetadataTime(ctx context.Context) (list []Metadata, err error) ListDCIMDriver(ctx context.Context) (drivers []DCIMDriver, err error) ListDCIMMediaType(ctx context.Context) (m map[string][]Metadata, err error) ListDCIMLocation(ctx context.Context) (list []Metadata, err error) ListDCIMSearchType(ctx context.Context) (list []DCIMSearchType, err error) ListDCIMSearchSuffix(ctx context.Context) (list []DCIMSearchSuffix, err error) SearchDCIM(ctx context.Context, typeList []string, suffixList []string) (list []Metadata, err error) InsertNullExif(ctx context.Context, hash string) (exist bool, err error) InsertExif(ctx context.Context, hash string, e Exif) (exist bool, err error) ListExpectExif(ctx context.Context) (hashList []string, err error) ListExpectExifCb(ctx context.Context, cb func(hash string)) (err error) ListExif(ctx context.Context) (exifMap map[string]Exif, err error) ListMetadata(ctx context.Context) (list []Metadata, err error) GetMetadata(ctx context.Context, hash string) (Metadata, error) ListFile(ctx context.Context) (hashList []string, err error) InsertFileType(ctx context.Context, hash string, t FileType) (exist bool, err error) UpsertFileType(ctx context.Context, hash string, t FileType) error ListExpectFileType(ctx context.Context) (hashList []string, err error) ListFileHash(ctx context.Context) (hashList []string, err error) GetFileType(ctx context.Context, hash string) (fileType FileType, err error) ListLivePhotoAll(ctx context.Context) (hashList []string, err error) ListLivePhotoNew(ctx context.Context) (hashList []string, err error) SetLivpForMovAndHeicOrJpgInDirPath(ctx context.Context, driverId uint64, filePath []string) (err error) SetLivpForMovAndHeicOrJpgInDriver(ctx context.Context, driverId uint64) (err error) SetLivpForMovAndHeicOrJpgAll(ctx context.Context) error UpsertLivePhoto(ctx context.Context, movHash string, heicHash string, jpgHash string, livpHash string) error GetLivePhotoByLivp(ctx context.Context, livpHash string) (string, string, error) }
type Dir ¶
type Dir struct { FileOrDir // contains filtered or unexported fields }
func NewDirFromDirItem ¶
func (Dir) TotalCount ¶
type DirCalculatedInfo ¶
type DirItem ¶
type DirItem struct { Hash string `json:"hash"` Name string `json:"name"` Mode uint64 `json:"mode"` Size uint64 `json:"size"` Count uint64 `json:"count"` TotalCount uint64 `json:"totalCount"` CreateTime uint64 `json:"createTime"` // linux does not support it. ModifyTime uint64 `json:"modifyTime"` ChangeTime uint64 `json:"changeTime"` // windows does not support it. AccessTime uint64 `json:"accessTime"` }
https://zhuanlan.zhihu.com/p/343682839
func NewDirItem ¶
func (DirItem) GetAccessTime ¶
func (DirItem) GetChangeTime ¶
func (DirItem) GetCreateTime ¶
func (DirItem) GetModifyTime ¶
func (DirItem) GetTotalCount ¶
type DirItemCheck ¶
type DirItemOpened ¶
type Driver ¶
type Driver struct { Id uint64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Typ string `json:"type"` // sync Sync bool `json:"sync"` H int64 `json:"h"` M int64 `json:"m"` // baidu photo AccessToken string `json:"accessToken"` RefreshToken string `json:"refreshToken"` // local file DeviceId string `json:"deviceId"` SrcPath string `json:"srcPath"` Ignores string `json:"ignores"` Encoder string `json:"encoder"` }
type DriverFile ¶
type DriverFile struct { DriverId uint64 `json:"driverId"` DriverName string `json:"driverName"` DirPath []string `json:"dirPath"` Name string `json:"name"` Version uint64 `json:"version"` // TODO: REMOVE IT! Hash string `json:"hash"` Mode uint64 `json:"mode"` Size uint64 `json:"size"` CreateTime uint64 `json:"createTime"` // linux does not support it. ModifyTime uint64 `json:"modifyTime"` ChangeTime uint64 `json:"changeTime"` // windows does not support it. AccessTime uint64 `json:"accessTime"` UploadDeviceId string `json:"uploadDeviceId"` UploadTime uint64 `json:"uploadTime"` }
https://zhuanlan.zhihu.com/p/343682839
func (DriverFile) GetAccessTime ¶
func (d DriverFile) GetAccessTime() uint64
func (DriverFile) GetChangeTime ¶
func (d DriverFile) GetChangeTime() uint64
func (DriverFile) GetCreateTime ¶
func (d DriverFile) GetCreateTime() uint64
func (DriverFile) GetDirPath ¶
func (d DriverFile) GetDirPath() []string
func (DriverFile) GetDriverId ¶
func (d DriverFile) GetDriverId() uint64
func (DriverFile) GetHash ¶
func (d DriverFile) GetHash() string
func (DriverFile) GetMode ¶
func (d DriverFile) GetMode() uint64
func (DriverFile) GetModifyTime ¶
func (d DriverFile) GetModifyTime() uint64
func (DriverFile) GetName ¶
func (d DriverFile) GetName() string
func (DriverFile) GetSize ¶
func (d DriverFile) GetSize() uint64
type Exif ¶
type Exif struct { ExifVersion string ImageDescription string Orientation uint16 // 方向 https://developer.qiniu.com/dora/kb/1560/information-about-photo-exif-rotation-parameters-in-the-understanding-of-orientation?category=kb DateTime string // 修改时间 YYYY:MM:DD HH:MM:SS DateTimeOriginal string // 拍摄时间 DateTimeDigitized string // 写入时间 OffsetTime string // 时区 +01:00 OffsetTimeOriginal string OffsetTimeDigitized string SubsecTime string // 亚秒 长度不确定 SubsecTimeOriginal string SubsecTimeDigitized string HostComputer string Make string Model string ExifImageWidth uint64 ExifImageLength uint64 GPSLatitudeRef string GPSLatitude float64 // 纬度 GPSLongitudeRef string GPSLongitude float64 // 经度 }
type FileOrDir ¶
type FileOrDir struct {
// contains filtered or unexported fields
}
func (FileOrDir) TotalCount ¶
type HeightWidth ¶
type IDriverFile ¶
type IFileOrDir ¶
type Metadata ¶
type Metadata struct { Hash string `json:"hash"` FileType *FileType `json:"fileType"` Time int64 `json:"time"` Year int64 `json:"year"` Month int64 `json:"month"` Day int64 `json:"day"` Duration string `json:"duration"` HeightWidth *HeightWidth `json:"heightWidth"` GPSLatitudeRef string `json:"GPSLatitudeRef"` GPSLatitude float64 `json:"GPSLatitude"` // 纬度 GPSLongitudeRef string `json:"GPSLongitudeRef"` GPSLongitude float64 `json:"GPSLongitude"` // 经度 Exif *Exif `json:"exif"` VideoMetadata *VideoMetadata `json:"videoMetadata"` }
type SizedReadCloser ¶
type SizedReadCloser interface { io.ReadSeekCloser Size() int64 }
type VideoMetadata ¶
type VideoMetadataFfmpeg ¶
type VideoMetadataFfmpeg struct { Height string // streams[0].height Width string // streams[0].width Created int64 // format.tags.creation_time Duration float64 // format.duration Make string // format.tags. com.apple.quicktime.make Model string // format.tags. com.apple.quicktime.modal }
VideoMetadataFfmpeg ffprobe.exe -v quiet -show_format -show_streams -print_format json 9638.mp4
Click to show internal directories.
Click to hide internal directories.