Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with scrobbler #23

Merged
merged 27 commits into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
build/*
eslint-plugin-prefer-arrow/*
src/streaming-services/scrobbler-template/*
src/streaming-services/sync-template/*
!.eslintrc.js
!.eslintrc.typed.js
!.lintstagedrc.js
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dist/
config.json
*.log
/.idea/
/universal-trakt-sync.iml
/universal-trakt-scrobbler.iml
package-lock.json
7 changes: 7 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
'*.{json,css,html,md,yml,yaml}': 'prettier --write',
'*.{js,jsx,ts,tsx}': (filenames) => [
'tsc --noEmit -p ./tsconfig.json',
`eslint --fix --quiet -c ./.eslintrc.typed.js --no-eslintrc ${filenames.join(' ')}`,
],
};
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,64 @@
<h1 align="center">
<br>
<img alt="Universal Trakt Sync" src="https://github.com/trakt-tools/universal-trakt-sync/raw/master/src/images/uts-icon-128.png" width="150">
<img alt="Universal Trakt Scrobbler" src="https://github.com/trakt-tools/universal-trakt-scrobbler/raw/master/src/images/uts-icon-128.png" width="150">
<br>
Universal Trakt Sync
Universal Trakt Scrobbler
<br>
</h1>
<h4 align="center">A universal sync for Trakt.tv.</h4>
<h4 align="center">A universal scrobbler for Trakt.tv.</h4>
<p align="center">
<a href="https://github.com/trakt-tools/universal-trakt-sync/releases">
<img alt="GitHub Release" src="https://img.shields.io/github/release/trakt-tools/universal-trakt-sync.svg">
<a href="https://github.com/trakt-tools/universal-trakt-scrobbler/releases">
<img alt="GitHub Release" src="https://img.shields.io/github/release/trakt-tools/universal-trakt-scrobbler.svg">
</a>
</p>
<p align=left">
<a href="">
<img alt="Get the extension on Chrome" src="https://github.com/trakt-tools/universal-trakt-sync/raw/master/assets/chrome-badge.png">
<img alt="Get the extension on Chrome" src="https://github.com/trakt-tools/universal-trakt-scrobbler/raw/master/assets/chrome-badge.png">
</a>
</p>
<p align=left">
<a href="">
<img alt="Get the extension on Firefox" src="https://github.com/trakt-tools/universal-trakt-sync/raw/master/assets/firefox-badge.png"></a>
<img alt="Get the extension on Firefox" src="https://github.com/trakt-tools/universal-trakt-scrobbler/raw/master/assets/firefox-badge.png"></a>
</p>

### Table of Contents

- [What is Universal Trakt Sync?](#what-is-universal-trakt-sync)
- [What is Universal Trakt Scrobbler?](#what-is-universal-trakt-scrobbler)
- [Why do I need this extension?](#why-do-i-need-this-extension)
- [Which streaming services are supported?](#which-streaming-services-are-supported)
- [How does the extension work?](#how-does-the-extension-work)
- [Problems](#problems)
- [Development](#development)
- [Credits](#credits)

### What is Universal Trakt Sync?
### What is Universal Trakt Scrobbler?

An extension that allows you to sync your TV shows and movies watching history from your favorite streaming services to Trakt.tv.
An extension that allows you to automatically scrobble TV shows and movies that you are watching, and sync your history, from your favorite streaming services to Trakt.tv.

### Why do I need this extension?

If you want to sync from Netflix, this is the only Trakt.tv [plugin](https://trakt.tv/apps) that does it. In the future, we'll be adding support for more streaming services, so it will also serve as a single extension that works for multiple services.
If you want to scrobble / sync from Netflix, this is the only Trakt.tv [plugin](https://trakt.tv/apps) that does it. In the future, we'll be adding support for more streaming services, so it will also serve as a single extension that works for multiple services.

### Which streaming services are supported?

- Amazon Prime (Scrobble only)
- HBO Go (Scrobble only - tested only for Latin America)
- Netflix
- NRK
- Viaplay
- NRK (Sync only)
- Viaplay (Sync only)

### How does the extension work?

It extracts information about the TV shows / movies that you have watched watching by scraping the page and sends the data to Trakt using the [Trakt API](https://trakt.docs.apiary.io/).
It extracts information about the TV shows / movies that you are watching / have watched by scraping the page or using the stremaing service API and sends the data to Trakt using the [Trakt API](https://trakt.docs.apiary.io/).

### Known Issues

- The extension does not work well with Firefox containers, so if you use them, make sure that you are logged in to your Trakt / Netflix accounts in the no-container.
- When you stop watching something on Netflix, try not to immediately close the tab / window. Using the "Back to Browse" button or pausing first is preferable, because then the extension is able to detect that you have stopped watching. If you simply close the tab / window, the extension will keep scrobbling the item.
- Make sure you are logged into Streaming Services before trying to sync history content.
- You might have to disable the "automatic mode" in the Temporary Containers extension while logging in, if you use it.
- Make sure you are logged into streaming services before trying to sync history content.

### Other Problems

If you find any other problems or have suggestions or questions, feel free to [open an issue](https://github.com/trakt-tools/universal-trakt-sync/issues/new).
If you find any other problems or have suggestions or questions, feel free to [open an issue](https://github.com/trakt-tools/universal-trakt-scrobbler/issues/new).

### Development

Expand Down Expand Up @@ -101,22 +102,21 @@ npm run build
npm run zip
```

####How to add more streaming services
#### How to add more streaming services

- Make sure that the serivce you want to add actually has a rest API.
- Add hostname/domain to permissions in manifest in `webpack.config.js`.
- Copy one the existing services in `src/modules/history/streaming-services/`. Netflix is the most complex one.
- The Page- and Store-files should be fairly easy to update. Probably just the name as all logic is in the inherited classes.
- As a TypeScript project, interfaces of rest APIs should be declared in `src/typedefs.d.ts`.
- All APIs have different aspects and limitations, updates may be needed elsewhere in the sourcecode to handle these cases.
- First of all, edit the file `src/streaming-services/streaming-services.ts` and add an entry for the new service with a unique ID e.g. 'Netflix' => 'netflix', 'Amazon Prime' => 'amazon-prime'. Don't forget to set the `hasScrobbler` and `hasSync` flags correctly.
- Some services can have different aspects and limitations, and updates may be needed elsewhere in the source code to handle these cases, so the steps below are more of a guideline.
- For a scrobbler: copy the `src/streaming-services/scrobbler-template/` folder and adjust accordingly. Remember to use **the same ID** specified in `src/streaming-services/streaming-services.ts` for the folder name and for the content script file name. That's it!
- For a sync: copy the `src/streaming-services/sync-template/` folder and adjust accordingly. Remember to use **the same ID** specified in `src/streaming-services/streaming-services.ts` for the folder name, and don't forget to import the `*Api.ts` file in `src/streaming-services/pages.ts`, otherwise the service won't load at all. That's it!
- You can see the folders of the other services for some reference. The templates are just the basic to get you started.

### Credits

This extension is based on [traktflix](https://github.com/tegon/traktflix), the original Netflix sync developed by [tegon](https://github.com/user/tegon), which was discontinued in favor of Universal Trakt Sync.

<h3 align="center">
<img alt="TMDb API" src="https://github.com/trakt-tools/universal-trakt-sync/raw/master/assets/tmdb-api-logo.png" width="150">
<img alt="Trakt API" src="https://github.com/trakt-tools/universal-trakt-sync/raw/master/assets/trakt-api-logo.png" width="150">
<img alt="TMDb API" src="https://github.com/trakt-tools/universal-trakt-scrobbler/raw/master/assets/tmdb-api-logo.png" width="150">
<img alt="Trakt API" src="https://github.com/trakt-tools/universal-trakt-scrobbler/raw/master/assets/trakt-api-logo.png" width="150">
</h3>

This product uses the TMDb API, but is not endorsed or certified by TMDb.
Expand Down
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "universal-trakt-sync",
"name": "universal-trakt-scrobbler",
"version": "1.0.0",
"description": "A universal sync for Trakt.tv.",
"author": "trakt-tools",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/trakt-tools/universal-trakt-sync.git"
"url": "git://github.com/trakt-tools/universal-trakt-scrobbler.git"
},
"scripts": {
"build": "webpack --env.production",
Expand Down Expand Up @@ -100,12 +100,5 @@
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{json,css,html,md,yml,yaml}": "prettier --write",
"*.{js,jsx,ts,tsx}": [
"tsc --allowJs --checkJs --jsx 'react' --module 'CommonJS' --target 'ES2020' --strict --typeRoots ./node_modules/@types,./node_modules/web-ext-types --resolveJsonModule --skipLibCheck --noEmit ./src/global.d.ts",
"eslint --fix --quiet -c ./.eslintrc.typed.js --no-eslintrc"
]
}
}
2 changes: 1 addition & 1 deletion scripts/generateRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const packageJson = require(path.resolve(__dirname, '../package.json'));
const args = getArguments(process);
const octokit = new Octokit({
auth: args.token,
userAgent: 'universal-trakt-sync',
userAgent: 'universal-trakt-scrobbler',
});
const defaultParams = {
owner: packageJson.author,
Expand Down
37 changes: 35 additions & 2 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"appName": {
"message": "Universal Trakt Sync"
"message": "Universal Trakt Scrobbler"
},
"appShortName": {
"message": "UTS"
Expand All @@ -15,7 +15,7 @@
"message": "Add with release date."
},
"aboutMessage": {
"message": "Sync the history from your favorite streaming services to Trakt.tv!"
"message": "Send your activity from your favorite streaming services to Trakt.tv!"
},
"allowRollbarDescription": {
"message": "With this option enabled, whenever a bug occurs, information about it will be collected and sent to us, so that we can fix it faster and improve the extension. This information includes: when the bug happened, the traceback of the bug, the name and version of your browser, and the name of your OS. This data is not shared with any other service."
Expand Down Expand Up @@ -66,6 +66,15 @@
"correctWrongItemFailed": {
"message": "Failed to correct wrong item."
},
"couldNotScrobble": {
"message": "Could not scrobble."
},
"disableScrobblingDescription": {
"message": "With this option enabled, the extension will not automatically scrobble what you are watching. This is useful if you only want to use the history sync."
},
"disableScrobblingName": {
"message": "Disable scrobbling."
},
"errorNotification": {
"message": "An error has occurred. :("
},
Expand All @@ -90,6 +99,9 @@
"hideSyncedName": {
"message": "Hide synced."
},
"history": {
"message": "History"
},
"historySyncSuccess": {
"message": "$EPISODES$ episodes and $MOVIES$ movies synced.",
"placeholders": {
Expand Down Expand Up @@ -146,6 +158,12 @@
"notWatched": {
"message": "Not Watched"
},
"notWatching": {
"message": "Watch something!"
},
"nowScrobbling": {
"message": "Now Scrobbling"
},
"on": {
"message": "On"
},
Expand All @@ -172,6 +190,15 @@
"saveOptionSuccess": {
"message": "Option saved."
},
"scrobblePaused": {
"message": "Scrobble paused."
},
"scrobbleStarted": {
"message": "Scrobble started."
},
"scrobbleStopped": {
"message": "Scrobble stopped."
},
"select": {
"message": "Select:"
},
Expand All @@ -190,6 +217,12 @@
"sendReceiveSuggestionsName": {
"message": "Send / receive correction suggestions."
},
"showNotificationsDescription": {
"message": "With this option enabled, you will receive browser notifications whenever you start / stop scrobbling something."
},
"showNotificationsName": {
"message": "Show browser notifications."
},
"streamingServicesDescription": {
"message": "Choose which streaming services to enable."
},
Expand Down
37 changes: 35 additions & 2 deletions src/_locales/nb/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"appName": {
"message": "Universal Trakt Sync"
"message": "Universal Trakt Scrobbler"
},
"appShortName": {
"message": "UTS"
Expand All @@ -15,7 +15,7 @@
"message": "Legg til med utgivelsesdato."
},
"aboutMessage": {
"message": "Synkroniser historikken fra dine favorittstrømmetjenester til Trakt.tv!"
"message": "Send aktiviteten fra dine favorittstrømmetjenester til Trakt.tv!"
},
"allowRollbarDescription": {
"message": "Dersom det oppstår en feil, kan utviklerne få informasjon om det, slik at det er enklere å feilsøke, fikse og forbedre utvidelsen. Informasjonen som sendes inkluderer: Når feilen inntraff, omstendinghetene rundt feilen, navn og versjonsnummeret på nettleseren, og navnet på operativsystemet. Dataene blir ikke delt videre med andre tjenester."
Expand Down Expand Up @@ -66,6 +66,15 @@
"confirmClearTraktCacheTitle": {
"message": "Fjerne Trakt cache?"
},
"couldNotScrobble": {
"message": "Scrobbling feilet."
},
"disableScrobblingDescription": {
"message": "Dersom dette valget er aktivert vil utvidelsen ikke automatisk scrobble det du ser på. Dette er nyttig om du bare ønsker å bruke sync av historikk."
},
"disableScrobblingName": {
"message": "Deaktiver scrobbling."
},
"errorNotification": {
"message": "Noe har gått galt. :("
},
Expand All @@ -87,6 +96,9 @@
"grantCookiesName": {
"message": "Tillat \"cookies\" slik at utvidelsen kan virke sammen med Firefox Containers."
},
"history": {
"message": "Historikk"
},
"hideSyncedName": {
"message": "Skjul allerede synkroniserte elementer."
},
Expand Down Expand Up @@ -146,6 +158,12 @@
"notWatched": {
"message": "Ikke registrert som sett"
},
"notWatching": {
"message": "Se på noe!"
},
"nowScrobbling": {
"message": "Scrobbler nå"
},
"on": {
"message": "På"
},
Expand All @@ -172,6 +190,15 @@
"saveOptionSuccess": {
"message": "Alternativ lagret."
},
"scrobblePaused": {
"message": "Scrobbling pauset."
},
"scrobbleStarted": {
"message": "Scrobbling startet."
},
"scrobbleStopped": {
"message": "Scrobbling stoppet."
},
"select": {
"message": "Velg:"
},
Expand All @@ -190,6 +217,12 @@
"sendReceiveSuggestionsName": {
"message": "Send / motta forslag til rettelser."
},
"showNotificationsDescription": {
"message": "Viser nettleservarsler hver gang du starter / stopper å scrobble noe."
},
"showNotificationsName": {
"message": "Vis nettleservarsler"
},
"streamingServicesDescription": {
"message": "Velg strømmetjenester som du vil ha aktive."
},
Expand Down
Loading