Code Monkey home page Code Monkey logo

goplaxt's Introduction

Notice I will not be doing any more development on this project as Trakt now has official support for Plex Webhooks. I'm using em, you should too.

This tool should continue to work if you're not willing to pay for Trakt VIP, and I'll continue merging PRs, but don't expect your issues to be answered.

Plaxt

CircleCI Docker Cloud Build

Plex provides webhook integration for all Plex Pass subscribers, and users of their servers. A webhook is a request that the Plex application sends to third party services when a user takes an action, such as watching a movie or episode.

You can ask Plex to send these webhooks to this tool, which will then log those plays in your Trakt account.

This is a full rewrite of my somewhat popular previous iteration. This time it's written in Go and deployable with Docker so I can run it on my own infrastructure instead of Heroku.

To start scrobbling today, head to plaxt.astandke.com and enter your Plex username! It's as easy as can be!

If you experience any problems or have any suggestions, please don't hesitate to create an issue on this repo.

Deploying For Yourself

Goplaxt is designed to be run in Docker. You can host it right on your Plex server!

To run it yourself, first create an API application through Trakt here. Set the Allowed Hostnames to be the URI you will hit to access Plaxt, plus /authorize. So if you're exposing your server at http://10.20.30.40:8000, you'll set it to http://10.20.30.40:8000/authorize. Bare IP addresses and ports are totally fine, but keep in mind your Plaxt instance must be accessible to all the Plex servers you intend to play media from.

Once you have that, creating your container is a snap:

docker create \
  --name=plaxt \
  --restart always \
  -v <path to configs>:/app/keystore \
  -e TRAKT_ID=<trakt_id> \
  -e TRAKT_SECRET=<trakt_secret> \
  -e ALLOWED_HOSTNAMES=<your public hostname(s) comma or space seperated> \
  -p 8000:8000 \
  xanderstrike/goplaxt:latest

If you are using a Raspberry Pi or other ARM based device, simply use xanderstrike/goplaxt:latest-arm7.

Then go ahead and start it with:

docker start plaxt

Alternatively you can use docker-compose:

version: "3.4" # This will probably also work with version 2
services:
  plaxt:
    container_name: plaxt
    environment:
    - TRAKT_ID=<trakt_id>
    - TRAKT_SECRET=<trakt_secret>
    - ALLOWED_HOSTNAMES=<your public hostname(s) comma or space seperated>
    image: xanderstrike/goplaxt
    ports:
    - 8000:8000
    restart: unless-stopped
    volumes:
    - <path to configs>:/app/keystore

Contributing

Please do! I accept any and all PRs. My golang is not the best currently, so I'd love some thoughts on worthwhile refactors. I sort of blew through this without adding any tests, so testing won't be a hard requirement for contributions until I add some (though they're always welcome, of course).

Security PSA

You should know that by using the instance I host, I perminantly retain your Plex username, and an API key that allows me to add plays to your Trakt account (but not your username). Also, I log the title and year of films you watch and the title, season, and episode of shows you watch. These logs are temporary and are rotated every 24 hours with older logs perminantly deleted.

I promise to Do No Harm with this information. It will never leave my server, and I won't look at it unless I'm troubleshooting bugs. Frankly, I couldn't care less. However, I believe it's important to disclose my access to your information. If you are not comfortable sharing I encourage you to host the application on your own hardware.

I have never been served with any government requests for data.

License

MIT

goplaxt's People

Contributors

brutuz avatar cmilam87 avatar corentinb avatar crlorentzen avatar halkeye avatar lumaxis avatar nemchik avatar ojford avatar pabloromeo avatar reconman avatar xanderstrike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goplaxt's Issues

Tracking viewing for multiple users

I have a single Plex account but I have multiple accounts under my Plex install. With the webhook in place, it only works with Trakt to show the things that my main account has watched. It does not show my subaccounts.

hosted app is not scrobbling to me

I could authorize with trakt, set up the webhook, made sure webhooks are enabled on the servers I use, still I see no scrobbling. Any ideas what needs to be checked?

only allowed 6 webhooks?!?

hello, think i'm missing something,
gotr 26 users on my server, want them to all use trakt of there own, i have plex pass as server owner.
can only put in 6 webhooks?
i thougth i could write in all 26 users on each there own trakt log etc, useing my webhooks?!?

Trakt Create App

Hi,

Is this how I need to add Redirect URI and CORS?

1

Thank you

Properly handle expired keys

Trakt is being slammed at all hours by webhook requests from people who's Trakt keys are invalid.

This causes Plaxt to attempt to refresh the keys, which then returns a 401 with the message "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."

This happens repeatedly, every time that user sends a webhook to Plaxt. There is no way to recover from this because the refresh keys have been made invalid. The cause is also impossible to determine, Trakt is not sufficiently explicit with their errors, and there is no way to contact the owners of these keys to get them to stop sending webhooks.

This may have knock on effects, because Plaxt is basically spamming the Trakt api with invalid and useless requests. It might be the cause of some of the 502s being reported.

The best we can do is mitigate the damage. We should delete user records that have unrecoverable invalid keys. This way we'll stop sending so many API requests to Trakt and hopefully bother them less.

[BUG] index out of range

Platform: Docker

Running behind nginx proxy

I am able to successfully authorize a user, but when a video state change the application bugs out

2020/11/25 06:16:29 http: panic serving 192.168.68.139:54574: runtime error: index out of range
goroutine 94 [running]:
net/http.(*conn).serve.func1(0xc0004b7180)
        /usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x85f6c0, 0xcc4cc0)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/xanderstrike/goplaxt/lib/trakt.findEpisode(0xc0005ec220, 0xb, 0x101, 0x1, 0xc0005b2800, 0x3a, 0xc0005ec1f8, 0x8, 0xc0005ec248, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:85 +0x755
github.com/xanderstrike/goplaxt/lib/trakt.HandleShow(0xc0005ec220, 0xb, 0x101, 0x1, 0xc0005b2800, 0x3a, 0xc0005ec1f8, 0x8, 0xc0005ec248, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:59 +0xde
github.com/xanderstrike/goplaxt/lib/trakt.Handle(0xc0005ec220, 0xb, 0x101, 0x1, 0xc0005b2800, 0x3a, 0xc0005ec1f8, 0x8, 0xc0005ec248, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:47 +0x14f
main.api(0x984960, 0xc0005dc000, 0xc0000ee700)
        /go/src/github.com/xanderstrike/goplaxt/main.go:104 +0x759
net/http.HandlerFunc.ServeHTTP(0x900a58, 0x984960, 0xc0005dc000, 0xc0000ee700)
        /usr/local/go/src/net/http/server.go:1995 +0x44
main.allowedHostsHandler.func1.1(0x984960, 0xc0005dc000, 0xc0000ee700)
        /go/src/github.com/xanderstrike/goplaxt/main.go:135 +0x2f3
net/http.HandlerFunc.ServeHTTP(0xc00007d4a0, 0x984960, 0xc0005dc000, 0xc0000ee700)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x984960, 0xc0005dc000, 0xc0000ee700)
        /go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc0005a8020, 0x984960, 0xc0005dc000, 0xc0000ee700)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000aa0c0, 0x984960, 0xc0005dc000, 0xc0000ee400)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xe3
net/http.serverHandler.ServeHTTP(0xc000084a90, 0x984960, 0xc0005dc000, 0xc0000ee400)
        /usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc0004b7180, 0x9854a0, 0xc00005a100)
        /usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x2f4

Server crashes after authentication

Here's my log files
`
2020/07/28 20:07:58 Handling auth request for ********

2020/07/28 20:07:58 Authorized as c2d86713296ba673eec252a2820fec43

2020/07/28 20:07:58 Got a 401 Unauthorized, full response:
&{401 Unauthorized 401 HTTP/2.0 2 0 map[Cache-Control:[no-store] Cf-Cache-Status:[DYNAMIC] Cf-Railgun:[7aebe2b78d 1.87 0.006365 0030 57da] Cf-Ray:[5ba13abf0f3e6bc6-SJC] Cf-Request-Id:[0438a30b6400006bc667b7e200000001] Content-Length:[213] Content-Type:[application/json; charset=utf-8] Date:[Tue, 28 Jul 2020 20:07:58 GMT] Expect-Ct:[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"] Pragma:[no-cache] Server:[cloudflare] Set-Cookie:[__cfduid=de35f7dcf30671ee6f3a4b3f8529c85da1595966878; expires=Thu, 27-Aug-20 20:07:58 GMT; path=/; domain=.trakt.tv; HttpOnly; SameSite=Lax _traktsession=bEF3TisxQTh0UGlZSGtXSWtqZlFDV1dtM0poLzBNZTAvV0x1c3pZNDZaSGVOL29XL2tDeU9IN1pia1RxS1NQUWl2Q0ZaU21NSnZyL1MzT0k3d3h4NlE9PS0tUzBxVytyU3VtTk5WSTI2cWlrKy9ZUT09--e08bd785a5fd764367b42ee653ae0267bbfd010e; path=/; HttpOnly] Vary:[Accept-Encoding] Www-Authenticate:[Bearer realm="Doorkeeper", error="invalid_grant", error_description="The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."] X-Content-Type-Options:[nosniff] X-Frame-Options:[SAMEORIGIN] X-Request-Id:[3b3f9706-5365-43d3-bf80-6fffa93dc515] X-Runtime:[0.003935] X-Xss-Protection:[1; mode=block]] {0xc00022a8c0} 213 [] false false map[] 0xc000154c00 0xc0000a6370}.
Aborting to avoid panic.

2020/07/28 20:07:58 http: panic serving 172.18.0.1:37574: interface conversion: interface {} is nil, not string
goroutine 66 [running]:
net/http.(*conn).serve.func1(0xc000194820)
/usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x85fb40, 0xc00040d2f0)
/usr/local/go/src/runtime/panic.go:522 +0x1b5
main.authorize(0x9803e0, 0xc0001a4380, 0xc000154b00)
/go/src/github.com/xanderstrike/goplaxt/main.go:57 +0x833
net/http.HandlerFunc.ServeHTTP(0x8fcb80, 0x9803e0, 0xc0001a4380, 0xc000154b00)
/usr/local/go/src/net/http/server.go:1995 +0x44
main.allowedHostsHandler.func1.1(0x9803e0, 0xc0001a4380, 0xc000154b00)
/go/src/github.com/xanderstrike/goplaxt/main.go:135 +0x2f3
net/http.HandlerFunc.ServeHTTP(0xc00040c0f0, 0x9803e0, 0xc0001a4380, 0xc000154b00)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x9803e0, 0xc0001a4380, 0xc000154b00)
/go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc0001ac900, 0x9803e0, 0xc0001a4380, 0xc000154b00)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000960c0, 0x9803e0, 0xc0001a4380, 0xc000154900)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:212 +0xe3
net/http.serverHandler.ServeHTTP(0xc000070b60, 0x9803e0, 0xc0001a4380, 0xc000154900)
/usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc000194820, 0x980ee0, 0xc000348700)
/usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2884 +0x2f4

2020/07/28 20:07:58 Handling auth request for ******

2020/07/28 20:07:59 Got a 401 Unauthorized, full response:
&{401 Unauthorized 401 HTTP/2.0 2 0 map[Cache-Control:[no-store] Cf-Cache-Status:[DYNAMIC] Cf-Railgun:[a71e967b66 99.99 0.007691 0030 57da] Cf-Ray:[5ba13ac138366bc6-SJC] Cf-Request-Id:[0438a30cc600006bc667b8c200000001] Content-Length:[213] Content-Type:[application/json; charset=utf-8] Date:[Tue, 28 Jul 2020 20:07:59 GMT] Expect-Ct:[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"] Pragma:[no-cache] Server:[cloudflare] Set-Cookie:[__cfduid=de35f7dcf30671ee6f3a4b3f8529c85da1595966878; expires=Thu, 27-Aug-20 20:07:58 GMT; path=/; domain=.trakt.tv; HttpOnly; SameSite=Lax _traktsession=TTBTSStjNStCdE1XNkJLUEd2WG5ISnVyZ3pVWi9KclBaMXRmeHlhSjduT0hZa056M29IU3dybmEwRWdlWXhhZUFLRWF6aWRsa1orZGR6aDdzTERtYWc9PS0tVjlxUUNlYkZURGF6ems5MXRCblhZUT09--3badae8bc2a5bcd61211142627fb8cc59521a07e; path=/; HttpOnly] Vary:[Accept-Encoding] Www-Authenticate:[Bearer realm="Doorkeeper", error="invalid_grant", error_description="The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."] X-Content-Type-Options:[nosniff] X-Frame-Options:[SAMEORIGIN] X-Request-Id:[7996aa14-333b-4613-827a-056de5892918] X-Runtime:[0.003729] X-Xss-Protection:[1; mode=block]] {0xc00024a280} 213 [] false false map[] 0xc0001aea00 0xc0000a6370}. Aborting to avoid panic.

2020/07/28 20:07:59 http: panic serving 172.18.0.1:37576: interface conversion: interface {} is nil, not string
goroutine 44 [running]:
net/http.(*conn).serve.func1(0xc000080e60)
/usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x85fb40, 0xc0003da570)
/usr/local/go/src/runtime/panic.go:522 +0x1b5
main.authorize(0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/go/src/github.com/xanderstrike/goplaxt/main.go:57 +0x833
net/http.HandlerFunc.ServeHTTP(0x8fcb80, 0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/usr/local/go/src/net/http/server.go:1995 +0x44
main.allowedHostsHandler.func1.1(0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/go/src/github.com/xanderstrike/goplaxt/main.go:135 +0x2f3
net/http.HandlerFunc.ServeHTTP(0xc000130c60, 0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc0004823e0, 0x9803e0, 0xc00010a0e0, 0xc0001ae900)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000960c0, 0x9803e0, 0xc00010a0e0, 0xc0001ae700)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:212 +0xe3
net/http.serverHandler.ServeHTTP(0xc000070b60, 0x9803e0, 0xc00010a0e0, 0xc0001ae700)
/usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc000080e60, 0x980ee0, 0xc00011e340)
/usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2884 +0x2f4`

Update docker image automatically

Is the image deployed manually? or automatically somewhere?

the official one doesn't seem to have my healthcheck fixes in it so i'm getting 401s

[Feature] Mark as watched in Plex

It would be really nice with an addition to sync the other way as well - to update watched status in Plex from Trakt. I hope you will consider it.

Any plans to make this a 2-way sync?

Im super excited to see a webhook created for scrobbling to Plex, but are there plans for updating plex watched status FROM Trakt?

I've relied on the TraktTV plugin for years to keep my watch status in sync, but that requires a 2-way sync. Lately I've been having problems with the plugin, and found this when looking for alternatives. But without a pull from Trakt function, this is a no go at this time. Is this a planned feature? Is it even possible to implement via webhook?

Thanks!

Docker Compose

Hi, could you please create a docker compose example so I can use with my existing setup. Thank you so much

Finding movies with mismatched release year

Currently, plaxt matches and finds movies based on title & release year. While effective most of the time, sometimes Plex metadata and Trakt release year do not match which results in Plaxt not correctly mapping the correct movie.

For example, the recently released 'A Quiet Place Part II' is listed as a 2020 film in Plex (using new Plex scanner), whereas Trakt lists it as 2021. This results in Plaxt not matching the movie and the scrobbling for that specific movie is never triggered. Could the plugin be updated to match using the imdb or tmdb unique ID's that Plex sends in the Webhook payload, similarly to how it currently handles TV episodes using the new Plex Scanner?

I would try and contribute, but i'm afraid i lack the technical knowledge to do so.

Does this have to be accessible externally?

The HTTP request for the webhook is originated from the Plex server. If you run your plex server in docker and within the same docker network, you don't need to expose plaxt to public at all.

Does that make sense to you? The README may need some update.

Installing on raspberry

Hi, I'm new in docker, I tried to installed in my LOCAL raspberry plex server using this line:

docker create \
  --name=plaxt \
  --restart always \
  -v /home/docker:/app/keystore \
  -e TRAKT_ID=xxxxx\
  -e TRAKT_SECRET=yyyyy\
  -e ALLOWED_HOSTNAMES=192.168.1.130 \
  -p 8000:8000 \
  xanderstrike/goplaxt:latest-arm7

After trying http://192.168.1.130:8000/ I get a 401 error and the message: Oh no!
Any suggestion what i am doing wrong?

EDIT: Ok, i noticed its important to put the protocol and the port, after this finally works!

docker create \
  --name=plaxt \
  --restart always \
  -v /home/docker:/app/keystore \
  -e TRAKT_ID=xxxxx\
  -e TRAKT_SECRET=yyyyy\
  -e ALLOWED_HOSTNAMES=http://192.168.1.130:8000 \
  -p 8000:8000 \
  xanderstrike/goplaxt:latest-arm7

Oh no!

As of yesterday's update, all that I see when I navigate to Plaxt is "Oh no!" and even after removing the container and starting from scratch this error continues.

Oh No! on port 8000

This is my first Docker container, and am struggling to understand what I have done wrong.

I copied the code to get it running, modified all the correct settings, and when I start the container and go to web browser, it loads localhost:8000 and only shows a white page with "Oh No!".

I'm not sure where I am going wrong with it.

Any help would be appreciated!

No longer working

Hi, I see you are no longer working on this project which is a shame. Just thought I would make you aware it has stopped working in the past few days.
Thanks anyway for Plaxt! is has been amazing and I would continue to use it if it was still working.

Cheers

Bad Gateway on Authorisation

Recently set plaxt up and it was working fine for a brief period but then stopped. Tried removing authentication and adding it again but now I am given a bad gateway on being re-directed back from trakt.tv

Can't authorize

Hi, I followed the instructions to host this docker myself and I think I did everything correctly, but now when I try to authorize the url in trakt site or open the linked url in a browser, I just get a simple page that reads "Oh no!"

Should this happen and if not then what might cause this?

Goplaxt down?

<title>502 Bad Gateway</title>

502 Bad Gateway


nginx/1.14.1

Hard Coded client_id

The file static/index.html currently has your client_id hard coded instead of using the one set via the TRAKT_ID env variable which causes this error from Trakt when authorizing from the front-end.

The requested redirect uri is malformed or doesn't match client redirect URI.

Not all shows being Trakt

Hi there,

I've set everything up properly, and all of my shows are showing on Trakt, but some of them are way behind on watch status. For example, with "Arrow", I'm on S4E08, but Trakt shows me at S1E1 (and no episodes after are watch either).

Any ideas what I may have done wrong?

plax not working anymore

plax has stopped working, neither the selfhosted or the version in https://plaxt.astandke.com/ seems to be working anymore .
i do belive this could be an outage of the trak api but it would be good if the app could handle this errors nicely

log in docker
2022/12/18 20:44:02 Got a 503 Service Unavailable error while refreshing :(
2022/12/18 20:44:02 http: panic serving 192.168.1.151:59326: interface conversion: interface {} is nil, not string
goroutine 87 [running]:
net/http.(*conn).serve.func1(0xc000400820)
/usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x864340, 0xc000178bd0)
/usr/local/go/src/runtime/panic.go:522 +0x1b5
main.authorize(0x985ea0, 0xc00034c540, 0xc000100700)
/go/src/github.com/xanderstrike/goplaxt/main.go:58 +0x7fe
net/http.HandlerFunc.ServeHTTP(0x901c20, 0x985ea0, 0xc00034c540, 0xc000100700)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x985ea0, 0xc00034c540, 0xc000100700)
/go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc00047e1e0, 0x985ea0, 0xc00034c540, 0xc000100700)
/usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000bc0c0, 0x985ea0, 0xc00034c540, 0xc000306000)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xe3
net/http.serverHandler.ServeHTTP(0xc000088b60, 0x985ea0, 0xc00034c540, 0xc000306000)
/usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc000400820, 0x9869e0, 0xc000058100)
/usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2884 +0x2f4

Notification

Hi, is it possible to set notification when movie trakt detects that movie watched completely. Thank you

doesnt work

I release that plaxt doesnt update my trakt profile is general problem or just me?

FreeBSD?

I don't know much about using docker but would it be possible to install this on a FreeBSD system like FreeNAS?

Runtime error: json: cannot unmarshal array into Go struct field

Hi,

using self-hosted plaxt on docker and the latest Plex server (Version 1.25.5.5492).

When Plex sends a webhook I get this error:

2022/02/14 18:02:07 http: panic serving 192.168.18.23:57762: json: cannot unmarshal array into Go struct field Metadata.Rating of type float32
goroutine 26 [running]:
net/http.(*conn).serve.func1(0xc0001d2000)
        /usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x856780, 0xc0000bc190)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
main.api(0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /go/src/github.com/xanderstrike/goplaxt/main.go:112 +0xc84
net/http.HandlerFunc.ServeHTTP(0x901c38, 0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc000432160, 0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000ba0c0, 0x985ee0, 0xc00043c1c0, 0xc0000fc400)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xe3
net/http.serverHandler.ServeHTTP(0xc000090b60, 0x985ee0, 0xc00043c1c0, 0xc0000fc400)
        /usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc0001d2000, 0x986a20, 0xc000268480)
        /usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x2f4

Regards,
Michael

Can't authorize app

Plaxt docker runs into kubernetes with traefik as ingress controller. There is a valid Let's Encrypt Certificate for the plext URL.

If I open the web GUI, type in my username and click "authorize" I can click the green button on trakt and come back to my URL but just with the "Bad gateway" message.
URL shows like this:

https://plaxt.mydomain.com/authorize?username=plexusername&code=274a36081ea55442e478f0069aff301b003872e67d6b4d0a****************

The log output from the container looks like this:

2018/12/19 06:45:31 Started!
2018/12/19 06:45:57 Handling auth request for plexusername
2018/12/19 06:45:57 Got a 401 Unauthorized, full response:
&{401 Unauthorized 401 HTTP/2.0 2 0 map[Cache-Control:[no-store] X-Content-Type-Options:[nosniff] X-Request-Id:[ef589e09-ef1a-488d-b51b-6031045*****] Expect-Ct:[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"] Content-Length:[213] X-Runtime:[0.005318] X-Xss-Protection:[1; mode=block] Date:[Wed, 19 Dec 2018 06:45:57 GMT] Pragma:[no-cache] Vary:[Accept-Encoding] Server:[cloudflare] Cf-Ray:[48b7e8ca2d8096b8-FRA] Content-Type:[application/json; charset=utf-8] Set-Cookie:[__cfduid=d0a10557c7757681cb531a5caa6c9471e1545******; expires=Thu, 19-Dec-19 06:45:57 GMT; path=/; domain=.trakt.tv; HttpOnly _traktsession=L2U3NU9uYTNFUFVPSkpjTnR1UVdjTVlqYUNoR2V0OGNmREFQckhNL3lPWnNDTE1XQ28xZHJzMzc1OVg4cGphcGRvcDc1SGNtRDJFb1BSUitlYWJzQnc9PS0tRmcrUFROb2MzMk5Fa21IL1VTN2I4dz09--47d916a3c67e5b6b279199c7fcf9fb5886******; path=/; HttpOnly] Cf-Railgun:[7798046614 1.87 0.012597 0030 57da] Www-Authenticate:[Bearer realm="Doorkeeper", error="invalid_grant", error_description="The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."] X-Frame-Options:[SAMEORIGIN]] {0xc4201e0280} 213 [] false false map[] 0xc420168500 0xc4200f6370}
2018/12/19 06:45:57 http: panic serving 10.32.0.1:43042: interface conversion: interface {} is nil, not string
goroutine 43 [running]:
net/http.(*conn).serve.func1(0xc420316d20)
        /usr/local/go/src/net/http/server.go:1726 +0xd0
panic(0x762460, 0xc42034e0c0)
        /usr/local/go/src/runtime/panic.go:502 +0x229
main.authorize(0x8108e0, 0xc420444000, 0xc420168300)
        /go/src/github.com/xanderstrike/goplaxt/main.go:33 +0x789
net/http.HandlerFunc.ServeHTTP(0x7e1350, 0x8108e0, 0xc420444000, 0xc420168300)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/xanderstrike/goplaxt/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc4200d80c0, 0x8108e0, 0xc420444000, 0xc420168300)
        /go/src/github.com/xanderstrike/goplaxt/vendor/github.com/gorilla/mux/mux.go:215 +0xed
net/http.serverHandler.ServeHTTP(0xc42009b2b0, 0x8108e0, 0xc420444000, 0xc420168000)
        /usr/local/go/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc420316d20, 0x810be0, 0xc42015c2c0)
        /usr/local/go/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2795 +0x27b

Any ideas what is wrong here?


Update: Please close this :) I'm sorry. Just have to put the /authorize out of the env. Sometimes it helps when I read the stuff again... Important: on trakt use "redirect uri with /authorize" in ENV var without!

Lack of feature info(1 way sync, or 2 way?)

Incredibly cool project, however i wasnt able to gather from the readme the extend of your project.

Are we only syncing watch states from plex -> trakt? Is it possible in the future, or is it already possible now, to pull data in the opposite way? Lets say a reinstall of plex, and i want my trakt history synced to plex.

runtime error: index out of range

Hi, I am getting this error only with Series with the new agent Plex TV Series

2021/04/29 02:40:05 Webhook call for df7b47b066922fabdacace9d920e50ee
2021/04/29 02:40:05 http: panic serving 192.168.1.4:57940: runtime error: index out of range
goroutine 110 [running]:
net/http.(*conn).serve.func1(0x28a66c0)
        /usr/local/go/src/net/http/server.go:1769 +0xf0
panic(0x3eb3b0, 0x7ab7d8)
        /usr/local/go/src/runtime/panic.go:522 +0x1a0
github.com/xanderstrike/goplaxt/lib/trakt.findEpisode(0x291c240, 0xa, 0x101, 0x1, 0x28b85c0, 0x3a, 0x291c108, 0x8, 0x291c2cc, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:85 +0x594
github.com/xanderstrike/goplaxt/lib/trakt.HandleShow(0x291c240, 0xa, 0x101, 0x1, 0x28b85c0, 0x3a, 0x291c108, 0x8, 0x291c2cc, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:59 +0x74
github.com/xanderstrike/goplaxt/lib/trakt.Handle(0x291c240, 0xa, 0x101, 0x1, 0x28b85c0, 0x3a, 0x291c108, 0x8, 0x291c2cc, 0x4, ...)
        /go/src/github.com/xanderstrike/goplaxt/lib/trakt/main.go:47 +0x118
main.api(0x4da560, 0x28801b0, 0x28aa380)
        /go/src/github.com/xanderstrike/goplaxt/main.go:104 +0x598
net/http.HandlerFunc.ServeHTTP(0x45bb98, 0x4da560, 0x28801b0, 0x28aa380)
        /usr/local/go/src/net/http/server.go:1995 +0x34
main.allowedHostsHandler.func1.1(0x4da560, 0x28801b0, 0x28aa380)
        /go/src/github.com/xanderstrike/goplaxt/main.go:135 +0x26c
net/http.HandlerFunc.ServeHTTP(0x2920220, 0x4da560, 0x28801b0, 0x28aa380)
        /usr/local/go/src/net/http/server.go:1995 +0x34
github.com/gorilla/handlers.ProxyHeaders.func1(0x4da560, 0x28801b0, 0x28aa380)
        /go/pkg/mod/github.com/gorilla/[email protected]/proxy_headers.go:59 +0xf0
net/http.HandlerFunc.ServeHTTP(0x2924030, 0x4da560, 0x28801b0, 0x28aa380)
        /usr/local/go/src/net/http/server.go:1995 +0x34
github.com/gorilla/mux.(*Router).ServeHTTP(0x28a67e0, 0x4da560, 0x28801b0, 0x28aa000)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xb0
net/http.serverHandler.ServeHTTP(0x28aa280, 0x4da560, 0x28801b0, 0x28aa000)
        /usr/local/go/src/net/http/server.go:2774 +0x88
net/http.(*conn).serve(0x28a66c0, 0x4dac20, 0x2920040)
        /usr/local/go/src/net/http/server.go:1878 +0x7e4
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x298

I am using the last version of Plaxt

Not scrobbling

Just tried to set this up and it seems to be running. I am able to authenticate without issue. However I am not seeing any scrobbling occurring. How often does the webhook gets triggered ? In the logs i just see it up to the Authorized as message but then nothing else. Any plex logs I can look at ?

Add Scrobbling for Home Users

It looks like that Plaxr will only scrobble for the main account user, but any other home users made from the main account will not be tracked and scrobbled. Could we please get support for this?

Add partial Hama.bundle agent support

I'm using the Hama agent for Anime which allows you to either fetch the metadata from TVDB or AniDB.

The GUIDs in TVDB mode look like this: com.plexapp.agents.hama://tvdb-377543/1/1?lang=en
The AniDB GUIDs look like this: com.plexapp.agents.hama://anidb-15772/1/1?lang=en.

I would propose a really simple solution which just looks for com.plexapp.agents.hama://tvdb and then treats it the same as TVDB GUIDs.

I could probably submit a PR for this topic.

hello question

Hello thanks for ur work.. i tried to setup my own server of plaxt i do the steps and i make trakt app with all the info.. how i can setup the website to make people type their username and get the link?

i saw the index.html on static folder but when i put my username and tried to authorize says " oops..

something i do wrong about setting the page.. i think trakt app and ip and setting is ok..

thanks..

Managed users

Hi, not an Issue as such but more of an FYI. I saw in your Readme you said you would no longer be working on this because Plex supports webhooks. Plex does but only for the primary user, ie the admin. My admin user has a PIN and is never used to watch stuff. I have a managed user called Watch that is used by everyone in my house to watch stuff. The Plex Webhook for Trakt does not support this so it is no use to me so just wanted to mention that 3rd part apps are still needed. Thanks for all your work.

Not working anymore

Hello,

It seems your hosted version is not working anymore.

Scrobbles are not showing up in my Trakt any more.

And when I tried creating new links the site doesnt work, jQuery is not loading:
image

Bad Gateway on Authorisation

This previously closed error has returned. Plex isn't scrobbling. The public Plaxt tool returns a "502 Bad Gateway" error.

Remove dependency on gorilla

It looks like the dependency on gorilla is not necessary, since there's only handful of handlers.

If you are OK with it I can send a PR to remove the dependency.

Add option to load secrets from file

I'd like to use Docker secrets to manage my Trakt API app's ID and secret because I keep my docker-compose.yml file checked into git and obviously don't want to commit those secrets 😄

Would be great if goplaxt could offer a way to load these from file, e.g. by allowing to use alternative TRAKT_ID_FILE and TRAKT_SECRET_FILE env vars that contain the path to the file containing the secret.

Webhook: Error delivering payload to http://plaxt.domain.com:8000/api?id=16c7ffa9262738e8d23657c33c37f603: 408

Using the docker image. I set it up and was able to authorize successfully. When I start playing something in and watch the console I see the error...

Webhook: Error delivering payload to http://plaxt.domain.com:8000/api?id=16c7ffa9262738e8d23657c33c37f603: 408

I dont know what that means but if I paste the same URL into a browser I get this...

This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 405

Removing everthing after the port gives me the authorize page

Send “Collected” info with Play

Trakt has an option to mark a movie as part of your personal collection, as opposed to just having seen it somewhere. Presumably so people can keep track of what they own and what they still want to pick up.

Infuse for Apple TV seems to mark some collected TV episodes, but not movies. I’m not looking for anything retroactive, but if it’s possuble to send “collected” along with a play it would be handy.

Scrobbling for other users on server

Hello all. Was wondering if anyone had experience in doing this.

I have Plex PlexPass and Trakt VIP accounts but I have 1 user on my server that doesn't have either. I would like to scrobble her views from my server to her Trakt account. Is that even possible?

And if yes, do I have her Trakt oauth on the plaxt page and then have her send me the webhook URL to add to my /settings/webhooks since she won't have the option as a non-plexpass user?

Thanks for any advice on how it is suppose to work.

Great app if I can understand on how it is supposed to work :-)

Oauth error

Hi!

I was just testing Plaxt and I face a problem when self-hosting.

With the instance provided, I am able to authorize Trakt and proceed to register the Webhook in Plex and scrobble. Everything runs smoothly.

However, when I try to go self-hosted I face a problem with Oauth. The steps I have followed are:

  • Deploy Plaxt in Docker following the instructions (avoiding passing the ALLOWED_HOSTNAMES option as suggested in another issue to avoid the "oh no" issue when accessing the authorize page.
  • On that container I can access the authorization page. However, when I hit the Authorize button that sends me to Trakt I get the following error:

The requested redirect uri is malformed or doesn't match client redirect URI.

  • The URL that is being generated is:

https://trakt.tv/oauth/authorize?client_id=MYID&redirect_uri=http://192.168.2.100:8000/authorize%3fusername=MYUSER&response_type=code

  • MYUSER is a managed user, btw.
  • Log does not seem to contain nothing relevant: just the boot messages.

Am I missing something? Thanks for the help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.