I’m still trying to decide where I wanna go with my media browser/frontend solution — if I’m going to write my own or keep hacking on MythVideo. I only have one really nagging issue left now, and that is that the file structure presented is static once you enter the “Watch Videos” menu. I’d like it to be dynamic (that is, upon entering a new folder, check the contents again) so that I can add stuff like symlinks to series that I’m currently watching, or whatever. Doing that is pretty tricky.
I spent a few hours last night digging through the code, trying to find out exactly how the code is operating and what it’s doing. What I learned was that, well Myth was doing exactly what I thought it was — it builds a file list upon first entering, and then it doesn’t examine it at all until you re-enter the video browser through the main myth menu. (I wish I had a decent screenshot about now, it’s a bit confusing if you don’t know what I’m talking about.)
There’s a couple of problems with this approach, in my mind. First of all, the time it takes to actually load the mythvideo plugin grows in relation to how much media you have that it needs to parse. That is, it iterates over *every* single file that is in your media storage, and adds it to one variable. It’s essentially like running find on your filesystem, saving it into one variable, and then when browsing, just using that snapshot that you took.
The simpler way, in my opinion, would be to just refresh the directory structure and metadata for the directory you are in. While I was poking at it, one thing I tried was to get the directory scan to not go more than one level deep. That reduced the startup time from about 8 seconds to less than one. Nice.
Ideally, I’d like to change it so it just updates the directory scan as it enters a new one, progressively growing the variable as you jump around the directory tree, but I couldn’t figure out how to do that in the code (and if someone wants to help, that’d be awesome). MythVideo calls fetchVideos() only when first entering, and not anytime after that. The real problem is that it in turn calls about eight other levels of functions that eventually get to scanning the directory tree. I could probably hack it together to pass the current directory I’m in and update the directory scan from there, but again, I’m so limited in my C++ skills, at this point it’s just code and guess. So, I can find and explain the problem, but not fix it myself.
Fortunately, it’s a minor wish list item of mine, and so it’s not a show stopper. I can live with not being able to do it, and it’s probably just a matter of me learning how to code a bit more that I could figure it out. On the plus side, I’m learning more about the internals of the code, and each time I go in there, I find a few small inefficiencies that I can cleanup myself, which is fun. Making progress, I suppose. 🙂
Nice work. I’m no C++ programmer but I’d definitely be interested in helping out. If I’m not mistaken though the MythVideo only scans files in it’s database not the actual directory structure. The reason I found your post (and I’m rather shocked at how recent it is) is that I’d like to be able to dump files into the mythvideo folders and then have them automatically available to the user instead of having to exit out to the Utilities and Settings MythVideo page to Scan and refresh the database.
There’s a preference bit you can flip so that it will scan files not in the database. The only reason it really has them in there is so it can pretty-print the titles (fixed that in a separate patch) and store relevant metadata (which I don’t).
Have exactly the same issue.
Loading is now up around the 90 second mark 🙁
Would be very interested if you find a solution to this.
I haven’t yet, but I haven’t worked on it much … the code is a bit complex, at times I’ve considered using something else completely. But if I could just get this last thing fixed, I’d be pretty much done.
Have you given xbmc a go ?
The internal player is OK, but the only issue I have with it is the ability to use mplayer with it, without issues.