wustho / epy

CLI Ebook (epub2, epub3, fb2, mobi) Reader
GNU General Public License v3.0
962 stars 52 forks source link

image support? #24

Open autoteelar opened 3 years ago

autoteelar commented 3 years ago

is there a way to do it like how ranger does it but for cover pages

wustho commented 3 years ago

Hey there, sorry a lot going on. I think it will be supported in future, but not in short time...

autoteelar commented 3 years ago

nice! i really like this program and its features ^~^ you did a great job on it

wustho commented 3 years ago

Thanks, mate! Appreciate it. I actually tried to implement it then. Casually, by checking if my kitty terminal support displaying image. Indeed it display for a second, then flickered and the image is gone.

So I dont bother continue since I have other things going on. Maybe in future when someone else does PR or when I can commit again...

autoteelar commented 3 years ago

Thanks, mate! Appreciate it. I actually tried to implement it then. Casually, by checking if my kitty terminal support displaying image. Indeed it display for a second, then flickered and the image is gone.

So I dont bother continue since I have other things going on. Maybe in future when someone else does PR or when I can commit again...

aw, thats really cool you got it working for even a second though! i do not have much coding knowledge at all, i should get into it more so i can help out in situations like these ;v; i hope the other things you are busyt with aswell goes well ^~^

SlidingHorn commented 3 years ago

Thanks, mate! Appreciate it. I actually tried to implement it then. Casually, by checking if my kitty terminal support displaying image. Indeed it display for a second, then flickered and the image is gone.

So I dont bother continue since I have other things going on. Maybe in future when someone else does PR or when I can commit again...

If I could offer a suggestion:

Maybe instead of trying to render it inline within the terminal (e.g. via w3m or whatever other method), you could just have links as placeholders that will use xdg-open to open the image in the user's preferred image viewer.

Just a thought! I just installed epy earlier today, and I'm loving it so far.

wustho commented 3 years ago

@SlidingHorn hold up, epy and https://github.com/wustho/epr already support image like you suggested, mate

As you can read in epr documentation https://github.com/wustho/epr#opening-an-image

SlidingHorn commented 3 years ago

@SlidingHorn hold up, epy and https://github.com/wustho/epr already support image like you suggested, mate

As you can read in epr documentation https://github.com/wustho/epr#opening-an-image

I didn't know that! I'm golden then, lol

lxhom commented 2 years ago

Hej, just a small thing that could be implemented pretty easily: I use the terminal kitty, and I wrote a small patch which for open_media displays the images in the terminal:

def open_media(scr, name, bstr):
    sfx = os.path.splitext(name)[1]
    fd, path = tempfile.mkstemp(suffix=sfx)
    try:
        with os.fdopen(fd, "wb") as tmp:
            # tmp.write(epub.file.read(src))
            tmp.write(bstr)
        # run(VWR + " " + path, shell=True)
        subprocess.call(
+           "kitty +kitten icat --silent " + path,
            shell=True,
+ #          stdout=subprocess.DEVNULL,
+ #          stderr=subprocess.DEVNULL
        )
        k = scr.getch()
    finally:
        os.remove(path)
    return k

Works perfectly, you could add a --kitty option to enable this if you want to add it :)

autoteelar commented 2 years ago

nice! will try it

On Wed, Sep 15, 2021 at 5:43 AM lxhom @.***> wrote:

Hej, just a small thing that could be implemented pretty easily: I use the terminal kitty, and I wrote a small patch which for open_media displays the images in the terminal:

def open_media(scr, name, bstr): sfx = os.path.splitext(name)[1] fd, path = tempfile.mkstemp(suffix=sfx) try: with os.fdopen(fd, "wb") as tmp:

tmp.write(epub.file.read(src))

        tmp.write(bstr)
    # run(VWR + " " + path, shell=True)
    subprocess.call(+           "kitty +kitten icat --silent " + path,
        shell=True,+ #          stdout=subprocess.DEVNULL,+ #          stderr=subprocess.DEVNULL
    )
    k = scr.getch()
finally:
    os.remove(path)
return k

Works perfectly, you could add a --kitty option to enable this if you want to add it :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wustho/epy/issues/24#issuecomment-919865790, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJQXMMWGK57JVV6DZLQJVLUCBTC7ANCNFSM44RUUKGA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.