[mythtv] patch-proposal: MythVideo list view changes
Jeff Doozan
mythtv at doozan.com
Mon Sep 8 10:43:00 EDT 2003
I'm planning to rework some of the list view to, hopefully, make
things a little faster and a bit more robust. Currently, when using
database mode (instead of file/directory mode), the tree is populated
by obtaining a list of all videos, querying the directory of each
video, splitting up the file path, and then climbing the
subdirectories from the root of the tree to the branch that would
contain the file. In addition to being somewhat ineffecient, this
also makes it impossible to categorize movies without having to place
them in directories on the filesystem.
Using the DB instead of the Filesystem
======================================
I propose to change this by adding a new table to the database called
VideoGroups. This would just hold a list of group names and IDs:
Table VideoGroups
-----------------
int GroupID
string GroupName
int ParentID
The videometadata table will also receive a new field called
"GroupID". Each file will be assigned to a group.
If /mnt/Movies is your base directory, then the file
/mnt/Movies/Horror/Cheesy/EvilDead.avi
would add two entries to the group table
GroupID 123
GroupName Horror
ParentID 0
and
GroupId 124
GroupName Cheesy
ParentID 123
the new GroupID field for EvilDead in the videometadata table would
be set to 124.
Populating the Tree
===================
When the tree view is building the list of movies, instead of running
through a list of all of the files, and then splitting the filename
and crawling down the tree for each file, it will do something like
this:
AddGroupToTree(Group) {
Check for children by querying groups with parent matching this
GroupID
if this has children, recursively call this function for the
children
Create tree branch for this GroupName
Query all movies in this group
Add movies to this branch
}
Advantages
==========
This should make the creation of the List View window somewhat
faster. Additionally, it has the advantage of allowing users to
categorize movies on their own. I have movies on two hard drives
mounted in /mnt/movies/1 and /mnt/movies/2. Rather than having them
split into two directories in the list view, I'll now be able to
manipulate their Groups to place them all in the same branch of the
tree.
Please let me know if you have any comments/questions/concerns
regarding this proposal.
Thanks,
Jeff Doozan
More information about the mythtv-dev
mailing list