Skip to content

Commit

Permalink
refactor: enable users to pass their imdb user id as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
cecobask committed Aug 12, 2022
1 parent 79749a5 commit 6907f4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ IMDB_COOKIE_UBID_MAIN=133-3657396-5532224
# example: ls517879007,ls084017844,ls093412639
# if value equals to `all` it will auto sync all your lists
IMDB_LIST_IDS=all
# IMDb user id can be found within the URL when you have your profile/watchlist/ratings/lists opened (need to be loggen in)
# example: ur90652269
# if value equals to `scrape` or you omit adding it, your user id will be scraped from the web
IMDB_USER_ID=scrape
# Trakt access token for your API app (info in the README file)
TRAKT_ACCESS_TOKEN=b89d620b5ef4dcc72a20300fb5e5c0b207b6d42ff9095dd574311b46aca41024
# Trakt client id of your API app (https://trakt.tv/oauth/applications/new)
Expand Down
5 changes: 4 additions & 1 deletion pkg/providers/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ func Sync() {
}

func (u *user) populateData(ic *imdb.Client, tc *trakt.Client) {
ic.Config.UserId = ic.UserIdScrape()
ic.Config.UserId = os.Getenv("IMDB_USER_ID")
if ic.Config.UserId == "" || ic.Config.UserId == "scrape" {
ic.Config.UserId = ic.UserIdScrape()
}
ic.Config.WatchlistId = ic.WatchlistIdScrape()
tc.Config.UserId = tc.UserIdGet()
imdbListIdsString := os.Getenv(imdb.ListIdsKey)
Expand Down

0 comments on commit 6907f4f

Please sign in to comment.