Page 2 of 2

Re: eBook Previews from Calibre

Posted: 01 Sep 2015 20:03
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.

Re: eBook Previews from Calibre

Posted: 01 Sep 2015 22:21
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:

Re: eBook Previews from Calibre

Posted: 02 Sep 2015 13:14
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();
        }

    }
}

Re: eBook Previews from Calibre

Posted: 02 Sep 2015 13:19
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

Re: eBook Previews from Calibre

Posted: 07 Sep 2015 11:59
by jbourdon
rechecked over the week-0end and mobis are thumbnailed, even in XY.