jaruba / multipass-torrent

Collects information about torrents from various sources (dump, RSS, HTML pages) and associates the video files within with IMDB ID - stores data in a distributed DB
MIT License
80 stars 18 forks source link

Preference system similar to Stremio's in lib/db #7

Open Ivshti opened 9 years ago

Ivshti commented 9 years ago

It would work like

db.findOne({  imdb_id: ...},[
   { tag: "hd", min_avail: 2 } // prefer HD torrents if they have at least 2 availability
], function(err, torrent) { /* receive torrent */ })

It must be default behaviour to prefer 720p and 1080p torrents if their availability is at least 2

Ivshti commented 9 years ago

@jaruba and @sammuel86 - thoughts?

jaruba commented 9 years ago

looks cool, but what if there is no quality tag for the torrents? will all of them simply be discarded with this query?

jaruba commented 9 years ago

oh, i just realized it was a dumb question. :)

Ivshti commented 9 years ago

LEt's still answer it - most torrents will be quality tagged, but those which aren't, simply won't be regarded as "preferred" but would still get selected if no preferred torrent is found.

jaruba commented 9 years ago

obviously.. :8ball:

jaruba commented 9 years ago

I'm thinking that it would be awesome if quality-grouping was applied to the results of .db.find().

Ivshti commented 9 years ago

IMO this should be a separate function. Most of the code to do this stuff is the stremio add-on in the repo, using output from db.lookup + db.get (essentially a db.find, but without getting all torrents at once), getting the picked file (the file in the torrent which corresponds to the query) and deciding if it contains a preferred tag (such as hd) in the .tag array.

Let's summarize how we imagine this and merge with the simplify API issue and roll out the events API and this at the same time as 0.2 release?

IMO if we have db.findOne(query, preferred), grouping by quali won't be necessary

Ivshti commented 9 years ago

Actually this is implemented in the addon