dylandoamaral / trakt-integration

A Trakt integration for Home Assistant compatible with upcoming media card
MIT License
30 stars 12 forks source link

[req]Up next to watch #21

Closed Robbot closed 1 year ago

Robbot commented 2 years ago

Any chance to add trakt’s " Up next to watch" to this integration?

dylandoamaral commented 2 years ago

I think it is, I am not sure how they implement that features but I guess they use: https://trakt.docs.apiary.io/#reference/shows/collection-progress/get-show-collection-progress

dylandoamaral commented 2 years ago

Sorry I didn't see your message earlier :/

SBerg1980 commented 2 years ago

Yes thats a nice feature i want that also.

Mucka911 commented 2 years ago

Another request for this :) would be awesome.

dylandoamaral commented 2 years ago

(Correcte me if I am wrong) The problem is that the feature is not built in on trakt. I will try to reproduce it using a best effort approach but I am not sure the algorithm behind it since I don't use it myself. Can you tell me exactly what up to next gives you ?

Robbot commented 2 years ago

Sorry for confusing you. The feature which I thought about is just the "Progress". You can find it here https://trakt.tv/users/{your_username}/progress

SBerg1980 commented 2 years ago

https://trakt.tv/users/username/progress/watched/activity?hide_completed=true

dylandoamaral commented 2 years ago

Interesting, I didn't find it on Apiary: https://trakt.docs.apiary.io/#reference/users/. Thank you for the route I will check this ASAP.

SBerg1980 commented 2 years ago

I think you have to look at this: https://trakt.docs.apiary.io/#reference/shows/watched-progress/get-show-watched-progress

dylandoamaral commented 2 years ago

The issue is that I have to give a show id but which show should I select with this route ?

SBerg1980 commented 2 years ago

Maybe you can create a list with Get Watchlist

Anrolosia commented 1 year ago

Hey there! Any update on this request? I'd love to display that in my homeassistant dashboard. I took a look at @SBerg1980 suggestion, and indeed, get watchlist, iterate on each shows to use the id and get the "next_episode" would be the best approach :) Thanks a lot for your work!

dylandoamaral commented 1 year ago

According to https://trakt.docs.apiary.io/#reference/lists/list-items/get-items-on-a-list, I still don't know how to get watchlist :/.

SBerg1980 commented 1 year ago

With this api: https://api.trakt.tv/lists/*****/items/show U have to use your Client ID:

And on you have to fill in your list id you have to make your list public, you can find it when you share the list en copy the link: example: https://trakt.tv/lists/

Anrolosia commented 1 year ago

So, if I understand correctly, the idea will be to use: https://trakt.docs.apiary.io/#reference/sync/get-watchlist/get-watchlist (a GET on https://api.trakt.tv/sync/watchlist/shows) then iterate on each shows and use the trakt id to call https://trakt.docs.apiary.io/#reference/shows/watched-progress/get-show-watched-progress (https://api.trakt.tv/shows/<the id from the loop>/progress/watched), you should have access to next_episode and integrate that with your current code Is it helpful?

Anrolosia commented 1 year ago

@dylandoamaral I've a branch ready for you to test, and improve, because I can't figure out why I can't have "past" episodes showing up in the upcoming-media-card BUT I'm able to retrieve the collection progress. I don't have permission to push that branch, could you help on that?

dylandoamaral commented 1 year ago

You have to fork this project and create a pull request. I am sorry I am a bit busy these days.

Anrolosia commented 1 year ago

@dylandoamaral ok, perfect! In the meantime I managed to make it work perfectly, so I'll try to do the fork and the pr later today or tonight. Hopefully it will also work on your side ^^

dylandoamaral commented 1 year ago

As soon as you add the PR I will try my best to review it and test it as fast as possible. Thank you for your contribution !

SBerg1980 commented 1 year ago

Thanks in advanced that sounds good.

SBerg1980 commented 1 year ago

@Anrolosia how can i test your fork, i have downloaded it and put it on my home assistant, do i have to make a change in my configuration.yaml

Anrolosia commented 1 year ago

@SBerg1980 with the latest commit, just add a new sensor "next_to_watch" in your configuration.yaml file

trakt_tv:
  language: fr # Prefered language for movie/show title
  timezone: America/Montreal
  sensors:
    next_to_watch:
      show:
        max_medias: 40
SBerg1980 commented 1 year ago

trakt_tv: language: fr # Prefered language for movie/show title timezone: America/Montreal sensors: next_to_watch: show: max_medias: 40

Thanks i will give it a try And it works you are amazing

Anrolosia commented 1 year ago

Morning @dylandoamaral and @SBerg1980 , I pushed a new commit to give user ability to filter out some shows (old tv show, never finished, etc.) by adding a new key (exclude) in configuration.yml. This key will contain an array of slugs from trakt.tv website. Let me know if you think it could be helpful :)

trakt_tv:
  language: fr # Prefered language for movie/show title
  timezone: America/Montreal
  sensors:
    next_to_watch:
      show:
        max_medias: 40
        exclude:
          - veep
          - the-original
          - the-real-l-word
SBerg1980 commented 1 year ago

That's a good addition. I'm curious when @dylandoamaral updates his Github I have it installed from yours now.

dylandoamaral commented 1 year ago

For the key exclude, the issue is for the user to know what exactly they have to put for a particular show.

Anrolosia commented 1 year ago

For the key exclude, the issue is for the user to know what exactly they have to put for a particular show.

I went with the simplest way => go on trakt.tv, search for a show, clic on it, notice the url slug, copy/paste it. So, if I want to hide "Friends", I'll do the steps mentioned above, then land on https://trakt.tv/shows/friends, I'll just have to copy/paste the last part, friends, that's it

dylandoamaral commented 1 year ago

I know I ask you a lot but can you also update the README in your PR and add this tips to retrieve the slug ?

Anrolosia commented 1 year ago

I know I ask you a lot but can you also update the README in your PR and add this tips to retrieve the slug ?

Will do!

Anrolosia commented 1 year ago

I pushed a commit to fix your comments @dylandoamaral and add info to the README file, let me know if it's ok

dylandoamaral commented 1 year ago

Thank again @Anrolosia, the version 0.5.0 close the issue.

Anrolosia commented 1 year ago

Anytime, it was a pleasure to help (it was actually my first contribution to a HA plugin ^^) Continue your hard work and thanks again for this awesome plugin!

SBerg1980 commented 1 year ago

Thanks for the great work.

GegoSK commented 1 year ago

@dylandoamaral - thank you for this awesome update! It is very useful for me.

One suggestion. I am not sure if I should open new topic. Is it possible to include only already aired episodes? Or otherwise, to exclude future airdates. No need to have future premieres in next_to_watch. I think, for that there is sensor upcoming premieres. Thank you!

Anrolosia commented 1 year ago

If @dylandoamaral is ok with me doing it, I could try to do it tomorrow and submit a PR for him to review. Cheers,

dylandoamaral commented 1 year ago

Yes you can do it if you want !

GegoSK commented 1 year ago

@Anrolosia As you see, I did not read whole discussion properly. Also thank you very much!

dylandoamaral commented 1 year ago

Maybe we should add an option because I guess some people also want future aired date ?

Anrolosia commented 1 year ago

Hey! A new sensor you mean? Because I already did the option yesterday (you've an open PR). I added an option only_aired which is a boolean

Anrolosia commented 1 year ago

Hey @dylandoamaral , just check in here, is there any issue with the PR? Thanks

dylandoamaral commented 1 year ago

No I am sorry I just didn't see the PR, it is merged thank you !