1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[flatten] Automatically Removing Programmes from Series Folders

Discussion in 'HD/HDR-FOX T2 Customised Firmware' started by Brian, Nov 26, 2011.

  1. Brian

    Brian Administrator 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.
     
  2. Black Hole

    Black Hole Felonius Gru

    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?
     
  3. Brian

    Brian Administrator Staff Member

    It may be useful to be able to specify the name of a folder that does not require emptying, but otherwise empty all others.
     
  4. af123

    af123 Administrator Staff Member

    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.
     
    brian likes this.
  5. Brian

    Brian Administrator Staff Member

    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.
     
  6. af123

    af123 Administrator Staff Member

    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.

    Code:
    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.
     
    brian likes this.
  7. Brian

    Brian Administrator Staff Member

    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?
     
  8. Black Hole

    Black Hole Felonius Gru

    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?)
     
  9. Brian

    Brian Administrator Staff Member

    Will have to wait and see what af123 can come up with.
     
  10. af123

    af123 Administrator Staff Member

    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.
     
  11. Brian

    Brian Administrator Staff Member

    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?
     
  12. af123

    af123 Administrator Staff Member

    Yes, that would work.
     
  13. Brian

    Brian Administrator Staff Member

    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.
     
  14. af123

    af123 Administrator Staff Member

    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.
     
  15. Brian

    Brian Administrator Staff Member

    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?
     
  16. af123

    af123 Administrator Staff Member

    It will probably require a reboot and yes, you won't need to use telnet, it will scan for new recordings every 15 minutes.
     
  17. Brian

    Brian Administrator Staff Member

    Ok Thanks, I'm recording at the moment so won't be able to reboot yet, unless putting into standby whilst recording will suffice?
     
  18. af123

    af123 Administrator Staff Member

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

    Code:
    humax# /mod/etc/init.d/S01crond stop
    
    humax# /mod/etc/init.d/S01crond start
    
     
  19. Brian

    Brian Administrator Staff Member

    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.:)
     
  20. af123

    af123 Administrator Staff Member

    What are you going to do with all those minutes you used to spend moving things around ? : )