Documentation
¶
Index ¶
- Constants
- Variables
- func GetDropboxConfig(ctx context.Context) (*dropbox.Config, error)
- type Cell
- type Change
- type Changes
- type DropboxKeys
- type Expedition
- func (e *Expedition) GetExpedition() *Expedition
- func (e *Expedition) GetItems() []*Item
- func (e *Expedition) GetMetadata() (string, error)
- func (e *Expedition) GetPlaylist() *youtube.Playlist
- func (e *Expedition) GetPlaylistId() string
- func (e *Expedition) HasThumbnails() bool
- func (e *Expedition) String() string
- type GeminiRequest
- type GeminiRequestItem
- type GeminiResponseItem
- type Global
- type HasPlaylist
- type Item
- type Location
- type P
- type PlaylistMeta
- type Section
- type Service
- func (s *Service) ClearDropboxPreviewFolder() error
- func (s *Service) ClearGoogleDrivePreviewFolder() error
- func (s *Service) ClearPreviewSheets() error
- func (s *Service) CreateOrUpdatePlaylists() error
- func (s *Service) CreateOrUpdateVideos(ctx context.Context) error
- func (s *Service) FindDropboxFiles() error
- func (s *Service) FindGoogleDriveFiles() error
- func (s *Service) GenerateAiTitles(ctx context.Context) error
- func (s *Service) GetAllSheetsData() error
- func (s *Service) GetPlaylistsData() error
- func (s *Service) GetSheetData(expedition *Expedition, titles ...string) error
- func (s *Service) GetSheets(expedition *Expedition) error
- func (s *Service) GetVideosCaptions() error
- func (s *Service) GetVideosData() error
- func (s *Service) InitDropboxService(ctx context.Context) error
- func (s *Service) InitGoogleDriveService() error
- func (s *Service) InitSheetsService() error
- func (s *Service) InitialiseServiceAccount(ctx context.Context) error
- func (s *Service) InitialiseYoutubeAuthentication(ctx context.Context) error
- func (s *Service) ParseExpeditions() error
- func (s *Service) ParseGlobal() error
- func (s *Service) ParseItems() error
- func (s *Service) ParseLinkedData() error
- func (s *Service) ParseSections() error
- func (s *Service) ParseTemplates() error
- func (s *Service) ResumePartialUpload(ctx context.Context) error
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) StorePlaylistPreview(parent HasPlaylist, name, before, after string)
- func (s *Service) StorePlaylistPreviewDeleted(parent HasPlaylist)
- func (s *Service) StorePlaylistPreviewOps(parent HasPlaylist, name string, ops []string)
- func (s *Service) StoreVideoPreview(item *Item, name, before, after string)
- func (s *Service) UpdateThumbnails() error
- func (s *Service) UpdateVideoTitles() error
- func (s *Service) WritePlaylistsPreview() error
- func (s *Service) WriteVideosPreview() error
- type Sheet
- type StorageServices
- type VideoMeta
- type YoutubeFields
Constants ¶
View Source
const SPREADSHEET_ID = "1e2gK0GgWN4PxeZcazUvxtlhYGzg2lZsZEkphqu9Jplc"
Variables ¶
View Source
var DropboxKeyTypes = []DropboxKeys{ DropboxClientID, DropboxClientSecret, DropboxRefreshToken, }
View Source
var Funcs = template.FuncMap{ "upper": func(s string) string { return strings.ToUpper(s) }, "lower": func(s string) string { return strings.ToLower(s) }, "commas": func(v int) string { sign := "" if v == math.MinInt64 { return "-9,223,372,036,854,775,808" } if v < 0 { sign = "-" v = 0 - v } parts := []string{"", "", "", "", "", "", ""} j := len(parts) - 1 for v > 999 { parts[j] = strconv.FormatInt(int64(v%1000), 10) switch len(parts[j]) { case 2: parts[j] = "0" + parts[j] case 1: parts[j] = "00" + parts[j] } v = v / 1000 j-- } parts[j] = strconv.Itoa(int(v)) return sign + strings.Join(parts[j:], ",") }, "add": func(a, b int) int { return a + b }, "sub": func(a, b int) int { return a - b }, "date": func(t time.Time) string { day := t.Day() suffix := "th" switch day % 10 { case 1: if day != 11 { suffix = "st" } case 2: if day != 12 { suffix = "nd" } case 3: if day != 13 { suffix = "rd" } } return fmt.Sprintf("%s %d%s", t.Format("January"), day, suffix) }, "dict": func(values ...interface{}) (map[string]interface{}, error) { if len(values)%2 != 0 { return nil, errors.New("invalid dict call") } dict := make(map[string]interface{}, len(values)/2) for i := 0; i < len(values); i += 2 { key, ok := values[i].(string) if !ok { return nil, errors.New("dict keys must be strings") } dict[key] = values[i+1] } return dict, nil }, "nilval": func() any { return nil }, }
View Source
var MetaRegex = regexp.MustCompile(`\n{(.*)}$`)
Functions ¶
Types ¶
type DropboxKeys ¶ added in v0.1.36
type DropboxKeys int
const ( DropboxClientID DropboxKeys = 1 DropboxClientSecret DropboxKeys = 2 DropboxRefreshToken DropboxKeys = 3 )
type Expedition ¶
type Expedition struct {
RowId int
Ref string
Name string
Process bool
VideosFolder string
ThumbnailsFolder string
VideosDropbox string
ThumbnailsDropbox string
ExpeditionPlaylist bool
SectionPlaylists bool
DataSheetId string
Spreadsheet *sheets.Spreadsheet
Sheets map[string]*Sheet
Data map[string]Cell
SectionsByRef map[string]*Section
Sections []*Section
Items []*Item
Templates *template.Template
PlaylistId string
Playlist *youtube.Playlist
ItemSheet *Sheet
}
func (*Expedition) GetExpedition ¶
func (e *Expedition) GetExpedition() *Expedition
func (*Expedition) GetItems ¶
func (e *Expedition) GetItems() []*Item
func (*Expedition) GetMetadata ¶
func (e *Expedition) GetMetadata() (string, error)
func (*Expedition) GetPlaylist ¶
func (e *Expedition) GetPlaylist() *youtube.Playlist
func (*Expedition) GetPlaylistId ¶
func (e *Expedition) GetPlaylistId() string
func (*Expedition) HasThumbnails ¶ added in v0.1.45
func (e *Expedition) HasThumbnails() bool
func (*Expedition) String ¶ added in v0.1.29
func (e *Expedition) String() string
type GeminiRequest ¶ added in v0.1.48
type GeminiRequest struct {
Name string `json:"title"` // expedition.name
Description string `json:"description"` // expedition.description
Items []GeminiRequestItem `json:"items"`
}
type GeminiRequestItem ¶ added in v0.1.48
type GeminiRequestItem struct {
Type string `json:"type"`
Section string `json:"section"`
Key int `json:"key"`
Title string `json:"title"`
Description string `json:"description"`
Thumbnail string `json:"thumbnail"`
Tags []string `json:"tags"`
Landmarks string `json:"landmarks"`
Transcript string `json:"transcript"`
}
type GeminiResponseItem ¶ added in v0.1.48
type HasPlaylist ¶
type Item ¶
type Item struct {
RowId int
Type string
Key int
Video bool
Template string
Ready bool
DoThumbnail bool
Release time.Time
From, To Location
Via []Location
Section *Section
SectionRef string
Expedition *Expedition
Data map[string]Cell
VideoGoogleDrive *drive.File
ThumbnailGoogleDrive *drive.File
VideoDropbox *files.FileMetadata
ThumbnailDropbox *files.FileMetadata
YoutubeId string
YoutubeVideo *youtube.Video
YoutubeTranscript string
Tags []string
}
type PlaylistMeta ¶
type Section ¶
type Section struct {
RowId int
Expedition *Expedition
Items []*Item
Ref string
Name string
Data map[string]Cell
PlaylistId string
Playlist *youtube.Playlist
}
func (*Section) GetExpedition ¶
func (s *Section) GetExpedition() *Expedition
func (*Section) GetMetadata ¶
func (*Section) GetPlaylist ¶
func (*Section) GetPlaylistId ¶
type Service ¶
type Service struct {
Global *Global
StorageService StorageServices
ChannelId string
SheetsService *sheets.Service
YoutubeService *youtube.Service
YoutubeAccessToken string
ServiceAccountClient *http.Client
DriveService *drive.Service
DropboxConfig *dropbox.Config
Spreadsheet *sheets.Spreadsheet
Sheets map[string]*Sheet
Expeditions map[string]*Expedition
YoutubePlaylists map[string]*youtube.Playlist
VideoPreviewData map[*Item]map[string]any
PlaylistPreviewData map[HasPlaylist]map[string]any
}
func (*Service) ClearDropboxPreviewFolder ¶ added in v0.1.34
func (*Service) ClearGoogleDrivePreviewFolder ¶ added in v0.1.35
func (*Service) ClearPreviewSheets ¶ added in v0.1.48
func (*Service) CreateOrUpdatePlaylists ¶
func (*Service) CreateOrUpdateVideos ¶
func (*Service) FindDropboxFiles ¶ added in v0.1.34
func (*Service) FindGoogleDriveFiles ¶ added in v0.1.35
func (*Service) GenerateAiTitles ¶ added in v0.1.48
func (*Service) GetAllSheetsData ¶
func (*Service) GetPlaylistsData ¶
func (*Service) GetSheetData ¶
func (s *Service) GetSheetData(expedition *Expedition, titles ...string) error
func (*Service) GetSheets ¶ added in v0.1.51
func (s *Service) GetSheets(expedition *Expedition) error
func (*Service) GetVideosCaptions ¶ added in v0.1.43
func (*Service) GetVideosData ¶
func (*Service) InitDropboxService ¶ added in v0.1.34
func (*Service) InitGoogleDriveService ¶ added in v0.1.35
func (*Service) InitSheetsService ¶
func (*Service) InitialiseServiceAccount ¶
func (*Service) InitialiseYoutubeAuthentication ¶
func (*Service) ParseExpeditions ¶
func (*Service) ParseGlobal ¶
func (*Service) ParseItems ¶
func (*Service) ParseLinkedData ¶
func (*Service) ParseSections ¶
func (*Service) ParseTemplates ¶
func (*Service) ResumePartialUpload ¶
func (*Service) StorePlaylistPreview ¶
func (s *Service) StorePlaylistPreview(parent HasPlaylist, name, before, after string)
func (*Service) StorePlaylistPreviewDeleted ¶
func (s *Service) StorePlaylistPreviewDeleted(parent HasPlaylist)
func (*Service) StorePlaylistPreviewOps ¶
func (s *Service) StorePlaylistPreviewOps(parent HasPlaylist, name string, ops []string)
func (*Service) StoreVideoPreview ¶
func (*Service) UpdateThumbnails ¶
func (*Service) UpdateVideoTitles ¶ added in v0.1.53
func (*Service) WritePlaylistsPreview ¶
func (*Service) WriteVideosPreview ¶
type Sheet ¶
type Sheet struct {
Spreadsheet *sheets.Spreadsheet
Name string
Expedition *Expedition
Headers []string
Data []map[string]Cell
DataByRef map[string]map[string]Cell
}
type StorageServices ¶ added in v0.1.34
type StorageServices int
const ( GoogleDriveStorage StorageServices = 1 DropboxStorage StorageServices = 2 )
type YoutubeFields ¶
type YoutubeFields struct {
PrivacyStatus string // privacy status before PublishAt time. After this time, it is always public.
PublishAt time.Time // no default
CategoryId string
ChannelId string
DefaultAudioLanguage string
DefaultLanguage string
LiveBroadcastContent string
Description string // no default
Title string // no default
Tags []string
}
func DefaultYoutubeFields ¶
func DefaultYoutubeFields() YoutubeFields
Click to show internal directories.
Click to hide internal directories.