(I would have loved to use KDE's python bindings directly, but it looks like both pykde4 and pykde5 have been abandoned for years). E.g.: for the script to support generating PDF thumbnails you would have to install evince. KDE's own thumbnailers are not supported. So you will still need to have all the corresponding GNOME thumbnailer modules installed. Thumbnails are first generated through GNOME's thumbnail factory and then made compatible with KDE. The following commands should take care of all dependencies: sudo apt install gir1.2-gnomedesktop-3.0 python3-pip The script also depends on Python's pillow library which may be installed via pip. Dependenciesįor the script to work properly you will need to have the python bindings for GNOME installed. Make_thumbnail(factory, os.path.join(dirpath, filename))įactory = GnomeDesktop.DesktopThumbnailFactory()Ĭopy and paste the code section above into a new file, choose a fitting name for it (e.g. Update_name_and_meta(thumb_path, filename, mtime, mime_type, size)įor dirpath, dirnames, filenames in os.walk(folder): Thumbnail = factory.generate_thumbnail(uri, mime_type)įactory.save_thumbnail(thumbnail, uri, mtime) If not factory.can_thumbnail(uri, mime_type, mtime): If factory.lookup(uri, mtime) is not None: # Use Gio to determine the URI and mime type # uncomment this to remove GNOME thumbnails: Im.save(kde_thumb_path, "png", pnginfo=meta) Meta.add_text("Thumb::Mimetype", mime_type) Meta.add_text("Thumb::MTime", str(int(mtime))) Meta.add_itxt("Software", KDE_THUMBNAILER) Kde_thumb_path = os.path.join(thumb_dir, kde_md5 + ".png") # with the URI RFC2396 which is listed in the freedesktop specs, Print("Making thumb compatible with KDE.") KDE_THUMBNAILER = "KDE Thumbnail Generator"ĭef update_name_and_meta(thumb_path, filename, mtime, mime_type, size): # regardless of MIME type might not always work # FIXME: Hardcoding the Thumbnailer to a generic name Gi.require_version('GnomeDesktop', '3.0')įrom gi.repository import Gio, GnomeDesktop Generated through GNOME's thumbnail factory and then made compatible with KDE. You will also need to have the corresponding thumbnailers installed (e.g.Įvince-thumbnailer). Pillow can be installed with `pip install pillow` Is meant as a workaround to that issue, generating thumbnails that followĭependencies: python3 gir1.2-gnomedesktop-3.0 python-pillow Towards how to follow the XDG specs for saving thumbnails. Unfortunately there seems to be some disagreement between GNOME and KDE Largely based on a script by James Henstridge Here is the aforementioned script in its current revision: #!/usr/bin/python3 The main change I implemented is a function that updates the generated thumbnails to be recognized by KDE (by renaming them and updating the PNG metadata chunk). In order to work around this incompatibility, I ended up modifying the Python script that James Henstridge posted in the Q&A linked to above. Thumbnailer script to bridge the KDE/GNOME gap I've filed a bug report with KDE that will hopefully get this addressed eventually, but for now thumbnails generated by KDE and GNOME are sadly incompatible with each other. This is quite unfortunate since issues like these were supposed to be eliminated with the work of the Free Standards Group. So it turns out that KDE and GNOME now follow slightly different thumbnail naming and metadata conventions.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |