internal

package
v0.0.0-...-af826ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InsertKeywordsQuery = "" /* 146-byte string literal not displayed */
	InsertVideosQuery   = "" /* 138-byte string literal not displayed */
	UpdateVtubersQuery  = "UPDATE vtubers SET item_count = :item_count, playlist_latest_url = :playlist_latest_url WHERE id = :id"
)
View Source
const (
	InsertVtubersQuery = "INSERT INTO vtubers (id, name, item_count, playlist_latest_url) VALUES (:id, :name, :item_count, :playlist_latest_url)"
)

テストで使用

Variables

This section is empty.

Functions

func CleanUp

func CleanUp() error

func NewDB

func NewDB(dsn string) *sqlx.DB

func SetUp

func SetUp(t Tables) error

Types

type Category

type Category struct {
	ID        string    `db:"id"`
	Name      string    `db:"name"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type FCM

type FCM struct {
	Client *messaging.Client
}

func NewFCM

func NewFCM() *FCM

func (*FCM) Notification

func (c *FCM) Notification(title string, tokens []string, video *NotificationVideo) error

指定したトークン宛てにプッシュ通知を送信 送信失敗時、リトライする機能も組み込まれている

type Feed

type Feed struct {
	XMLName xml.Name `xml:"feed"`
	Text    string   `xml:",chardata"`
	Yt      string   `xml:"yt,attr"`
	Media   string   `xml:"media,attr"`
	Xmlns   string   `xml:"xmlns,attr"`
	Link    []struct {
		Text string `xml:",chardata"`
		Rel  string `xml:"rel,attr"`
		Href string `xml:"href,attr"`
	} `xml:"link"`
	ID        string `xml:"id"`
	ChannelId string `xml:"channelId"`
	Title     string `xml:"title"`
	Author    struct {
		Text string `xml:",chardata"`
		Name string `xml:"name"`
		URI  string `xml:"uri"`
	} `xml:"author"`
	Published string `xml:"published"`
	Entry     []struct {
		Text      string `xml:",chardata"`
		ID        string `xml:"id"`
		VideoId   string `xml:"videoId"`
		ChannelId string `xml:"channelId"`
		Title     string `xml:"title"`
		Link      struct {
			Text string `xml:",chardata"`
			Rel  string `xml:"rel,attr"`
			Href string `xml:"href,attr"`
		} `xml:"link"`
		Author struct {
			Text string `xml:",chardata"`
			Name string `xml:"name"`
			URI  string `xml:"uri"`
		} `xml:"author"`
		Published string `xml:"published"`
		Updated   string `xml:"updated"`
		Group     struct {
			Text    string `xml:",chardata"`
			Title   string `xml:"title"`
			Content struct {
				Text   string `xml:",chardata"`
				URL    string `xml:"url,attr"`
				Type   string `xml:"type,attr"`
				Width  string `xml:"width,attr"`
				Height string `xml:"height,attr"`
			} `xml:"content"`
			Thumbnail struct {
				Text   string `xml:",chardata"`
				URL    string `xml:"url,attr"`
				Width  string `xml:"width,attr"`
				Height string `xml:"height,attr"`
			} `xml:"thumbnail"`
			Description string `xml:"description"`
			Community   struct {
				Text       string `xml:",chardata"`
				StarRating struct {
					Text    string `xml:",chardata"`
					Count   string `xml:"count,attr"`
					Average string `xml:"average,attr"`
					Min     string `xml:"min,attr"`
					Max     string `xml:"max,attr"`
				} `xml:"starRating"`
				Statistics struct {
					Text  string `xml:",chardata"`
					Views string `xml:"views,attr"`
				} `xml:"statistics"`
			} `xml:"community"`
		} `xml:"group"`
	} `xml:"entry"`
}

type Keyword

type Keyword struct {
	RoleID        string    `db:"role_id"`
	Name          string    `db:"name"`
	CategoryID    string    `db:"category_id"`
	ChannelID     string    `db:"channel_id"`
	InclusionList string    `db:"inclusion_list"`
	ExclusionList string    `db:"exclusion_list"`
	CreatedAt     time.Time `db:"created_at"`
	UpdatedAt     time.Time `db:"updated_at"`
}

type NotificationVideo

type NotificationVideo struct {
	ID        string
	Title     string
	Thumbnail string
}

type Playlist

type Playlist struct {
	ItemCount int64
	Url       string
}

type Tables

type Tables struct {
	Vtubers []Vtuber
	Videos  []Video
}

type Task

type Task struct {
	Client *cloudtasks.Client
	// contains filtered or unexported fields
}

func NewTask

func NewTask() (*Task, error)

func (*Task) Create

func (t *Task) Create(info *TaskInfo) error

動画開始時刻の 〇分前 に指定のURLにHTTPリクエストを送るタスクを作成 指定されたURLには 動画ID が付属される

type TaskInfo

type TaskInfo struct {
	Video      youtube.Video
	QueueID    string
	URL        string
	MinutesAgo time.Duration
}

type User

type User struct {
	Token     string    `db:"token"`
	Song      bool      `db:"song"`
	Info      bool      `db:"info"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type Video

type Video struct {
	ID                 string    `db:"id"`
	Title              string    `db:"title"`
	Duration           string    `db:"duration"`
	Content            string    `db:"content"`
	ScheduledStartTime time.Time `db:"scheduled_start_time"`
	CreatedAt          time.Time `db:"created_at"`
	UpdatedAt          time.Time `db:"updated_at"`
}

type Vtuber

type Vtuber struct {
	ID                string    `db:"id"`
	Name              string    `db:"name"`
	ItemCount         int64     `db:"item_count"`
	PlaylistLatestUrl string    `db:"playlist_latest_url"`
	CreatedAt         time.Time `db:"created_at"`
	UpdatedAt         time.Time `db:"updated_at"`
}

type Youtube

type Youtube struct {
	Service *youtube.Service
}

func NewYoutube

func NewYoutube(key string) (*Youtube, error)

func (*Youtube) PlaylistItems

func (y *Youtube) PlaylistItems(pids []string) ([]string, error)

func (*Youtube) Playlists

func (y *Youtube) Playlists(pids []string) (map[string]Playlist, error)

チャンネルIDをキー、プレイリストに含まれている動画数を値とした連想配列を返す

func (*Youtube) RssFeed

func (y *Youtube) RssFeed(pids []string) ([]string, error)

RSSから過去30分間にアップロードされた動画IDを取得

func (*Youtube) Videos

func (y *Youtube) Videos(vids []string) ([]youtube.Video, error)

Youtube Data API から動画情報を取得

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL