PDA

View Full Version : [ET10x00] Recording Directory Deletion Issue 2



EMJB
04-04-16, 16:09
In the main MovieList, it is a list of recordings that is being shown, but when you want to delete a directory the "are you sure" message lists the number of files which will normally be much larger. Hence, for example, a directory being shown a having 4 recordings may well appear as having 16 or more files in the deletion "are you sure" message. Technically correct, but confusing for the technophobe.

As a partial fix, at around line 1973 on MovieSelection.py, I have changed:

if os.path.isdir(ffn):
subdirs += 1
else:
files += 1
if files or subdirs:
folder_filename = os.path.split(os.path.split(name)[0])[1]
mbox=self.session.openWithCallback(self.delete, MessageBox, _("'%s' contains %d file(s) and %d sub-directories.\n") % (folder_filename,files,subdirs) + are_you_sure)

to read:

if os.path.isdir(ffn):
subdirs += 1
else:
if ffn.endswith(".ts"): # New condition to only count recordings
files += 1
if files or subdirs:
folder_filename = os.path.split(os.path.split(name)[0])[1]
mbox=self.session.openWithCallback(self.delete, MessageBox, _("'%s' contains %d recording(s) and %d sub-directories.\n") % (folder_filename,files,subdirs) + are_you_sure)

but this will only work for enigma recordings, and presumably the "if ffn.endswith(".ts"):" statement should be replaced by something like:

fileName, fileExtension = os.path.splitext(ffn)
if fileExtension in KNOWN_EXTENSIONS:

with KNOWN_EXTENSIONS being as defined in MovieList.py.

leshay
04-04-16, 22:42
Hi
I think the replies to the OP are terrible. The OP posted a perfectly valid issue and it deserves a better response. If readers have no interest, then it is far easier to just ignore than to bother to type a useless reply.

birdman
05-04-16, 01:08
Here's an (untested) patch to ignore all known meta-files.


--- MovieSelection.py.orig 2016-04-05 00:57:34.904491466 +0100
+++ MovieSelection.py 2016-04-05 01:06:26.087547199 +0100
@@ -1972,10 +1972,16 @@
if os.path.isdir(ffn):
subdirs += 1
else:
- files += 1
+ ignore = False
+ for known in ("eit", "ts.ap", "ts.cuts", "ts.meta", "ts.sc"):
+ if ffn.endswith(known):
+ ignore = True
+ break
+ if not ignore:
+ files += 1
if files or subdirs:
folder_filename = os.path.split(os.path.split(name)[0])[1]
- mbox=self.session.openWithCallback(self.delete, MessageBox, _("'%s' contains %d file(s) and %d sub-directories.\n") % (folder_filename,files,subdirs) + are_you_sure)
+ mbox=self.session.openWithCallback(self.delete, MessageBox, _("'%s' contains %d recording(s) and %d sub-directories.\n") % (folder_filename,files,subdirs) + are_you_sure)
mbox.setTitle(self.getTitle())
return
else:

abu baniaz
05-04-16, 01:18
Here's an (untested) patch to ignore all known meta-files.


Is that to ignore only in the counting process, i,e they still get deleted?

birdman
05-04-16, 01:58
Is that to ignore only in the counting process, i,e they still get deleted?Yes - it's going to delete a directory and all of the contents. This is just working out what to tell the user.