Sude- / lgogdownloader

LGOGDownloader is unofficial downloader to GOG.com for Linux users. It uses the same API as the official GOG Galaxy.
https://sites.google.com/site/gogdownloader/
Do What The F*ck You Want To Public License
714 stars 67 forks source link

blacklist doesn't seem to work correctly #283

Closed mbunkus closed 1 month ago

mbunkus commented 1 month ago

Hey,

I'm trying to keep a copy of the Baldur's Gate 3 installer files at a certain version in a manually created subdirectory. This is very similar to the case mentioned in the man page in the section explaining how the blacklist works.

However, --check-orphans always shows that it considers the files in that directory to be orphans, no matter which regular expressions I enter in the blacklist. I'm using regexes a lot (experienced Perl programmer), I've verified the regexes against the file names with sites such as regex101.com & regexr.com.

Here's the details:

Blacklist entries I've tried (one at a time, not all simultaneously):

Rp ^baldurs_gate_iii/4\.1\.1\.5022896_patch6_hotfix9\.keep/.*
Rp ^.*baldurs_gate_iii/4\.1\.1\.5022896_patch6_hotfix9\.keep/.*
Rp .*\.keep/.*
Rp .*

Neither one of those worked, as in lgogdownloader --check-orphans still lists all the files in /ftp/pub/Gamez/GOG Offline Installers/baldurs_gate_iii/4.1.1.5022896_patch6_hotfix9.keep as being orphans.

In fact, putting Rp .* into the blacklist makes the program go total bananas! It now considers all files to be orphans (!!). I've verified this to be the case with a simple lgogdownloader --check-orphans | wc -l vs find -type f | wc -l; they differ by 1, which is expected as lgogdownloader outputs an additional header line. What's not expected is that the most primitive regex that matches everything used in the blacklist now makes all files orphans.

lgogdownloader 3.15 on Arch Linux

Sude- commented 1 month ago

$XDG_CONFIG_HOME/lgogdownloader/ignorelist.txt would be the proper file to use to make orphan check ignore files It uses the same syntax as $XDG_CONFIG_HOME/lgogdownloader/blacklist.txt

However blacklisted files shouldn't be considered orphans either so cc44c35 should fix that

mbunkus commented 1 month ago

Dang that was fast, thank you! With the new revision I get a lot of "skipped blacklisted file" messages for the files I actually want to skip. So yes, this seems to work fine now for me, too. Great!

That the ignore list would be the better place is not entirely obvious from the description of the blacklist in the man page, which states:

BLACKLIST

Allows user to specify individual files that should not be downloaded or mentioned as orphans.

I'd argue that this is pretty unambiguous. Furthermore, the whole section doesn't mention the existence of the ignore lists feature at all, further confirming that the blacklist could be used.

As a matter of fact, until you mentioned it I hadn't known about the ignore lists feature. Strange… I had only read up on "include" & "exclude" options (as those are the terms often used by other programs such as backup programs), found out that they were not what I was looking for, found the "blacklist" feature soon afterwards, and the section confirmed that I should be able to use it.

All this to say that the man page could use some work in this regard.

Anyway, like I said, it seems to work fine with the fix. So thanks again!

Sude- commented 1 month ago

Apparently that part of the man page was never updated after ignore list was added. I'll have to thoroughly check the man page at some point and update it. There's a good chance that it has more stuff that hasn't been updated.