Rework media grouping
Some of our users want to be able to do more with groups than just an automated grouping based on the name.
We'll need to be able to rename groups, add & remove media from those groups, and have sub groups.
A single media can only be in one group. Since we insert media in an automatically created group based on their names, a media will always be part of one group, or no group. This can allow us not to have a linking table.
We need to be able to return the number of media, and specifically audio or video media as well.
We do not want to monitor media title changes. Once a media is inserted into a group, it won't be moved automatically.
If a group gets renamed, its new name (or rather, its first Nth characters) becomes the considered pattern for later insertion.
Basically, the only thing that is done automatically is the creation of new groups when inserting a media, if there is no matching group yet. If anything gets renamed, moved, it won't be propagated to the existing groups.
-
Add a new MediaGroup table (id, name, nb_video, nd_audio) at least -
Add subgroup support in a 2nd step? -
Add an FTS table to search the groups, and the usual associated triggers -
Update the Media table to have a group_id
foreign key & index that foreign key -
Provide group functions to add/remove a media from it -
Add triggers to automatically update nbVideo/nbAudio -
Provide onGroup(Created|Modified|Deleted) callbacks -
Add a Group accessor from media ( IMedia::group()
) -
Add a default automatic grouping based on the title -
Add a full "path" getter for subgroups -
Allow a group to be renamed -
Drop previous VideoGroup feature
Maybe:
Automatically delete empty groups