sbondCo / Watcharr

Open source, self-hostable watched list for all your content (movies, tv series, anime, games) with user authentication, modern and clean UI and a very simple setup.
https://watcharr.app
MIT License
433 stars 21 forks source link

Wish: kodi plugin #450

Open airdogvan opened 6 months ago

airdogvan commented 6 months ago

Maybe i could look into writing this myself. After watching a movie or episode send update to watcharr.

But apart from that great idea and works very well for me.

Thank you!

IRHM commented 6 months ago

Hi, thanks for opening this issue @airdogvan!

I've never used Kodi before, so your guidance on how it should work would be much appreciated.

I suppose the plugin would be downloaded in Kodi by the user, then they would authenticate against Watcharr and the plugin can scrobble watched content automatically?

Do you think auth should be handled via api keys the user can generate in Watcharr: #360 (if you do look into writing this plugin, you could manually grab your real auth token for now, then we could swap it over to use api keys later when implemented if you think that's suitable) - only problem I see is they could be a pain to type out on a TV (not sure if there's an easy way to get around that).

airdogvan commented 6 months ago

Although I did use Kodi several times a week I've never had the need to write a plugin.

But I do know how to write code and can certainly look into it.

Yes api would be the way to go (wasn't sure if Watcharr did provide one.

For testing purposes the key would be fine but that wouldn't work for real user auth, as you rightly mentioned, a pain to type with a remote.

Could use a method similar to debrid, they display a 6 or 8 digit number that you need to enter in a field below and if they both match the user is authenticated.  So maybe Watcharr could generate an API key and write that to the user's profile if authenticated correctly on screen.

Give me a day or 2 to look into this and I'll get back to you.

As for watched content (history) this is going to be dicey as each plugin in Kodi handles that differently.  Usually the approach (forgot the name of the other service that already does this) is to grab watched data starting from the first usage.

Again let me look into this.

Mar 29, 2024 22:13:56 Mr 'notifications at github.com' @.***>:

This email was sent to @. from @. Click here[https://app.addy.io/deactivate/022cc3db-6fd8-4177-8ee9-e7c2e50b7a0f?signature=c71858ffacf8d3e9be43c2aa0cb6d980030174651ae2fda2b9e769c21abf2a88] to deactivate this alias

Hi, thanks for opening this issue @airdogvan[https://github.com/airdogvan]!

I've never used Kodi before, so your guidance on how it should work would be much appreciated.

I suppose the plugin would be downloaded in Kodi by the user, then they would authenticate against Watcharr and the plugin can scrobble watched content automatically?

Do you think auth should be handled via api keys the user can generate in Watcharr: #360[https://github.com/sbondCo/Watcharr/issues/360] (if you do look into writing this plugin, you could manually grab your real auth token for now, then we could swap it over to use api keys later when implemented if you think that's suitable) - only problem I see is they could be a pain to type out on a TV (not sure if there's an easy way to get around that).

— Reply to this email directly, view it on GitHub[https://github.com/sbondCo/Watcharr/issues/450#issuecomment-2027920320], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AHRKLJ3IWEK6LB3QIXFT2F3Y2ZCYVAVCNFSM6AAAAABFPEYIQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHEZDAMZSGA]. You are receiving this because you were mentioned. [Tracking image][https://github.com/notifications/beacon/AHRKLJ6LPVCUL5PMVOAXVOLY2ZCYVA5CNFSM6AAAAABFPEYIQKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTY36N4A.gif]

IRHM commented 6 months ago

That's great @airdogvan, thank you for taking the time.

If you are able to get the base functionality (scrobbling) working, I can look into how we could handle the auth a little easier (the token thing you mention sounds good, the user could probably create a one time small token to grant access to the kodi plugin).

For the watched content, is that referring to syncing watched history from kodi to Watcharr?

Not sure where the best place to put it would be, I think you could make a plugins/kodi folder in the main repo?

Thanks again! Let me know if you run into any problems.

airdogvan commented 6 months ago

@ IRHM I've found an addon that already does the heavy lifting script.myepisodes and am seriously thinking of using that as a solid base.

Authentication could be done easily in the settings once the user has generated her/his API key.

Tell you the truth, until some form of API implemented not much I can do for the moment. I'll use the time getting familiar with the existing code and wait for further progress. Unless of course you have other suggestions.

IRHM commented 6 months ago

Sounds good @airdogvan, will hopefully get api keys fully done at some point.

As long as the kodi plugin can get a TMDB content id, then it should work to add content against the current Watcharr api by making a post request to /api/watched (routes.go:352).

Hopefully Kodi is able to give us the TMDB id, otherwise we may need to make other changes to support whatever ids it does have.

airdogvan commented 6 months ago

cannot give you a 100% guarantee but Kodi's been around for a while so I would be very surprised that it doesn't handle TMDB.

hernandito commented 5 months ago

+1 request for Kodi support. I would love to ditch Trakr..... I hate that my library is out there for everyone to see.

Kodi does have a comprehensive API... I would imagine one can get list of watched items.

airdogvan commented 5 months ago

Yes but I have discovered that writing for Kodi is something of an extreme sport, blindfolded and with your hands tied behind your back.

Debugging is reduced to its very minimal, documentation almost non existant.

Working hard on it and hope to come up with results soon.

@IRHM do i need to pass the TMBD info to your API?  As Watcharr is going to have to check if show or movie already in your db.

Wouldn't the title, season and episode be enough?

Or I could get you the TMBD ID and pass that to Watcharr.

Apr 11, 2024 05:40:35 hernandito 'notifications at github.com' @.***>:

This email was sent to @. from @. Click here[https://app.addy.io/deactivate/022cc3db-6fd8-4177-8ee9-e7c2e50b7a0f?signature=c71858ffacf8d3e9be43c2aa0cb6d980030174651ae2fda2b9e769c21abf2a88] to deactivate this alias

+1 request for Kodi support. I would love to ditch Trakr..... I hate that my library is out there for everyone to see.

Kodi does have a comprehensive API... I would imagine one can get list of watched items.

— Reply to this email directly, view it on GitHub[https://github.com/sbondCo/Watcharr/issues/450#issuecomment-2049606870], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AHRKLJYYVLW67A5SGUMTUN3Y42ADRAVCNFSM6AAAAABFPEYIQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBZGYYDMOBXGA]. You are receiving this because you were mentioned. [Tracking image][https://github.com/notifications/beacon/AHRKLJ2BPUMCW2ZZTZNMLQTY42ADRA5CNFSM6AAAAABFPEYIQKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT2FKCNM.gif]

IRHM commented 5 months ago

Hey @airdogvan, yep just the TMDB ID and content type should be good enough.

You can make a POST request to /api/watched with a body following this schema:

I've simplified a struct from the code to make it easier to quickly reference:

type WatchedAddRequest struct {
    status?: WatchedStatus;
    rating?: int8;
    thoughts?: string;
    contentId: int;
    contentType: "movie" | "tv";
    // Pass a watched date and we will set the CreatedAt (and initial UpdatedAt)
    // properties for this watched entry to this specific date.
    watchedDate?: time.Time;
}

The contentId must be set to a tmdbId and the contentType must be set to movie or tv. All the other parameters or optional.

An example of adding a tv show (Upright) as watched could look like this (request body):

{"contentId":95913,"contentType":"tv","status":"FINISHED"}

I should probably look into generating api docs to help out with anyone needing anything like this. For now, you can half reverse engineer by performing an action in the browser, then looking in your dev tools network tab and seeing what requests it made to the server (or feel free to ask me here, I don't mind helping out!).

Thanks! Let me know if you need anything else!

IRHM commented 5 months ago

Hey @airdogvan, I don't have telegram, but we do have a public matrix server (https://matrix.to/#/#watcharr:matrix.org) we could talk in or you can pm me: @irhm:matrix.org

airdogvan commented 5 months ago

sent you a DM but says profile doesn't exist...

IRHM commented 5 months ago

sent you a DM but says profile doesn't exist...

My username might have to be all lowercase, github looks to have uppercased it to @ this gh account.

You can join the Watcharr matrix space if that doesnt work and ping me from there.

IRHM commented 3 months ago

Thanks to @airdogvan we now have a kodi plugin in beta: https://github.com/airdogvan/watcharr_kodi

You can download the first beta version from the release: https://github.com/airdogvan/watcharr_kodi/releases/tag/beta (direct download).

I personally don't use kodi so my feedback probably doesn't matter, but if anyone tries this out please tell us about your experience! I'm sure @airdogvan would be happy to hear what you have to say!