butterproject / butter-desktop

All the free parts of Popcorn Time
http://butterproject.org/
GNU Affero General Public License v3.0
4.29k stars 1.09k forks source link

How does search work? #404

Closed amilajack closed 8 years ago

amilajack commented 8 years ago

How does the search functionality work? I've gone to trakt.tv and when I search there, it gives me a very different list of movies than the butter desktop app does. Also when I use the trakt.search() method from the node trakt.tv api, I get the same results that I got from trakt.tv.

Basically, the search results for the PCT desktop app are different from the search results of trakt.tv or the trakt.tv node api

streger commented 8 years ago

This is Butter, please put all your PCT questions on their Issues list (you can find them on GitHub). They have forked our project and they use it for totally different thing than Butter Project idea is.

Anyway, trakt.tv and internal app search have nothing in common since they both depend on totally different APIs (databases) that most definitely aren't 100% (not even close) exact.

amilajack commented 8 years ago

I see. How can I access the database that the internal app search uses?

streger commented 8 years ago

Depends on what access do you mean. To get better understanding of how Butter works you can go through our short docs(wikis) and even better go deep in code.

amilajack commented 8 years ago

By search I mean the functionality for when you click the search bar:

screen shot 2016-05-28 at 6 08 37 pm

I've tried digging into the source and all I seem to have come across is the trakt.tv provider.

streger commented 8 years ago

Well, this is a bigger discussion for some other than me, but let me try to keep it simple. When you do search in app, first it depends where are you searching in (...any provider like our copyright free indie section). When there and you type your search input you're actually searching online database that will return you through the that section API a list of results that configurally give you those results.

Aside from that (that has nothing to do with that) there is internal local app (on your pc) database that takes care of favorites, watched items (even if not connected to trakt.tv), your settings and similar stuff.

That why you haven't come across most other databases. Because, you're actually when searching any time requesting online search results from some servers that don't depend directly on Butter but are just available for Butter in nice interface to keep those results for our liking.

amilajack commented 8 years ago

Sorry for not clarifying. I meant to ask the question with respect to only the movies section (instead of shows, indie, etc).

I think I understand to some extend. So butter-desktop is actually searching "some servers that don't depend directly on Butter". I'm assuming that this includes other providers other than trakt.tv. What are the servers that butter-desktop uses to search? Also, is it possible if I can query them myself so that I can contribute to the project. Thanks!

streger commented 8 years ago

This is why I was speaking only generally about it. Butter doesn't have Movies section. You should've stick to my first answer here. Again...find PCT GitHub (https://github.com/popcorn-official/) and ask them about it (or go through their code and find what servers they depend on and query 'em how ever you feel like).

amilajack commented 8 years ago

Thanks for the help. And another question: do you know why the butter forum is down? I've been checking periodically for the last few weeks and it hasn't been up.

streger commented 8 years ago

You'll have news about forum soon. I'm currently on it (news) :(

z11h commented 8 years ago

CC @xaiki @vankasteelj

vankasteelj commented 8 years ago

The search is depending on what is called a "content provider", for example in Butter, the providers are (among other) Vodo, Youtube, CCC and Internet Archive. They are 3rd-party databases sending content for the app. Trakt is a metadata provider, it doesn't give any content except the per-user data, some posters, synopsises, etc. but no video (sometimes a trailer link though).

When you search, what it does is basically contacting the 3rd party database, asking "hey I'm looking for searchterms", and that database answers with a list of results. The app itself doesn't have any content, it's all about gathering video content from external sources, mix it with metadata from other external sources, display it nicely, and play the video content when the user asks to.

By default (idk if pct kepts things that way), when you hover with your mouse the tab name (here you said: "movies"), it should display the content provider name(s). That's where the search will go ask.

Trakt is everywhere because its deeply intergrated within the application, and it's used for 2 things: grabbing metadata, but also keeping the users watchlist synced with their trakt account.

xaiki commented 8 years ago

tecnically search calls into fetch https://github.com/butterproviders/butter-provider#fetch-object-filters---promise-object in all providers for that tab with a keyword argument.