ShokoAnime / ShokoServer

Repository for Shoko Server.
https://shokoanime.com/
MIT License
413 stars 74 forks source link

Group Filter Rewrite #1020

Closed da3dsoul closed 1 year ago

da3dsoul commented 2 years ago

Modular Filters will operate as independent modules. The calculation of filters will be expression based. For example, you can have Or(And(not porn, missing tvdb link), And(is movie, missing moviedb link). The visualization of that will likely be a block programming style of chart. The filter will only be updated when a type of data that is relevant is changed. The filter class should report what it is listening to. It should also report if it is user-dependent. Continue Watching is very dependent on user, while Missing Episodes is not at all related. This can save on storage and compute.

da3dsoul commented 2 years ago

Words aren't flowing right now, but I want planning for this put down while I'm looking at it and thinking about it.

revam commented 2 years ago

Will your words flow better today maybe? @da3dsoul

da3dsoul commented 1 year ago
Filter
  FilterID int
  UserID int
  Name string
  ParentFilterID int -> Filter.FilterID
  Locked bool
  ApplyAtSeriesLevel bool

FilterCondition
  FilterConditionID int
  FilterID int -> Filter.FilterID
  Type string

FilterConditionParameter
  FilterConditionParameterID int
  FilterConditionID int -> FilterCondition.FilterConditionID
  Type string
  Index int
  StringParameter string
  IntParameter int
  LongParameter long
  DateParameter datetime
  Unique index on (FilterConditionID, Index)

FilterSortCondition
  FilterSortConditionID int
  FilterID int -> Filter.FilterID
  Type string
  Parameter string (not sure what might need it)
  Descending bool

That's what I'm thinking for database layout. Parameters I'm not sure on. I know EF can be made to handle things like that, where it'll switch on Type and give 'Parameter' as whatever type is relevant. I think it's called TPH, but IDR off the top of my head. Filters will be per User. Adding them can be done for all users if the user is an admin. That'll make caching easier if we want to do that. Ideally, we'll set up some stats tables that are more intelligent for database calls. This is up for discussion or modification.