Documentation
¶
Index ¶
- Constants
- func CronIsExpiredDays(timeToCheck time.Time, days int) bool
- func DebugConfig()
- func FindNextPhotoInAlbum(client *photoprism.Client, albumID string) (*api.Photo, error)
- func FindPhoto(photos []api.Photo) (*api.Photo, error)
- func GetCachePath(name string) (*os.File, error)
- func GetStatus(photo api.Photo) string
- func SendPhotoTweet(twitter *anaconda.TwitterApi, photo api.Photo, pBytes []byte) (string, error)
- func SetCustomData(d *CustomData, photo *api.Photo) error
- func TimeDeltaDays(t1, t2 time.Time) int
- func TimeDeltaDaysFromNow(delta int) time.Time
- func TimeStringToTime(str string) (*time.Time, error)
- func TimeTimeToString(t time.Time) string
- func TimeToday() time.Time
- func TimeTomorrow() time.Time
- func TimeYesterday() time.Time
- func ValidateConfig(cfg *DiaryConfig) error
- type Cache
- type CustomData
- type Diary
- type DiaryConfig
- type Record
Constants ¶
const ( DatabaseMode = 0755 DatabaseName = "cache.db" DatabaseDir = "thenovadiary" )
const ( // BypassSendDailyTweetTwitter // // Bypass hitting the twitter API for the SendDailyTweet task BypassSendDailyTweetTwitter = false // BBypassSendDailyTweetCache // // Bypass saving the cache with an updated last tweet time BypassSendDailyTweetCache = false )
const ( // TimeLayoutHuman is the time that is // relevant for me and you :) TimeLayoutHuman = "2006-01-02T15:04:05" // TimeLayout8601 is the ISO 8601 Standard TimeLayout8601 = "2006-01-02T15:04:05Z0700" // TimeLayoutTimeTime Is the format used by the Go // standard library time.Time String() method // Use this to decode a time.Time string -> *time.Time // instance with time.Parse() // // 2020-11-05 00:00:00 -0800 PST TimeLayoutTimeTime = "2006-01-02 15:04:05 -0700 PST" )
const ( // Default Twitter Values // These are constants and if // we every change our app account // we should update here DefaultTwitterHandle = "thenovadiary" DefaultTwitterURL = "https://twitter.com/thenovadiary" // The twitter API now accepts tweets with 280 characters TwitterLengthLimit = 280 )
const (
DailyTweetCacheKey = "dailytweet"
)
Variables ¶
This section is empty.
Functions ¶
func DebugConfig ¶
func DebugConfig()
func FindNextPhotoInAlbum ¶
func FindPhoto ¶
func FindPhoto(photos []api.Photo) (*api.Photo, error)
FindNextPhoto will list all photos and linear search for a photo that was last updated with the greatest delta in days ago based on the timestamp found in
The function will return unprocessed photos first by design.
func GetCachePath ¶
GetCachePath is a deterministic function to return an *os.File based on the system running.
By design this will also ensure the path is writeable and created by this process's file descriptor access.
func SendPhotoTweet ¶
func SendPhotoTweet(twitter *anaconda.TwitterApi, photo api.Photo, pBytes []byte) (string, error)
SendPhotoTweet will return the URL of the sent tweet and/or an error.
func SetCustomData ¶
func SetCustomData(d *CustomData, photo *api.Photo) error
func TimeDeltaDays ¶
TimeDeltaDays will calculate the absolute value of the difference (delta) in days between two given points in time.
func TimeDeltaDaysFromNow ¶
func TimeTimeToString ¶
func TimeTomorrow ¶
func TimeYesterday ¶
func ValidateConfig ¶
func ValidateConfig(cfg *DiaryConfig) error
Types ¶
type Cache ¶
type CustomData ¶
type CustomData struct { LastTweet *time.Time NoteStrings []string KeyValue map[string]string Description string }
func GetCustomData ¶
func GetCustomData(photo api.Photo) *CustomData
type Diary ¶
type Diary struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg *DiaryConfig) *Diary
func (*Diary) NewPhotoprismClient ¶
NewPhotoprismClient will always return a new client with a fresh token
func (*Diary) SendDailyTweet ¶
type DiaryConfig ¶
type DiaryConfig struct { Name string // Unique identifier for logs TwitterToken string TwitterTokenSecret string TwitterConsumerKey string TwitterConsumerKeySecret string PhotoprismPass string PhotoprismUser string PhotoprismConn string PhotoprismAlbum string // contains filtered or unexported fields }