Global

Members

(constant) APP_PATH :String

Source:

path to /src/ that is used as base paths in other files

Type:
  • String

(constant) PATHS :SystemPaths

Source:
Type:

Methods

addHistoryUpdates(smallChanges)

Source:

Pushes updates to the update-posting queue which collects following pushes and posts them together in a single api connection rather than one for each update.

Parameters:
Name Type Description
smallChanges Object
Properties
Name Type Attributes Description
movies Array.<Object> <optional>
shows Array.<Object> <optional>

cacheListener(event, details)

Source:

Callback function for events on the 'cache' channel. It collects cache actions like key addition or savings and executes them in an organized manner to prevent unnecessary disk activity.

Parameters:
Name Type Description
event Electron.IpcMainEvent

Ipc event the callback will receive

details IpcDetails

Options explaining requested cache action

cacheRequest(cacheName, cacheKey, request, saveRightAfter)

Source:

Returns the data which was saved in the cache with the given key and requests it if nothing was saved. The data will be temporarily stored to make processing request arrays easier. To permanently save the results to the cache, use cacheSave.

Parameters:
Name Type Default Description
cacheName String

Name of the cache data will be saved to

cacheKey String

Key under which the data is accessed

request Promise

API request which gets the data in case it wasn't cached before

saveRightAfter Boolean false

Save the data to cache after requesting it

cacheSave(cacheName)

Source:

Saves all temporarily stored values to disk.

Parameters:
Name Type Description
cacheName String

Name of the cache

getAPIKeys() → {APIKeys}

Source:

Searches for existing keyfiles and returns the contents. If a secret version exists and is complete, it will be used over dev keys. Useful to automate keys in different environment setups.

Returns:

Object with API keys

Type
APIKeys

getUnfinishedProgressList(n, update, loadingCallback)

Source:

Gets an array of n shows and it's progress that are not finished yet. If argument update is true, the updated items are re-requested instead of directly restored from cache.

Parameters:
Name Type Description
n Number

Number of sequential shows with unseen episodes to get

update Boolean

If cached data should be checked against possible updates

loadingCallback function

A callback that sends the percentage of progression

initFileStructure() → {Promise.<SystemPaths>}

Source:

Initializes a directory tree that is used for system files. It detects existing files and does not overwrite them to keep custom settings.

Returns:

Resolves paths of system files

Type
Promise.<SystemPaths>

(async) newActivitiesAvailable() → {Array.<('movies'|'episodes'|'shows'|'seasons'|'comments'|'lists')>}

Source:

To keep in sync with trakt.tv's database, this function is used to find activities that have updates available which are not shown in the app yet.

Returns:

Types of activities that require updating

Type
Array.<('movies'|'episodes'|'shows'|'seasons'|'comments'|'lists')>

openInfoCard(poster)

Source:

First function to trigger when a poster is clicked.

Parameters:
Name Type Description
poster HTMLElement

Image which got clicked on

postHistoryUpdates(bigChanges) → {Promise}

Source:

Posts updates to the trakt.tv api.

Parameters:
Name Type Description
bigChanges Object
Properties
Name Type Attributes Description
movies Array.<Object> <optional>
shows Array.<Object> <optional>
Returns:

Resolves a summary of what has been added and what not

Type
Promise

readConfig() → {Config}

Source:

Reads configuration file from disk.

Returns:

Configuration settings

Type
Config

removeCacheFiles()

Source:

Deletes all cache files at once.

(async) requestAndLoadImage(options, onLoad)

Source:

This function can be called whenever you want to place an image element into some HTML context. It first shows a loading animation but as soon as the requested image is ready, it will take the placeholder's place.

Parameters:
Name Type Description
options object
Properties
Name Type Description
parent HTMLElement

dom element the image should be appended to

use 'poster'

in what type of element the image will be used

type 'season'

type the item belongs to

itemId number

tvdb id of the item

reference any

some reference we can use

attributes object

additional attributes, only the final image should get

classes Array.<string>

CSS classes the final image should have

onLoad function

callback to execute after loading is fully complete

requestHistoryUpdatePosting(id, item, dateopt)

Source:

Wrapper for addHistoryUpdates that formats the input data so it can be processed easier.

Parameters:
Name Type Attributes Description
id Number

trakt-id of the item

item Object | Object

type of the item, absolute season and episode number required if the item is an episode

date Date <optional>

defaults to the date of this function call

resetConfig() → {Config}

Source:

Overwrites the configuration file with defaults and returns the data. Removes authenticated users.

Returns:

The default configuration

Type
Config

saveConfig(updates)

Source:

Writes changes to the configuration file.

Parameters:
Name Type Description
updates Config

Config object with possibly unsaved changes

show(child)

Source:

Highlights the passed element. It does this by giving the element the 'selected' class and removing it from all siblings.

Parameters:
Name Type Description
child HTMLElement

startsWithFilter(string, prefixes, removeFromFilteropt) → {filterResult}

Source:

Searches for a matching prefix in a given string and removes it. It is mainly used to identify filter arguments in search queries.

Example
let string = 's:Firefly'
let prefixes = ['s:', 'm:']
let remaining = startsWithFilter('s:Firefly', 's:', ':')
remaining == {
   filtered: 'Firefly',
   found: 's'
}
Parameters:
Name Type Attributes Description
string String

The full text to analyse

prefixes Array.<String>

Strings to search for

removeFromFilter String <optional>

Characters to include in the search but remove from the filter result

Returns:

The filter result

Type
filterResult

toggleClass(child)

Source:

Adds class to element if it doesn't have it already, otherwise removes it.

Parameters:
Name Type Description
child HTMLElement

Target element

Type Definitions

APIKeys

Source:

Keys, secrets and tokens used for API requests.

Properties:
Name Type Description
trakt_id String
trakt_secret String
fanart_key String

Config

Source:

Configuration settings for the app.

Properties:
Name Type Description
client Object
Properties
Name Type Description
settings Object
rpc Object
user Object
Properties
Name Type Description
trakt Object
Properties
Name Type Description
auth Object | false
status Boolean

filterResult

Source:
Properties:
Name Type Description
filtered String

The remaining string after removing the prefix

found String

The prefix

Type:
  • Object

IpcDetails

Source:
Properties:
Name Type Attributes Description
name String
action String
data any <optional>
key String <optional>
Type:
  • Object

SystemPaths

Source:

Paths of system files that are saved outside the app.

Properties:
Name Type Description
cache String
log String
config String