Documentation ¶
Index ¶
- Constants
- func Loginfo(f *drive.File) string
- type File
- type Manager
- func (m *Manager) AddFile(f *File)
- func (m *Manager) Download(id string) (int64, string, error)
- func (m *Manager) Encode(id string) error
- func (m *Manager) FindFiles() ([]drive.File, error)
- func (m *Manager) FindNewFiles() ([]*File, error)
- func (m *Manager) GetFile(id string) *File
- func (m *Manager) Init() error
- func (m *Manager) Move(id string) error
- func (m *Manager) NumFiles() int
- func (m *Manager) Perge() error
- func (m *Manager) SenderPerge() error
- func (m *Manager) SenderUpload()
- func (m *Manager) Upload(path, desc string, parents []string) (*drive.File, error)
Constants ¶
View Source
const ( // UploadTargetFolderID is the ID of Google Drive folder where sender put the file to. UploadTargetFolderID = "1QaF-81k04ieUk4RB97PU1eALP0JnXN4S" // EncodeDoneFolderID is the ID of Google Drive folder where the original files are sent to after encoding process. EncodeDoneFolderID = "1i0GSCuF10lW1sx3A_vDGbvjAKIxPS2yM" // MP4TargetFolderID is the ID of Google Drive folder where encoded mp4 files are sent to. MP4TargetFolderID = "0B_fYUdOGrPfiUnR3aWVPMElHcjg" // DefaultSecretsFile is the filename of JSON file where OAuth2 secrets are recorded. // This file is available on https://console.developers.google.com/. DefaultSecretsFile = "client_secret.json" // Template URL string to open the Drive file with ID. GoogleDriveOpenURL = "https://drive.google.com/open?id=%s" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct { Path string ID string Downloaded bool Encoded bool EncodedPath string Uploaded bool }
File holds required info for encoding management.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the wrapper of Google Drive files service.
func NewManager ¶
NewManager creates Manager with OAuth2 client secrets. It must call Init() method to activate actual drive.Service.
func (*Manager) FindNewFiles ¶
FindNewFiles checks new files uploaded on Google Drive and returns those.
func (*Manager) Init ¶
Init creates http.Client based on oauth2.Config and holds drive.Service with hte credential.
func (*Manager) Perge ¶
Perge removes all processed file instance from files field and delete all processed files from file system.
func (*Manager) SenderPerge ¶
SenderPerge checks if the file is uploaded and in encode done folder. If both are satisfiled, removes the original ts file.
func (*Manager) SenderUpload ¶
func (m *Manager) SenderUpload()
Click to show internal directories.
Click to hide internal directories.