• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

[flatten] Automatically Removing Programmes from Series Folders

I have upgraded to 1.0.4-1, and am now getting the following error in my auto.log.
Code:
21/09/2013 20:50 - Flatten failed to remove directory
21/09/2013 20:50 - Plugin error: wrong # args: should be "system rmdir_if_empty dir"
21/09/2013 21:00 - Flatten failed to remove directory
21/09/2013 21:00 - Plugin error: wrong # args: should be "system rmdir_if_empty dir"
 
Hi Guys

I have been spending a little time on the flatten script and I think I have identified where there are problems. I have modified the lines and it seems to be working ok now. Specifically the lines at the bottom that delete the empty folders caused an error.

Original

if {![system rmdir_if_empty $dir]} {
log "Flatten failed to remove directory" 0
foreach l [system rmdir_if_empty $dir 1] {
log "Blocking file: $l" 0
}
}

Replaced With

if {![system rmdir_if_empty $dir]} {
log "Flatten failed to remove directory" 0
foreach l [readdir -nocomplain $dir] {
log "Blocking file: $l" 0
}
}

I would rem the log line when testing is complete.

I have also set all the log lines to output to 0 so that I could see what was happening.

One of the lines didn't specify the log file

log "Recording not yet ended." 0

Perhaps someone on the night shift could check that it all works ok.

Sorry if I have broken any etiquette. I just wanted to fix the problems

Kennedy
 
Ok, I couldn't give up on this so I am looking at it again this morning. The 4 files that make up Match of the day have been moved in to the root but the folder is still there being blocked by the 2 files *.hmt and *.thm. On checking files times its noticeable that the *.ts and *.nts files have times earlier than the *.hmt and *.thm files. So the script copied all the files over at 9:00am but the *.htm and *.thm files were still being written so got copied but not deleted. Subsequently they can't be moved because that would cause an overwrite.

I have checked other files sets and this seems to be quite common especially on those programmes recorded from a HD channel when the box is in standby. QI has *.ts and *.nts files timed at 22.31. The *.hmt and *.thm files are timed at 22.42.

I think that the script should check all of the files in the set to determine whether they are still being written before deciding to move them.
 
The appropriate formatting for code sections is to enclose them in [code]...[/code] tags (available on the edit toolbar as the {}# tool, in mobile browsers you have to type the tags verbatim).

We have had issues similar to this before (not necessarily noticed in flatten) where the individual file moves cause problems, and af123 fixed it by ensuring files were moved as a block. Similar needs doing here.
 
Can you try 1.0.6-8?
I have upgraded to 1.0.6-8, but will have to wait until I have more folders to flatten to see if it fixes the error.
I am now getting the following in my auto.log
Code:
22/09/2013 20:40 - Flatten failed to remove directory
22/09/2013 20:40 - Blocking file: The Crane Gang_20130922_2001.hmt
22/09/2013 20:40 - Blocking file: The Crane Gang_20130922_2001.nts
22/09/2013 20:40 - Blocking file: The Crane Gang_20130922_2001.ts
22/09/2013 20:50 - Flatten failed to remove directory
22/09/2013 20:50 - Blocking file: The Crane Gang_20130922_2001.hmt
22/09/2013 20:50 - Blocking file: The Crane Gang_20130922_2001.nts
22/09/2013 20:50 - Blocking file: The Crane Gang_20130922_2001.ts
Is this the new expected behaviour?
 
Well that's weird. Last week I reported that flatten seemed to have broken when it moved the file for "The House That £100k Built" (BBC2 HD) out of its folder to the root, but then failed to delete the folder which still showed '1 file' contents.
This week the same thing has happened - same program, same result. It does seem like more than coincidence that this program has done this twice.
There is one factor that we don't often get - it is immediately followed by another series recording on the same channel but which is directed to a specified folder.

I think flatten is still working at present as a couple of subsequent progs have flattened (but I had set them to go in another folder, so summat odd there too).
I'll do a power off/on later when recordings have finished to try and clear things out again.
 
What do the logs show? Are you using unencrypt or auto-decrypt (or neither)? If unencrypt, what schedule have you set for it in crontab? Decryption takes a long time for a HiDef recording, so there may be interactions.
 
What do the logs show? Are you using unencrypt or auto-decrypt (or neither)? If unencrypt, what schedule have you set for it in crontab? Decryption takes a long time for a HiDef recording, so there may be interactions.

No, nothing being decrypted or the like - everything is watched from the actual box.

Log below. What looks to me to have happened is that when the program finished at 25/09/2013 21:00 the .hmt file couldn't be deleted from the original folder. One oddity is that it continued trying to complete the flatten operation until late last night, even though I had manually deleted the folder long before that.

Code:
24/09/2013 23:50 - Blocking file: New_ Castle_20130924_2259.hmt
24/09/2013 23:50 - Blocking file: New_ Castle_20130924_2259.nts
25/09/2013 19:30 - Flattening /media/My Video/New_ Castle/New_ Castle_20130924_2259.ts
25/09/2013 20:10 - Flatten failed to remove directory
25/09/2013 20:10 - Blocking file: The House That £100k Built_20130925_2000.ts
25/09/2013 20:10 - Blocking file: The House That £100k Built_20130925_2000.nts
25/09/2013 20:10 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 20:20 - Flatten failed to remove directory
25/09/2013 20:20 - Blocking file: The House That £100k Built_20130925_2000.ts
25/09/2013 20:20 - Blocking file: The House That £100k Built_20130925_2000.nts
25/09/2013 20:20 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 20:30 - Flatten failed to remove directory
25/09/2013 20:30 - Blocking file: The House That £100k Built_20130925_2000.ts
25/09/2013 20:30 - Blocking file: The House That £100k Built_20130925_2000.nts
25/09/2013 20:30 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 20:40 - Flatten failed to remove directory
25/09/2013 20:40 - Blocking file: The House That £100k Built_20130925_2000.ts
25/09/2013 20:40 - Blocking file: The House That £100k Built_20130925_2000.nts
25/09/2013 20:40 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 20:50 - Flatten failed to remove directory
25/09/2013 20:50 - Blocking file: The House That £100k Built_20130925_2000.ts
25/09/2013 20:50 - Blocking file: The House That £100k Built_20130925_2000.nts
25/09/2013 20:50 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:00 - Flattening /media/My Video/The House That £100k Built/The House That £100k Built_20130925_2000.ts
25/09/2013 21:10 - Flatten failed to remove directory
25/09/2013 21:10 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:10 - Flatten failed to remove directory
25/09/2013 21:10 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 21:10 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 21:10 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 21:20 - Flatten failed to remove directory
25/09/2013 21:20 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:20 - Flatten failed to remove directory
25/09/2013 21:20 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 21:20 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 21:20 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 21:30 - Flatten failed to remove directory
25/09/2013 21:30 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:30 - Flatten failed to remove directory
25/09/2013 21:30 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 21:30 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 21:30 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 21:40 - Flatten failed to remove directory
25/09/2013 21:40 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:40 - Flatten failed to remove directory
25/09/2013 21:40 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 21:40 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 21:40 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 21:50 - Flatten failed to remove directory
25/09/2013 21:50 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 21:50 - Flatten failed to remove directory
25/09/2013 21:50 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 21:50 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 21:50 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 22:00 - Flatten failed to remove directory
25/09/2013 22:00 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:00 - Flatten failed to remove directory
25/09/2013 22:00 - Blocking file: Fabric of Britain_20130925_2101.nts
25/09/2013 22:00 - Blocking file: Fabric of Britain_20130925_2101.ts
25/09/2013 22:00 - Blocking file: Fabric of Britain_20130925_2101.hmt
25/09/2013 22:10 - Flatten failed to remove directory
25/09/2013 22:10 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:10 - Flatten failed to remove directory
25/09/2013 22:10 - Blocking file: Whitechapel_20130925_2201.nts
25/09/2013 22:10 - Blocking file: Whitechapel_20130925_2201.hmt
25/09/2013 22:10 - Blocking file: Whitechapel_20130925_2201.ts
25/09/2013 22:10 - Flattening /media/My Video/Fabric of Britain/Fabric of Britain_20130925_2101.ts
25/09/2013 22:20 - Flatten failed to remove directory
25/09/2013 22:20 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:20 - Flatten failed to remove directory
25/09/2013 22:20 - Blocking file: Whitechapel_20130925_2201.nts
25/09/2013 22:20 - Blocking file: Whitechapel_20130925_2201.hmt
25/09/2013 22:20 - Blocking file: Whitechapel_20130925_2201.ts
25/09/2013 22:30 - Flatten failed to remove directory
25/09/2013 22:30 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:30 - Flatten failed to remove directory
25/09/2013 22:30 - Blocking file: Whitechapel_20130925_2201.nts
25/09/2013 22:30 - Blocking file: Whitechapel_20130925_2201.hmt
25/09/2013 22:30 - Blocking file: Whitechapel_20130925_2201.ts
25/09/2013 22:40 - Flatten failed to remove directory
25/09/2013 22:40 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:40 - Flatten failed to remove directory
25/09/2013 22:40 - Blocking file: Whitechapel_20130925_2201.nts
25/09/2013 22:40 - Blocking file: Whitechapel_20130925_2201.hmt
25/09/2013 22:40 - Blocking file: Whitechapel_20130925_2201.ts
25/09/2013 22:50 - Flatten failed to remove directory
25/09/2013 22:50 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 22:50 - Flatten failed to remove directory
25/09/2013 22:50 - Blocking file: Whitechapel_20130925_2201.nts
25/09/2013 22:50 - Blocking file: Whitechapel_20130925_2201.hmt
25/09/2013 22:50 - Blocking file: Whitechapel_20130925_2201.ts
25/09/2013 23:00 - Flatten failed to remove directory
25/09/2013 23:00 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 23:00 - Flattening /media/My Video/Whitechapel/Whitechapel_20130925_2201.ts
25/09/2013 23:10 - Flatten failed to remove directory
25/09/2013 23:10 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 23:20 - Flatten failed to remove directory
25/09/2013 23:20 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 23:30 - Flatten failed to remove directory
25/09/2013 23:30 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 23:40 - Flatten failed to remove directory
25/09/2013 23:40 - Blocking file: The House That £100k Built_20130925_2000.hmt
25/09/2013 23:50 - Flatten failed to remove directory
25/09/2013 23:50 - Blocking file: The House That £100k Built_20130925_2000.hmt
26/09/2013 00:00 - Flatten failed to remove directory
26/09/2013 00:00 - Blocking file: The House That £100k Built_20130925_2000.hmt
26/09/2013 00:10 - Flatten failed to remove directory
26/09/2013 00:10 - Blocking file: The House That £100k Built_20130925_2000.hmt
 
So I've been running flatten for a long time. This week it seems to have stopped working with punctuation.
I did do some package upgrades recently but I can't remember if flatten was one of them or not.

Last weeks "Tom Kerridge's Best Dishes" was flattened as normal but this weeks has not been.
Are there any diagnostics I can try?
Looking in auto.log the only thing I can see is several errors like this

12/10/2014 15:20 - Plugin error: invalid command name "0"
 
I've turned up the logging level to debug and can now see the following in the auto.log

12/10/2014 17:30 - + Flatten considering New_ Dragons - Defenders of Berk
12/10/2014 17:30 - Flatten processing /media/My Video/New_ Dragons - Defenders of Berk
12/10/2014 17:30 - > New_ Dragons - Defenders of Berk_20141009_1658.ts
12/10/2014 17:30 - Plugin error: invalid command name "0"

So it does look like those errors are coming from flatten.
When I manually moved the Dragons file (a .ts file on its own I think), flatten then started working correctly.

It looks like this was blocking normal operation of flatten.
 
Back
Top