[seriesfiler] Series Auto-filer

The script had a glitch last night, exiting when it thought the files were in use.. seems like the files were open by mediatomb, even though I don't actively use that package. I'd rebooted the box (power off/on) without any effect which was odd.

It also seems as though something had broken the cron job & the script wasn't being run at all.

Here's what I did to fix the problem (in case anyone else has the same issue);

1) I've removed mediatomb (which I don't use)
2) Edited the cron file (/mnt/hd2/mod/var/spool/cron/crontabs/root) to fix this problem (not sure if an update I did on Sat broke it...)

Changed this...

*/10 * * * * /mod/sbin/auto-unprotect
0,15,30,45 * * * * /mod/bin/seriesfiler 2>&1 >> /mod/tmp/seriesfiler.log*/10 * * * * /mod/sbin/auto-unprotect

To this...

*/10 * * * * /mod/sbin/auto-unprotect
0,15,30,45 * * * * /mod/bin/seriesfiler 2>&1 >> /mod/tmp/seriesfiler.log


3) Restart the cron job service.

/mod/etc/init.d/S01crond restart

The script is working properly now
 
I've just been playing with packaging - would people like this to be added to the standard repository, or is it only the geekier of us that want to use it and are happy to install it manually?
 
IMO it should be popular.. it's the one thing I think is a big missing from the features you'd hope it had out of the box.
 
I find it very useful. One of the best additions to the box. Allows me to keep folders of my tv, the wife's and joint stuff and have it all nicely sorted away rather than having a huge list of folders. This would be a great addition to the repos so that more people can take advantage of this.
 
Yes please - I probably am one of the geekier of us, but have not found the time to set this up yet, despite it looking very useful (too busy on my own geeky projects!) I recently set up a package for the HD Boot mode scripts and it was very easy. :)
 
When I looked at packaging the filer script up, the hard part looked as though it'd be how to alter the cron job without obliterating existing entries, or adding double entries for the auto-filer if subsequent upgrades were applied.
 
It's all done in CONTROL/postinst and here's how anacron is set up

Code:
cronf=$crond/root
export tmpf=/tmp/cronf.$$
grep -v anacron $cronf > $tmpf
(
      cat $tmpf
      echo '0 2 * * * /mod/sbin/anacron -s -d'
) > $cronf

Quite a neat solution really.
 
I've submitted my first attempt at a package and we'll see how it goes.

For the moment, it's just my original script with some minor tweaks that resulted from a better understanding of the hmt utility and another script that can be used to correct the folder details that were not being set as files were moved. Installation should bring in cron (if it's not already there) and configure the filer to run every 15 minutes.

@MattC - I'm going to record some series over the next few days and have a play with the renaming feature as I'd like to implement it without using perms after which I'll roll that up into the package as well.
 
OK - here goes...

The seriesfiler is now available in the main repository for the custom firmware. Just refresh the package list with 'opkg update' and then 'opkg install seriesfiler'. After that, simply move your series directories to where you want them and the script will automatically move new episodes into that directory.

Let me know how you get on.
 
Didn't seem to be working for me but think I've found the problem - on the HD the video folder is annoyingly "/media/drive1/Videos", rather than "/media/My Videos". In my scripts I tend to put something like this

Code:
#HDR or HD?
if [ -d "/media/My Video" ]; then
VIDEOPATH="/media/My Video"
else
VIDEOPATH="/media/drive1/Video"
fi

at the top to cover it.

Could I request this be added to the package at some point please :)?

Also I notice "/mnt/hd2" is used as the path for the hmt path rename? This also doesn't map the same on the HD (I think it used to map drive1 in there as part of the mod firmware, but now it just maps /mod/ into hd2). Out of curiosity, why can't this use the /media... path? Also does not setting the directory in the .hmt cause any problems - I'm not doing it when my editing scripts move suff around and not noticed any trouble?

I sometimes wonder if it would be easier to just mount "/media/drive1/Videos" to "/media/My Videos" as part of the mod firmware. Any thoughts on that af123? Means a potentially confusing "virtual" drive appearing in the OSD but in some ways it would also be useful - one less layer to navigate down with the remote...

Steve
 
Hi Steve,

I've just uploaded seriesfiler 0.2.1 which incorporates autodetection of the video path. I haven't got an HD to try it out with, but the edits don't seem to have broken normal operations on my HDR. Let me know how you get on.
 
Thanks Sam :) It was all working well last night after putting in the changes by hand, so should be fine - will give it a spin this weekend...

Steve
 
Not sure this bit in the new script is right -

Code:
hmtfolder=$VIDEOPATH}/${location#/media}
echo $hmtfolder
$HMT +setfolder="$hmtfolder/" "$location/$episode.hmt"

For me that becomes

/media/drive1/Video}//drive1/Video/...

Even without the "}" is doesn't seem right.
Don't think it really matters as the path in the hmt file doesn't seem to be important but how about just:

Code:
$HMT +setfolder="$location/" "$location/$episode.hmt"

Or am I missing something?

Steve
 
There was a bug and I have already uploaded a new version which is in the system.

Because I hadn't got an HD to play with, I decided to play safe with the use of VIDEOPATH, hence the curly brackets, but somehow I missed one out of the copy that I uploaded - that first line of code should have been
Code:
hmtfolder=${VIDEOPATH}/${location#/media}

Sam
 
As regular readers will know, I've been thinking about flatten lately, and somebody was wanting to flatten an auto-filed series, and auto-filer can be accessed from the SUI...

I came up with another idea to cooperate with auto-filer, but it would have to run in concert, and much of the core functionality is already coded into auto-filer, so actually this would be best implemented as an extension to auto-filer. The result is that flatten users can continue to use flatten, but auto-filer users won't need it.

Here's how it works: auto-filer+ does the same as usual, finding duplicate series folder names and moving newly recorded content if found. However, it then scans for folders named [FLATTEN]. The contents of any folders inside a folder called [FLATTEN] are moved to the parent folder of [FLATTEN], but the original folder is left in place.

This means the whole process can be controlled from the SUI by creating a magic folder "[FLATTEN]" wherever it is required, and moving existing series folders into or out of it.
 
That looks doable. If I get chance in the next few days I'll have a go at this modification. I think for ease of use a "*f" or similar would be a lot better than [FLATTEN] which is quite lengthy to enter via the remote.
 
Whatever is chosen, it needs to be self-documenting - ie whatever you see needs to speak "anything you put in here gets flattened". It took me 23.3 seconds to enter "[FLATTEN]".

Would it be possible to create a small special-purpose virtual mount (so it is recognised as a different drive), and create [FLATTEN] in it? Then the SUI could be used to copy the folder into wherever you want one, and being on a different drive would mean the copy option instead of the move option. If there was a mechanism like this, the name could be even more expressive - eg [AUTO-FILER FLATTEN]. Alternatively the user could be advised that the creation of the folder in multiple locations will be more efficient if he first creates one on whatever external drive he is using and then copies it (may not apply to HD-FOX users).

I have been trying to decide if there is a conflict between using [*] and the existing flatten. Being in [], flatten would ignore it. The only conflict I can think of is if the user had a category called "FLATTEN" that he wanted to protect from flatten by putting brackets round it. Not very likely, and even less likely if we use [AUTO-FILER FLATTEN].
 
Why does it never file 'the sky at night' ?
Is it cuase its a monthly program and has a different ID or something?
 
Back
Top