wafflesfm / batter

It makes Waffles.
Other
84 stars 17 forks source link

Torrent data constraint validation #2

Open edgewyn opened 11 years ago

edgewyn commented 11 years ago

We need an extensible validation system for torrent data constraints that allows administrators of Batter installations to declaratively express what uploads should and should not be allowed on their site.

For example, a hypothetical Music data constraint could require that all torrents be multi-file torrents. It could further require that if format is "flac", all files should end in ".flac" or be an album art file . It should NOT require that (e.g.) the album release year must be correct, because that is validating metadata.

As a general rule, the torrent data constraint validation should only operate on data encoded within the torrent, or collected about that data. This includes all information in the Torrent File Structure specification, as well as information collected about the files (e.g., bitrate, format, ripping program, originating media, etc).

Ell commented 11 years ago

I'd almost say this should be done on a per application basis. Each application (upload category?) should implement its own upload form/validation for torrent files and such

derekleverenz commented 11 years ago

I'm going to give this a go. I've made a basic sort of similiar rules thing before in django, just using the django-admin to set rules. I'm thinking ill do that for this as well, at least for a first pass.

If anyone has any ideas/suggestions about how to implement this let me know as well.

derekleverenz commented 11 years ago

Started work on this, what I am currently making would allow custom rules that would apply to Models (content types). The format would be a precondition (eg, if [field_name_on_model] [equalt, gt, lt, maybe other options?]) and a post condition ([field] [equals, lt, gt, etc] [other value]). if necessary it should be extensible so that rules could apply to multiple content types or there could be multiple pre/post conditions (that are joined by AND or OR). In the first pass I'm not going to add that though.

Does that seem reasonable?