[flatten] Automatically Removing Programmes from Series Folders


Staff member
Would this be possible to do ?

My main Hate about the Humax HD/HDR-FOX T2 boxes is the annoying way that series recordings are automatically placed into separate folders per series.

I prefer to have all of my recordings in one list, arranged by date order, as this is how I tend to watch my programmes before deleting them. I currently achieve this by opening a folder, selecting any programmes within, then moving them to HDD (My Video), then closing the empty folder and Deleting it. I repeat this for All series folders, several times per day.

I realise that many people seem to like the folder creation, but I am not one of these, so would it be possible to create a script or package that would automate this chore for me, and anyone else who is not a fan of auto folder creation.

Thanks for reading this.
I'm sure this would be possible, just need to catch the interest of a BYT. Do you want something which completely flattens every directory it finds, no exceptions?
It may be useful to be able to specify the name of a folder that does not require emptying, but otherwise empty all others.
Yes, that's certainly possible, the only real challenge is ensuring that only completed recordings are moved. I'll have a look at putting something together for you. It only needs to process recordings one level deep since everything else has been manually created. I'll have trouble completely testing it too of course as I don't want to flatten my structure.
Thanks for looking at this, I shall look forward to any further developments in due course.

I don't think that it is possible to move programmes that are still being recorded, at least not using the remote control. I also don't think that a folder can be deleted whilst it has a currently recording programme within.
I've uploaded a package called flatten. I haven't made it automatically run yet until you've had a chance to test it but if you install it then get access via telnet you should be able to run the /mod/sbin/flatten command to do the same process as you've previously done by hand. Once you confirm it is working then I'll update the package so that it runs every 15 minutes (while the box is on) or whatever seems reasonable.

humax# /mod/sbin/flatten

It's designed to run periodically and scan the video root for directories, then move all recordings in those directories back to the root, and try and remove the directory (which will fail if it isn't empty). It only looks at one level since that's all that are automatically created.

It checks that the recording is valid and finished (by checking the end date in the hmt file then checking to see if the .ts file is still growing) before moving it.

A better solution in the future may be to do what the new auto-unprotect package does and hook into the kernel to receive notifications when files are closed, that would make the process trigger as soon as recordings finish but would take more time to implement and test.
I have just tried flatten, and can confirm that it seemed to work properly.:) I only had two folders left, "The X Factor" and "Strictly Come Dancing".

The X Factor episode was moved, and the empty folder was deleted.:) The "Strictly" folder contained yesterdays episode together with the still recording todays episode, and I can confirm that yesterdays show was moved, but todays show remained in it's folder as expected because it was still recording.:)

Perhaps it would be nice to have it running every 30 minutes when the box is on.

One other useful addition would be the ability to ignore certain folders that I may want to keep things in, such as a Film folder, and folders named for family members, would this be possible?
Maybe there's a way to mark such folders with a delete-protect property? EG the presence of a particular file .donotflatten, if found the flatten util ignores it, set and cleared by the WebIF OPT+ button.

(On the subject of WebIF, why can't we delete folders? And how about being able to move recordings?)
Do recording folders ever have a . at the end of their name? I could make it skip any folder like that which would give you an easy way to mark folders to ignore, just call them "Films." etc.
I don't recall seeing any with a . after them, I have just tried making a new folder called "Films." and it ends up as "Films_". How about putting the name in [ ], such as "[Films]", would that be ok?
I don't recall seeing any with a . after them, I have just tried making a new folder called "Films." and it ends up as "Films_". How about putting the name in [ ], such as "[Films]", would that be ok?

Yes, that would work.
I can't think of any series that would have it's name in [ ] so that would be fine for me, and it looks ok for a folder name.
Ok, the new version I've just uploaded runs automatically every 15 minutes and ignores any folders like [*] - even if recordings have [] in them it's unlikely to be at the start end end of the name so it should be safe.
Thanks, I've just updated to the new version. Before doing this, I created two folders with [ ] around the name, and one without, and moved a few recordings into them to see what happens.

Will this start to work straight away, or will I have to reboot the box first? Does this mean that I will not have to use the Telnet command anymore?
It will probably require a reboot and yes, you won't need to use telnet, it will scan for new recordings every 15 minutes.
Ok Thanks, I'm recording at the moment so won't be able to reboot yet, unless putting into standby whilst recording will suffice?
Ok Thanks, I'm recording at the moment so won't be able to reboot yet, unless putting into standby whilst recording will suffice?

No, it needs a full reboot but you could instead restart the necessary service with:

humax# /mod/etc/init.d/S01crond stop

humax# /mod/etc/init.d/S01crond start
Update, my folder without [ ] has just been emptied and deleted, whilst the two with [ ] are still there complete with contents, so it seems to be working without the reboot.:)
What are you going to do with all those minutes you used to spend moving things around ? : )