README
¶
letterboxd_stats
Package to load films, user information and create stats based on Letterboxd .csv exportable files.
Stats
When calling
LoadFilmsFromCSVfile()
a list of films is returned, using it anything can be done with the film info privided by TMDB. So, if you wish to create your own stats or just display the list of films there is no need to get the buil-in stats. This package can be used just for loading data from the .csv files and obtain the information about each film.
Basic Stats
- Number of films -
NFilms int
- Number of rewatched films -
NRewatched int
- Most seen years -
MostSeenYears map[int]int
- Total of minutes -
NMinutes int
- Number of films watched per week -
NWeek [52]int
- Number of films watched per fay of week (0 for sunday, ...) -
NDayOfWeek [7]int
- Number of films watched per month -
NMonth [12]int
- Number of films per genre -
Genres map[string]int
- Number of films per languages -
Languages map[string]int
- Number of films per country -
Countries map[string]int
- Average rating -
AvgRating float32
Cast Stats
- Number of films per cast member -
Acting map[string]int
- Number of films per director -
Directors map[string]int
- Number of films per writer -
Writers map[string]int
- Number of films per cinematographer -
Cinematographers map[string]int
- Number of films per editor -
Editors map[string]int
- Number of films per producer -
Producers map[string]int
- Number of films per music crew member -
Music map[string]int
Example
import "github.com/diogoftm/letterboxd_stats"
// get user info
var user lbstats.User
user = lbstats.LoadUser("xpto/profile.csv") // get user info
// load films
var filmList lbstats.FilmList
filmList = lbstats.LoadFilmsFromCSVfile("xpto/diary.csv")
// get basic and credits stats
var bs lbstats.BasicStats
var cs lbstats.CreditsStats
var err error
bs, err = lbstats.GetBasicStats(filmList, 0)
cs, err = lbstats.GetCreditsStats(filmList, 0)
TMDB
The Movie Database (TMDB) is a community built movie and TV database. Every piece of data has been added by our amazing community dating back to 2008. TMDB's strong international focus and breadth of data is largely unmatched and something we're incredibly proud of. Put simply, we live and breathe community and that's precisely what makes us different.
All film information is obtained from TMDB's API. Letterboxd uses TMDB too, but on the .csv files they do not include the TMDB id of films. So, a search is always made using the title and the year of release of each film and the best match is picked. Because of that, in some cases, a Letterboxd URI might be mismatched to it's respective TMDB id.
Documentation
¶
Index ¶
- func Check(e error)
- func ParseToDate(str string) time.Time
- func SingleAtoi(str string) int
- func SingleParseFloat(str string) float32
- type Basic
- type BasicStats
- type Cast
- type Company
- type Country
- type Credits
- type CreditsStats
- type Crew
- type Film
- type FilmList
- type FindAnswer
- type Gender
- type Rewatch
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseToDate ¶
func SingleAtoi ¶
func SingleParseFloat ¶
Types ¶
type Basic ¶
type Basic struct { Adult bool `json:"adult"` Backdrop_path string `json:"backdrop_path"` Budget int `json:"budget"` Genres []Gender `json:"genres"` Homepage string `json:"homepage"` Id int `json:"id"` Imdb_id string `json:"imdb_id"` Original_language string `json:"original_language"` Original_title string `json:"original_title"` Overview string `json:"overview"` Popularity float32 `json:"popularity"` Poster_path string `json:"poster_path"` Production_companies []Company `json:"production_companies"` Production_countries []Country `json:"production_countries"` Release_date string `json:"release_date"` Revenue int `json:"revenue"` Runtime int `json:"runtime"` Spoken_languages []Country `json:"spoken_languages"` Status string `json:"status"` Tagline string `json:"tagline"` Title string `json:"title"` Video bool `json:"video"` Vote_average float32 `json:"vote_average"` Vote_count int `json:"vote_count"` Year int }
type BasicStats ¶
type BasicStats struct { NFilms int //number of films (does not include rewatches) NRewatched int MostSeenYears map[int]int NMinutes int NWeek [52]int NDayOfWeek [7]int //0 for sunday, ... NMonth [12]int Genres map[string]int Languages map[string]int Countries map[string]int AvgRating float32 }
func GetBasicStats ¶
func GetBasicStats(list FilmList, year int) (BasicStats, error)
General stats based on a list of films for a given year (year=0 for no year restriction)
type Cast ¶
type Cast struct { Adult bool `json:"adult"` Gender int `json:"gender"` Id int `json:"id"` Known_for_department string `json:"known_for_department"` Name string `json:"name"` Original_name string `json:"original_name"` Popularity float32 `json:"popularity"` Profile_path string `json:"profile_path"` Cast_id int `json:"cast_id"` Character string `json:"character"` Credit_id string `json:"credict_id"` Order int `json:"order"` }
type CreditsStats ¶
type CreditsStats struct { Acting map[string]int Directors map[string]int Writers map[string]int Cinematographers map[string]int Editors map[string]int Producers map[string]int Music map[string]int }
func GetCreditsStats ¶
func GetCreditsStats(list FilmList, year int) (CreditsStats, error)
Cast and crew stats based on a list of films for a given year (year=0 for no year restriction)
type Crew ¶
type Crew struct { Adult bool `json:"adult"` Gender int `json:"gender"` Id int `json:"id"` Known_for_department string `json:"known_for_department"` Name string `json:"name"` Original_name string `json:"original_name"` Popularity float32 `json:"popularity"` Profile_path string `json:"profile_path"` Credit_id string `json:"credict_id"` Department string `json:"department"` Job string `json:"job"` }
type Film ¶
type Film struct { Basic Basic Credits Credits Date string Rating float32 Rewatch []Rewatch // contains filtered or unexported fields }
func Duplicates ¶
type FilmList ¶
type FilmList struct { AllFilms map[int]*Film //keys are TMDB id's AllFilmsByLbURI map[string]*Film //keys are letterboxd URI's FilmsByYear map[int][]*Film //rewatches are included, use nRewatched() to get the full list taking into account the full depth of the Rewatched list }
func LoadFilmsFromCSVfile ¶
Load films from diary.csv like file