Documentation ¶
Overview ¶
Package uguis provides tweet-to-speech command line tool.
Index ¶
- Constants
- type Application
- type ApplicationOptions
- type BoltDBOptions
- type Controller
- type DB
- type DBReadWriter
- type FileWriter
- type FileWriterRequest
- type FileWriterResponse
- type Log
- type Logger
- type Player
- type PlayerRequest
- type PlayerResponse
- type SimpleDBReadWriterOptions
- type SimpleFileWriterOptions
- type SimpleLoggerOptions
- type SimplePlayerOptions
- type SimpleTwitterClientOptions
- type SimpleVoicetextClientOptions
- type Tweet
- type Tweets
- type TwitterClient
- type VoicetextClient
- type VoicetextTTSRequest
- type VoicetextTTSResponse
Constants ¶
const ( LogLevelTRACE = iota LogLevelDEBUG LogLevelINFO LogLevelWARN LogLevelERROR LogLevelFATAL )
Log levels
const Version = "Uguis v0.0.1"
Version is the version of Uguis.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { // Hostname represents the hostname. Hostname string // CPUs represents the maximum number of CPUs. CPUs int }
Application represents an application.
func NewApplication ¶
func NewApplication(opts *ApplicationOptions) *Application
NewApplication creates and returns an application.
type ApplicationOptions ¶
type ApplicationOptions struct { // Hostname represents the host name. Hostname string // CPUs represents the maximum number of CPUs. CPUs int }
ApplicationOptions represents options for an application.
type BoltDBOptions ¶
type BoltDBOptions struct { // Path represents a Bolt database file path. Path string }
BoltDBOptions represents options for a Bolt database.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller represents a controller.
func NewController ¶
func NewController( app *Application, lgr Logger, twitterClient TwitterClient, voicetextClient VoicetextClient, fileWriter FileWriter, player Player, ) *Controller
NewController creates and returns a controller.
func (*Controller) Exec ¶
func (ctrl *Controller) Exec()
Exec executes the controller's main process.
type DB ¶
type DB interface { // Get gets a value from a database. Get(bucketName, key []byte) ([]byte, error) // Put puts the key/value to a database. Put(bucketName, key, value []byte) error // Close closes the database. Close() error }
DB is an interface for storing data.
func NewBoltDB ¶
func NewBoltDB(opts *BoltDBOptions) (DB, error)
NewBoltDB creates and returns a Bolt database.
type DBReadWriter ¶
type DBReadWriter interface { // Get gets a value from a database. Get(bucketName, key []byte) ([]byte, error) // Put puts the key/value to a database. Put(bucketName, key, value []byte) error // Close closes the database read writer's process. Close() error }
DBReadWriter is an interface for reading/writing data from/to the databse.
func NewSimpleDBReadWriter ¶
func NewSimpleDBReadWriter(db DB, opts *SimpleDBReadWriterOptions) DBReadWriter
NewSimpleDBReadWriter creates and returns a simple database read writer.
type FileWriter ¶
type FileWriter interface { // Write writes a file. Write(req FileWriterRequest) // Close closes the file writer. Close() error // ResC returns a response channel. ResC() <-chan FileWriterResponse }
FileWriter is an interface for writing a file.
func NewSimpleFileWriter ¶
func NewSimpleFileWriter( app *Application, lgr Logger, opts *SimpleFileWriterOptions, ) FileWriter
NewSimpleFileWriter creates and returns a simple file writer.
type FileWriterRequest ¶
type FileWriterRequest struct {
// contains filtered or unexported fields
}
FileWriterRequest represents a file writer request.
func NewFileWriterRequest ¶
func NewFileWriterRequest(tweet Tweet, file file) FileWriterRequest
NewFileWriterRequest creates and returns a file writer request.
type FileWriterResponse ¶
type FileWriterResponse struct {
// contains filtered or unexported fields
}
FileWriterResponse represents a file writer response.
func NewFileWriterResponse ¶
func NewFileWriterResponse(tweet Tweet, path string) FileWriterResponse
NewFileWriterResponse creates and returns a file writer response.
type Log ¶
type Log struct { // Level represents a log level. Level uint8 // AppName represents an application name which creates the log. Hostname string // ServiceName represents a service name which creates the log. ServiceName string // Msg represents a log message. Msg string // Time represent a log time. Time time.Time }
Log represents a log.
type Logger ¶
type Logger interface { // Print prints a log. Print(lg Log) // Close closes the logger. Close() error }
Logger is an interface for prining a log.
func NewSimpleLogger ¶
func NewSimpleLogger(opts *SimpleLoggerOptions) Logger
NewSimpleLogger creates and returns a simple logger.
type Player ¶
type Player interface { // Play plays a sound file. Play(path PlayerRequest) // Close closes the player. Close() error // ResC returns a response channel. ResC() <-chan PlayerResponse }
Player is an interface for playing a sound file.
func NewSimplePlayer ¶
func NewSimplePlayer( command string, app *Application, lgr Logger, opts *SimplePlayerOptions, ) Player
NewSimplePlayer creates and returns a simple player.
type PlayerRequest ¶
type PlayerRequest struct {
// contains filtered or unexported fields
}
PlayerRequest represents a player request.
func NewPlayerRequest ¶
func NewPlayerRequest(tweet Tweet, path string) PlayerRequest
NewPlayerRequest creates and returns a player request.
type PlayerResponse ¶
type PlayerResponse struct {
// contains filtered or unexported fields
}
PlayerResponse represents a player response.
func NewPlayerResponse ¶
func NewPlayerResponse(tweet Tweet, path string) PlayerResponse
NewPlayerResponse creates and returns a player response.
type SimpleDBReadWriterOptions ¶
type SimpleDBReadWriterOptions struct { }
SimpleDBReadWriterOptions represents options for a simple database read writer.
type SimpleFileWriterOptions ¶
type SimpleFileWriterOptions struct { // ReqCBfSize represents a buffer size of a request channel. ReqCBfSize uint32 // ResCBfSize represents a buffer size of a response channel. ResCBfSize uint32 }
SimpleFileWriterOptions represents options for a simple file writer.
type SimpleLoggerOptions ¶
type SimpleLoggerOptions struct { // LevelStr represents a log level string. LevelStr string // LogCBfSize represents a buffer size of a log channel. LogCBfSize uint32 }
SimpleLoggerOptions represents options for a simple logger.
type SimplePlayerOptions ¶
type SimplePlayerOptions struct { // ReqCBfSize represents a buffer size of a request channel. ReqCBfSize uint32 // ResCBfSize represents a buffer size of a response channel. ResCBfSize uint32 }
SimplePlayerOptions represents options for a simple player.
type SimpleTwitterClientOptions ¶
type SimpleTwitterClientOptions struct { // ReqCBfSize represents a buffer size of a request channel. ReqCBfSize uint32 // ResCBfSize represents a buffer size of a response channel. ResCBfSize uint32 }
SimpleTwitterClientOptions represents options for a simple twitter client.
type SimpleVoicetextClientOptions ¶
type SimpleVoicetextClientOptions struct { // ReqCBfSize represents a buffer size of a request channel. ReqCBfSize uint32 // ResCBfSize represents a buffer size of a response channel. ResCBfSize uint32 }
SimpleVoicetextClientOptions represents options for a simple voicetext client.
type Tweet ¶
type Tweet struct { Contributors interface{} `json:"contributors"` Coordinates interface{} `json:"coordinates"` CreatedAt string `json:"created_at"` Entities struct { Hashtags []struct { Indices []float64 `json:"indices"` Text string `json:"text"` } `json:"hashtags"` Symbols []interface{} `json:"symbols"` Urls []struct { DisplayURL string `json:"display_url"` ExpandedURL string `json:"expanded_url"` Indices []float64 `json:"indices"` URL string `json:"url"` } `json:"urls"` UserMentions []interface{} `json:"user_mentions"` } `json:"entities"` FavoriteCount float64 `json:"favorite_count"` Favorited bool `json:"favorited"` Geo interface{} `json:"geo"` ID float64 `json:"id"` IDStr string `json:"id_str"` InReplyToScreenName interface{} `json:"in_reply_to_screen_name"` InReplyToStatusID interface{} `json:"in_reply_to_status_id"` InReplyToStatusIDStr interface{} `json:"in_reply_to_status_id_str"` InReplyToUserID interface{} `json:"in_reply_to_user_id"` InReplyToUserIDStr interface{} `json:"in_reply_to_user_id_str"` Lang string `json:"lang"` Place interface{} `json:"place"` PossiblySensitive bool `json:"possibly_sensitive"` RetweetCount float64 `json:"retweet_count"` Retweeted bool `json:"retweeted"` Source string `json:"source"` Text string `json:"text"` Truncated bool `json:"truncated"` User struct { ContributorsEnabled bool `json:"contributors_enabled"` CreatedAt string `json:"created_at"` DefaultProfile bool `json:"default_profile"` DefaultProfileImage bool `json:"default_profile_image"` Description string `json:"description"` Entities struct { Description struct { Urls []struct { DisplayURL string `json:"display_url"` ExpandedURL string `json:"expanded_url"` Indices []float64 `json:"indices"` URL string `json:"url"` } `json:"urls"` } `json:"description"` URL struct { Urls []struct { DisplayURL string `json:"display_url"` ExpandedURL string `json:"expanded_url"` Indices []float64 `json:"indices"` URL string `json:"url"` } `json:"urls"` } `json:"url"` } `json:"entities"` FavouritesCount float64 `json:"favourites_count"` FollowRequestSent bool `json:"follow_request_sent"` FollowersCount float64 `json:"followers_count"` Following bool `json:"following"` FriendsCount float64 `json:"friends_count"` GeoEnabled bool `json:"geo_enabled"` ID float64 `json:"id"` IDStr string `json:"id_str"` IsTranslationEnabled bool `json:"is_translation_enabled"` IsTranslator bool `json:"is_translator"` Lang string `json:"lang"` ListedCount float64 `json:"listed_count"` Location string `json:"location"` Name string `json:"name"` Notifications bool `json:"notifications"` ProfileBackgroundColor string `json:"profile_background_color"` ProfileBackgroundImageURL string `json:"profile_background_image_url"` ProfileBackgroundImageURLHttps string `json:"profile_background_image_url_https"` ProfileBackgroundTile bool `json:"profile_background_tile"` ProfileImageURL string `json:"profile_image_url"` ProfileImageURLHTTPS string `json:"profile_image_url_https"` ProfileLinkColor string `json:"profile_link_color"` ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"` ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"` ProfileTextColor string `json:"profile_text_color"` ProfileUseBackgroundImage bool `json:"profile_use_background_image"` Protected bool `json:"protected"` ScreenName string `json:"screen_name"` StatusesCount float64 `json:"statuses_count"` TimeZone string `json:"time_zone"` URL string `json:"url"` UtcOffset float64 `json:"utc_offset"` Verified bool `json:"verified"` } `json:"user"` }
Tweet represents a tweet.
type TwitterClient ¶
type TwitterClient interface { // Call calls a Twitter API. Call(req twitterRequest) // Close closes the twitter client. Close() error // ResC returns a response channel. ResC() <-chan Tweet }
TwitterClient is an interface for calling the Twitter APIs.
func NewSimpleTwitterClient ¶
func NewSimpleTwitterClient( consumerKey string, consumerSecret string, accessToken string, accessTokenSecret string, app *Application, lgr Logger, opts *SimpleTwitterClientOptions, ) TwitterClient
NewSimpleTwitterClient creates and returns a simple Twitter client.
type VoicetextClient ¶
type VoicetextClient interface { // TTS calls the Voicetext TTS API. TTS(req VoicetextTTSRequest) // Close closes the twitter client. Close() error // ResC returns a response channel. ResC() <-chan VoicetextTTSResponse }
VoicetextClient is an interface for calling Voicetext Web APIs.
func NewSimpleVoicetextClient ¶
func NewSimpleVoicetextClient( apiKey string, app *Application, lgr Logger, opts *SimpleVoicetextClientOptions, ) VoicetextClient
NewSimpleVoicetextClient creates and returns a simple voicetext client.
type VoicetextTTSRequest ¶
type VoicetextTTSRequest struct {
// contains filtered or unexported fields
}
VoicetextTTSRequest represents a voicetext request.
func NewVoicetextTTSRequest ¶
func NewVoicetextTTSRequest(tweet Tweet, opts *voicetext.TTSOptions) VoicetextTTSRequest
NewVoicetextTTSRequest creates and returns a voicetext request.
type VoicetextTTSResponse ¶
type VoicetextTTSResponse struct {
// contains filtered or unexported fields
}
VoicetextTTSResponse represents a voicetext response.
func NewVoicetextTTSResponse ¶
func NewVoicetextTTSResponse(tweet Tweet, result *voicetext.Result) VoicetextTTSResponse
NewVoicetextTTSResponse creates and returns a a voicetext response.
Source Files ¶
- application.go
- application_options.go
- bolt_db.go
- bolt_db_options.go
- controller.go
- db.go
- db_read_writer.go
- doc.go
- file.go
- file_writer.go
- file_writer_request.go
- file_writer_response.go
- log.go
- logger.go
- player.go
- player_request.go
- player_response.go
- simple_db_read_writer.go
- simple_db_read_writer_options.go
- simple_file_writer.go
- simple_file_writer_options.go
- simple_logger.go
- simple_logger_options.go
- simple_player.go
- simple_player_options.go
- simple_twitter_client.go
- simple_twitter_client_options.go
- simple_voicetext_client.go
- simple_voicetext_client_options.go
- tweet.go
- tweets.go
- twitter_client.go
- twitter_request.go
- version.go
- voicetext_client.go
- voicetext_tts_request.go
- voicetext_tts_response.go