[Feature Request] Exclude certain file extensions

Bug #1115765 reported by Xyresic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DC++
Fix Released
Wishlist
Unassigned

Bug Description

It would be nice if DC++ can exclude certain file extensions like it does for hidden folders and prevent them from being hashed.

DC++ will often take the file lock to hash incomplete files, which happens often when a download from a external program is stalled, and causes problems when trying to continue the download.

Tags: core win32-ui
eMTee (realprogger)
Changed in dcplusplus:
importance: Undecided → Wishlist
Revision history for this message
Fredrik Ullner (ullner) wrote :

Adds an additional settings dialog that will allow the user to filter files based on:
* Any part of the name with regular expressions
* File extensions (thinly veiled with regular expressions under)
* Minimum and maximum file sizes

I don't have a good Icon for the new dialog, so I've just used the same Icon as for Upload. Someone else can provide a better replacement later on.. (Didn't want to simply steal it from other projects..)

By the way, no other implementation's source code was checked to incorporate this.

Fredrik Ullner (ullner)
Changed in dcplusplus:
status: New → In Progress
Revision history for this message
Fredrik Ullner (ullner) wrote :

So apparently 'bzr diff' doesn't include new files... The most interesting page is otherwise the actual UploadFiltering setting frame: http://pastie.org/8226528

Revision history for this message
poy (poy) wrote :

neat! i have minor remarks:

1) ItemsEditDlg is missing from the patch too. i can guess it is based on StringListDlg, which is what i was hoping for. :)

2) for (auto value: container) should usually be for (auto& value: container) to avoid copies of each value when iterating. the non-ref version remains acceptable only when a copy is cheap (container of numbers / pointers).

3) help files you have edited have an ugly BOM introduced in them; please get rid of it.

4) how about [pattern + "$"] as a regex instead of ["^" + pattern], if that works? the $ version is made to catch endings.

5) i am having a hard time understanding the min / max file size concept. is it min / max to include or to exclude? how about "Only share files whose size is below/higher than X"?

Revision history for this message
Fredrik Ullner (ullner) wrote :

Patch to address the previous comments.

Also adds filtering for path.

Revision history for this message
poy (poy) wrote :

good job overall - more remarks:

3) i still see a BOM in help/settings_sharing_filtering.html.

4) good, so [pattern + "$"] worked. :) the pattern in question should be escaped though; since this is only for file extensions, just escaping dots (".") should be enough (eg if one wants to match "tar.bz2"). another possibility is to get the ext with Util::getFileExt then compare against that.

6) the list splitting from settings on every call to ShareManager::checkInvalidFileName & ShareManager::checkInvalidPaths should be optimized - these run once for every file/dir. one could for ex cache the list in ShareManager and refresh it from settings before running the directory browsing. similarly, it may be a good idea to cache the regex / StringMatcher classes (this needs measurements).

7) the min/max size settings should be stored as 64-bit ints so one can go above 2 GB or so. there is a place in SettingsManager for that purpose.

8) in UploadFilteringPage::write, only refresh shares when filtering settings have changed.

9) the 3 handleMod functions in UploadFilteringPage look very similar - refactor?

Revision history for this message
Fredrik Ullner (ullner) wrote :

Mentioned items should be done in this patch.

I wonder what is causing the BOM in the XMLs, I'm just using Notepad and VS to edit those files.

Revision history for this message
Fredrik Ullner (ullner) wrote :

Fixes also that the share filter cache is initialized upon start.

Revision history for this message
Fredrik Ullner (ullner) wrote :

Fixed some minor bugs from the previous patch.

Revision history for this message
poy (poy) wrote :

looking perfect! please commit.

one detail: please change boost::replace_all to Util::replace which is a hand-made version of the former; it is safer for the time being as boost likes to play tricks with locales (could affect performance or even produce wrong results). when the time comes and boost has been properly evaluated, Util::replace could then redirect to it.

Revision history for this message
poy (poy) wrote :

i forgot to mention another point: please check that the newly introduced cache is up-to-date when adding a dir (ie adding filters then adding a dir to share in the same session of the settings dialog). if this doesn't respect new filters, try to call updateFilterCache() in ShareManager::addDirectory (and ShareManager::removeDirectory as well?).

Revision history for this message
Fredrik Ullner (ullner) wrote :

Pushed.

Changed to Util::replace as suggested. Works fine when adding a directory as far as I could see at least.

Changed in dcplusplus:
status: In Progress → Fix Committed
Fredrik Ullner (ullner)
tags: added: core win32-ui
removed: feature request
Revision history for this message
poy (poy) wrote :

Fixed in DC++ 0.840.

Changed in dcplusplus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.