eBook Previews from Calibre

Features wanted...
bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: eBook Previews from Calibre

Post by bdeshi »

instead of displaying images in a column, how about supporting more image formats other than ico as custom file icons?
Then some controlled abuse of the cfi list can fulfill jbourdon's wish.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: eBook Previews from Calibre

Post by SkyFrontier »

admin wrote:Relax, this sounds like a biggie... I have some other plans on my table...

But, sure, I'm always thankful for inspiring mockups...
SkyFrontier wrote:Adding graphic ( i.e. album cover) to MP3
Postby SkyFrontier » 10 Mar 2014 19:26

If/when CC supports thumbnail/ing.
Hope this is inspirational too... :whistle:
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

jbourdon
Posts: 12
Joined: 03 Jun 2011 20:06

Re: eBook Previews from Calibre

Post by jbourdon »

Don't know if that can help, since I know XYPlorer is coded in VB6

I coded this in C#, and use it as part of a crawler, seems to work well:

Code: Select all

public static void CrawlerProcessFile(string SourceFile)
{
    string CalibreMetaPath = @"C:\Program Files (x86)\Calibre2\ebook-meta.exe"; //const

    int Minutes = 5;
    StreamReader so;

    string SourceFileExtension = Path.GetExtension(SourceFile);

    SourceFileExtension = SourceFileExtension.ToLower();
    if((SourceFileExtension == ".azw3") ||
       (SourceFileExtension == ".azw4") ||
       (SourceFileExtension == ".epub") ||
       (SourceFileExtension == ".mobi") ||
       (SourceFileExtension == ".pdf"))
    {
        //Console.WriteLine("{0} Conversion of {1} Started", BetterClass.FormatedNow(), SourceFile);
        string SourceFilePath = Path.GetDirectoryName(SourceFile);
        string SourceFileName = Path.GetFileName(SourceFile);

        string CoverPath = SourceFilePath + "\\.XYPlorerPreviews\\";

        if(!Directory.Exists(CoverPath))
        {
            System.IO.Directory.CreateDirectory(CoverPath);
        }

        string CoverOut = CoverPath + SourceFileName + ".jpg";

        /* Execute the Calibre Command */
        var process = new Process   {StartInfo = { Arguments = string.Format("--get-cover \"{0}\" \"{1}\"", CoverOut, SourceFile) }};

        process.StartInfo.FileName = CalibreMetaPath;
        process.StartInfo.RedirectStandardOutput = true;
        process.StartInfo.UseShellExecute = false; /* So it doesn't create new consoles all the time */
        bool b = process.Start();

        so = process.StandardOutput;

        if(process.WaitForExit(1000 * 60 * Minutes)) /* Time out is in millisec */
        {
            /* Completed */
            //Console.WriteLine("{0} Conversion of {1} Completed", BetterClass.FormatedNow(), SourceFile);
        }
        else
        {
            /* Timed out */
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Conversion of {1} Timed out after {2} minutes", SourceFile, Minutes);
            //Console.WriteLine("{0} Conversion of {1} Timed out after {2} minutes", BetterClass.FormatedNow(), SourceFile, Minutes);
            Console.ResetColor();
            process.Kill();
        }

    }
}

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: eBook Previews from Calibre

Post by klownboy »

jbourdon wrote:already use mobi handler but I prefer my solution
Hi jbourdon, I haven't installed Mobi handler yet, but I'm thinking about it. I have mostly Kindle books in mobi format so I suppose it makes sense in my case. Do you get viewable thumbnails in XYplorer of the mobi files (i.e., not just in Windows Explorer)? I read somewhere if no cover art is present it will give you the first page of the book.
Thanks,
Ken

jbourdon
Posts: 12
Joined: 03 Jun 2011 20:06

Re: eBook Previews from Calibre

Post by jbourdon »

rechecked over the week-0end and mobis are thumbnailed, even in XY.

Post Reply