cmd

package
v0.0.0-...-bbf2ad5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var DB string = "./data/movies.db"
View Source
var GRIST_DOCUMENT_ID string
View Source
var GRIST_KEY string
View Source
var IMDB_ID_EXTRACTOR *regexp.Regexp = regexp.MustCompile(
	`imdb_id::\s+(tt\d{7})`,
)
View Source
var MOVIE_TEMPLATE = `` /* 944-byte string literal not displayed */
View Source
var MOVIE_WATCH_TEMPLATE = `` /* 422-byte string literal not displayed */
View Source
var OMDB_KEY string
View Source
var WATCHED_DATE_EXTRACTOR *regexp.Regexp = regexp.MustCompile(
	`watched::\s*\[\[(\d{4}-\d{2}-\d{2})\]\]`,
)

Functions

func CreateInsertMovieActorParams

func CreateInsertMovieActorParams(
	moviePage *MoviePage,
	movieUuid string,
) []database.InsertMovieActorParams

func CreateInsertMovieDirectorParams

func CreateInsertMovieDirectorParams(
	moviePage *MoviePage,
	movieUuid string,
) []database.InsertMovieDirectorParams

func CreateInsertMovieGenreParams

func CreateInsertMovieGenreParams(
	moviePage *MoviePage,
	movieUuid string,
) []database.InsertMovieGenreParams

func CreateInsertMovieParams

func CreateInsertMovieParams(
	moviePage *MoviePage,
) (*database.InsertMovieParams, error)

func CreateInsertMovieRatingParams

func CreateInsertMovieRatingParams(
	ratings []Rating,
	movieUuid string,
) []database.InsertMovieRatingParams

func CreateInsertMovieReviewParams

func CreateInsertMovieReviewParams(
	movieReviewPage *MovieReviewPage,
	movieUuid string,
) *database.InsertReviewParams

func CreateInsertMovieWatchParams

func CreateInsertMovieWatchParams(movieWatch *MovieWatchPage, movieUuid string) *database.InsertMovieWatchParams

func CreateInsertMovieWriterParams

func CreateInsertMovieWriterParams(
	moviePage *MoviePage,
	movieUuid string,
) []database.InsertMovieWriterParams

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetMovieImdbIdFromWatchFile

func GetMovieImdbIdFromWatchFile(fileContents []byte) (string, error)

func GetMovieTitleFromWatchFile

func GetMovieTitleFromWatchFile(fileContents []byte) (string, error)

func ParseReleased

func ParseReleased(releasedString string) (string, error)

func ParseRuntime

func ParseRuntime(runtimeString string) (int, error)

func SplitOnCommaAndTrim

func SplitOnCommaAndTrim(toSplit string) []string

Types

type MovieDetailUuids

type MovieDetailUuids struct {
	Movie    string
	Genre    []string
	Actor    []string
	Director []string
	Writer   []string
	Rating   []string
}

func InsertMovieDetails

func InsertMovieDetails(
	db *sql.DB,
	ctx context.Context,
	queries *database.Queries,
	movie *MoviePage,
	ratings []Rating,
) (*MovieDetailUuids, error)

type MoviePage

type MoviePage struct {
	Title          string
	ImdbLink       string
	Genres         []string
	Directors      []string
	Actors         []string
	Writers        []string
	Year           int
	RuntimeMinutes int
	Rating         string
	Released       string
	Plot           string
	Country        string
	Language       string
	BoxOffice      string
	Production     string
	CallFelissa    bool
	Slasher        bool
	Zombies        bool
	Beast          bool
	Godzilla       bool
	WallpaperFu    bool
}

func CreateMoviePage

func CreateMoviePage(
	omdbResponse *OmdbMovieResponse, movieWatch *MovieWatchPage,
) (*MoviePage, error)

func CreateMoviePageFromRow

func CreateMoviePageFromRow(
	row *database.Movie,
	genres []string,
	directors []string,
	writers []string,
	actors []string,
) *MoviePage

type MovieParser

type MovieParser struct {
	DataExtractor   *regexp.Regexp
	ImdbIDExtractor *regexp.Regexp
}

func CreateMovieParser

func CreateMovieParser() (*MovieParser, error)

func (*MovieParser) ParsePage

func (p *MovieParser) ParsePage(fileName string) (*MoviePage, error)

type MovieReviewPage

type MovieReviewPage struct {
	MovieTitle string
	ImdbId     string
	Liked      bool
	Review     string
}

type MovieReviewParser

type MovieReviewParser struct {
	DataExtractor   *regexp.Regexp
	TitleExtractor  *regexp.Regexp
	ReviewExtractor *regexp.Regexp
}

func CreateMovieReviewParser

func CreateMovieReviewParser() (*MovieReviewParser, error)

func (*MovieReviewParser) ParseMovieReviewPage

func (p *MovieReviewParser) ParseMovieReviewPage(filename string) (
	*MovieReviewPage, error,
)

type MovieWatchPage

type MovieWatchPage struct {
	Title       string
	FileTitle   string
	Watched     string
	ImdbLink    string
	ImdbId      string
	FirstTime   bool
	JoeBob      bool
	CallFelissa bool
	Beast       bool
	Godzilla    bool
	Zombies     bool
	Slasher     bool
	WallpaperFu bool
	Service     string
	Notes       string
}

func CreateMovieWatchPage

func CreateMovieWatchPage(row *database.GetAllMovieWatchesRow) *MovieWatchPage

type MovieWatchParser

type MovieWatchParser struct {
	DataExtractor  *regexp.Regexp
	NotesExtractor *regexp.Regexp
	TitleExtractor *regexp.Regexp
}

func CreateMovieWatchParser

func CreateMovieWatchParser() (*MovieWatchParser, error)

func (*MovieWatchParser) ParsePage

func (p *MovieWatchParser) ParsePage(fileName string) (*MovieWatchPage, error)

type OmdbClient

type OmdbClient struct {
	// contains filtered or unexported fields
}

func NewOmdbClient

func NewOmdbClient(key string) *OmdbClient

func (*OmdbClient) GetMovie

func (c *OmdbClient) GetMovie(movieId string) (*OmdbMovieResponse, error)

type OmdbMovieResponse

type OmdbMovieResponse struct {
	Title      string   `json:"Title"`
	Year       string   `json:"Year"`
	Rated      string   `json:"Rated"`
	Released   string   `json:"Released"`
	Runtime    string   `json:"Runtime"`
	Genre      string   `json:"Genre"`
	Director   string   `json:"Director"`
	Writer     string   `json:"Writer"`
	Actors     string   `json:"Actors"`
	Plot       string   `json:"Plot"`
	Language   string   `json:"Language"`
	Country    string   `json:"Country"`
	Awards     string   `json:"Awards"`
	Poster     string   `json:"Poster"`
	Ratings    []Rating `json:"Ratings"`
	Metascore  string   `json:"Metascore"`
	ImdbRating string   `json:"imdbRating"`
	ImdbVotes  string   `json:"imdbVotes"`
	ImdbID     string   `json:"imdbID"`
	Type       string   `json:"Type"`
	DVD        string   `json:"DVD"`
	BoxOffice  string   `json:"BoxOffice"`
	Production string   `json:"Production"`
	Website    string   `json:"Website"`
	Response   string   `json:"Response"`
}

type Rating

type Rating struct {
	Source string `json:"Source"`
	Value  string `json:"Value"`
}

Jump to

Keyboard shortcuts

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