Documentation ¶
Overview ¶
The utils package contains methods used by the tool. All these methods are not needed if gphotosuploader is used as a library
Index ¶
- func IsFileImageOrVideo(file *os.File) (bool, error)
- func IsImageOrVideo(fileName string) (bool, error)
- func SeleniumToGoCookie(seleniumCookie selenium.Cookie) *http.Cookie
- func SeleniumToGoCookies(seleniumCookies []selenium.Cookie) []*http.Cookie
- func StartWebDriverCookieCredentialsWizard() (*auth.CookieCredentials, error)
- type ConcurrentUploader
- type DirectoriesToWatch
- type FilesToUpload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFileImageOrVideo ¶
Check if the file has a image or video mime. This function read the first 512 bytes of the file. Before and after the reading of the file offset is reset
func IsImageOrVideo ¶
Check if the file at the given path is an image or a video
func SeleniumToGoCookie ¶
utility to convert a selenium cookie to a go http.Cookie
func SeleniumToGoCookies ¶
Utility to convert selenium cookies slice to go http.Cookie slice
func StartWebDriverCookieCredentialsWizard ¶
func StartWebDriverCookieCredentialsWizard() (*auth.CookieCredentials, error)
Start a wizard that open a browser to let the user authenticate and return an auth.Credentials implementation
Types ¶
type ConcurrentUploader ¶
type ConcurrentUploader struct { CompletedUploads chan string IgnoredUploads chan string Errors chan error // contains filtered or unexported fields }
Simple client used to implement the tool that can upload multiple photos or videos at once
func NewUploader ¶
func NewUploader(credentials auth.CookieCredentials, albumId string, albumName string, maxConcurrentUploads int) (*ConcurrentUploader, error)
Creates a new ConcurrentUploader using the specified credentials. The second argument is the id of the album in which images are going to be added when uploaded. Use an empty string if you don't want to move the images in to a specific album. The third argument is the maximum number of concurrent uploads (which must not be 0).
func (*ConcurrentUploader) AddUploadedFiles ¶
func (u *ConcurrentUploader) AddUploadedFiles(files ...string)
Add files to the list of already uploaded files
func (*ConcurrentUploader) EnqueueUpload ¶
func (u *ConcurrentUploader) EnqueueUpload(filePath string) error
Enqueue a new upload. You must not call this method while waiting for some uploads to finish (The method return an error if you try to do it). Due to the fact that this method is asynchronous, if nil is return it doesn't mean the the upload was completed: for that use the Errors and CompletedUploads channels
func (*ConcurrentUploader) WaitUploadsCompleted ¶
func (u *ConcurrentUploader) WaitUploadsCompleted()
Blocks this goroutine until all the upload are completed. You can not add uploads when a goroutine call this method
type DirectoriesToWatch ¶
type DirectoriesToWatch []string
Slice of names of directories to watch
func (*DirectoriesToWatch) Set ¶
func (a *DirectoriesToWatch) Set(name string) error
func (*DirectoriesToWatch) String ¶
func (a *DirectoriesToWatch) String() string
type FilesToUpload ¶
type FilesToUpload []string
Slice of name of file and directories to upload
func (*FilesToUpload) Set ¶
func (a *FilesToUpload) Set(name string) error
func (*FilesToUpload) String ¶
func (a *FilesToUpload) String() string