Skip to content

Commit

Permalink
Ignore image in __MACOSX & .DS_Store folders inside archive.
Browse files Browse the repository at this point in the history
  • Loading branch information
maforget committed Apr 19, 2024
1 parent 77f7431 commit 93017d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ComicRack.Engine/IO/Provider/Readers/ComicProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,18 @@ protected virtual bool OnStoreInfo(ComicInfo comicInfo)
}

protected virtual bool IsSupportedImage(string file)
{
string fileExt = Path.GetExtension(FileUtility.MakeValidFilename(file));
return supportedTypes.Any((string ext) => string.Equals(fileExt, "." + ext, StringComparison.OrdinalIgnoreCase));
}
}
{
if(ShouldIgnoreFile(file))
return false;

string fileExt = Path.GetExtension(FileUtility.MakeValidFilename(file));
return supportedTypes.Any((string ext) => string.Equals(fileExt, "." + ext, StringComparison.OrdinalIgnoreCase));
}

private static bool ShouldIgnoreFile(string file)
{
string[] ignore = { ".DS_Store\\", "__MACOSX\\" };

This comment has been minimized.

Copy link
@frcooper

frcooper Apr 19, 2024

why hardcode this list?

This comment has been minimized.

Copy link
@maforget

maforget Apr 19, 2024

Author Owner

I mean how many type of folder/files do we need to ignore? What do you have in mind? I can move it to ComicRack.ini, but is there any reason to Edit it more? Ignoring some files based on name?

This comment has been minimized.

Copy link
@frcooper

frcooper Apr 19, 2024

if we can carry additional files intentionally without breaking comicrack, we have many interesting options - additional xml metadata and rendering info would be cool. (I'm trying to get a file that can be recognized as an epub AND a CBZArchive at the same time.)

This comment has been minimized.

Copy link
@maforget

maforget Apr 19, 2024

Author Owner

The program already ignores files that aren't images, this is because MAC OS will add jpg metadata files that the program will think are real images.

That option may work for your idea, but will have to be changed on a per book basis. You are better having a special ini file in the epub that will tell the program what to ignore.

But even then comics have no place in epub files. I don't know why they keep doing that. You would be better to extracts the images and create a CBZ separately. Almost all readers can read CBZ. You should also think about other reader/program.

return ignore.Any(item => file.Contains(item));
}
}
}
1 change: 1 addition & 0 deletions ComicRack/Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Community Edition Build 0.9.180:
* NEW: Quick Search (using Mode All) will now search Scan Information & Custom Fields.
* NEW: Added the Web field to smart list, so no more need to use expressions. (Again backup your DB, this could result in a corrupted database if going back to an older version)
* NEW: Added an "Is Missing" smart list entry. (Again backup your DB, this could result in a corrupted database if going back to an older version)
* NEW: "__MACOSX" & ".DS_Store" folders will be ignored inside archives.

* CHANGE: Updated to .NET Framework v4.8.
* CHANGE: Updated the Splash Screen and Renamed the Program to Community Edition, this means that a new config folder will be used %appdata%\cYo\ComicRack Community Edition.
Expand Down

0 comments on commit 93017d4

Please sign in to comment.