Make manually added animated covers work
This commit is contained in:
@@ -24,7 +24,7 @@ from time import time
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from gi.repository import Adw, Gio, GLib, Gtk
|
from gi.repository import Adw, Gio, GLib, Gtk
|
||||||
from PIL import Image
|
from PIL import Image, UnidentifiedImageError
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.errors.friendly_error import FriendlyError
|
from src.errors.friendly_error import FriendlyError
|
||||||
@@ -284,12 +284,27 @@ class DetailsWindow(Adw.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def thread_func() -> None:
|
def thread_func() -> None:
|
||||||
if new_path := convert_cover(
|
new_path = None
|
||||||
pixbuf=shared.store.managers[CoverManager].composite_cover(Path(path))
|
|
||||||
):
|
try:
|
||||||
|
with Image.open(path) as image:
|
||||||
|
if getattr(image, "is_animated", False):
|
||||||
|
new_path = convert_cover(path)
|
||||||
|
except UnidentifiedImageError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not new_path:
|
||||||
|
new_path = convert_cover(
|
||||||
|
pixbuf=shared.store.managers[CoverManager].composite_cover(
|
||||||
|
Path(path)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if new_path:
|
||||||
self.game_cover.new_cover(new_path)
|
self.game_cover.new_cover(new_path)
|
||||||
self.cover_button_delete_revealer.set_reveal_child(True)
|
self.cover_button_delete_revealer.set_reveal_child(True)
|
||||||
self.cover_changed = True
|
self.cover_changed = True
|
||||||
|
|
||||||
self.toggle_loading()
|
self.toggle_loading()
|
||||||
|
|
||||||
self.toggle_loading()
|
self.toggle_loading()
|
||||||
|
|||||||
Reference in New Issue
Block a user