Uživatelské nástroje

Nástroje pro tento web


troubleshooting:thumbnails

Toto je starší verze dokumentu!


Negenerování náhledů souborů v nautilus

  • několik dní zpět mi přestalo fungovat generování náhledů na sobubory.. takové ty náhledy na fotky, videa, atd
  • určitě to fungovalo 9.9.2017, protože z toho dne náhledy mám… později už nevím
  • dnes je 23.10, bylo provedeno několik aktualizaci… nevím která to mohla způsobit
  • zkoušel jsem založit nový systémový účet, abych vyloučil vliv mého nastavení na funkci. Chovalo se to stejně.
  • náhledy se ukládají do
    • ~/.cache/thumbnails/fail/
    • .thumbnails - asi dříve
  • pokud selže generování náhledu, tak se vytvoří soubor v podsložce fail. Je tam název programů, který se o generování pokoušel. Například ~/.cache/thumbnails/fail/gnome-thumbnail-factory. Více zde
  • do obrázku se prý vkládají další meta informace
  • gnome-thumbnail-factory je knihovna, volá thumbnails, viz description zde
  • pokusy
    • vytvořil jsem wrapper pro binárku gdk thumbnailer
      • /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer
      • jestli bude vůbec zavolán a co dostane na vstup
      • pak bych mohl debugovat ten program…. který selhal
      • binárka se vůbec nezavolala při přístupu na fotky v nautilus (ani po vymazání cache)
      • přitom v mime je minimálně image/jpeg
  • dotazy na IRC
    • Hi, after some upgrades (4 months ago) the thumbs for files are not generated. I found out that gnome-thumbnail-factory should call thumbnailers. I have tried to simple wrap gdk-pixbuf-thumbnailer and it is not execuded. I dont know why :) Only /.cache/thumbnails/fail/gnome-thumbnail-factory are created. how can i debug gnome-thumbnail-factory? or any other ideas? :)

nápady

  • vytvořit si vlastní program, co používá gnome-thumbnail-factory
    • tím bych mohl vyzkoušet, zda to funguje vůbec :D
    • našel jsem krásný python sample kód, bohužel mi ale chybí závislosti (našel jsem jen python-gnome2 balíček)
    • co to vytáhnout ze zdrojáků nautilus?
      • musel jsem doinstalovat:
        • libgnome-autoar-0-dev, libgail-3-dev, libgnome-desktop-3-dev, libgtk-3-dev, libtracker-sparql-2.0-dev, gobject-introspection
      • zasekl jsem se na závislosti, která vůbec nevím co je :D

factory sample code

  • bude to takový mix … přepsání toho python sample do c++ po vzoru nautilus :D :D
LIBS = $(shell pkg-config gnome-desktop-3.0 --libs) $(shell pkg-config gnome-vfs-2.0 --libs)
INCL = $(shell pkg-config gnome-desktop-3.0 --cflags) $(shell pkg-config gnome-vfs-2.0 --cflags)
CXXFLAGS = -O2 -g -Wall $(INCL) -DGNOME_DESKTOP_USE_UNSTABLE_API
 
OBJS = thumb-sampl3.o
TARGET = thumb-sampl3
 
$(TARGET): $(OBJS)
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
 
all: $(TARGET)
 
clean:
	rm -f $(OBJS) $(TARGET)
#include <iostream>
#include <ctime>
#include <sys/stat.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include <libgnomevfs/gnome-vfs-mime.h>
 
using namespace std;
 
int main(int argc, char **argv) {
 
  GnomeDesktopThumbnailFactory *thumbnail_factory;
  char *fpath;
  char *uri;
  time_t mtime;
  const char *mime_type;
 
  if (argc!=2) {
	  cerr << "No input file" << endl;
	  return 1;
  }
 
  fpath = argv[1];
  cerr << "filepath: " << fpath << endl;
 
  thumbnail_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
 
  if (!thumbnail_factory) {
    cerr << "cannot initialize" << endl;
    return 1;
  }
 
  cerr << "initialized with GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE set to: ";
  cerr << GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE << endl;
 
  GFile *loc;
  loc = g_file_new_for_path(fpath);
  uri = g_file_get_uri (loc);
  cerr << "uri: " << uri << endl;
 
  mime_type = gnome_vfs_mime_type_from_name(fpath);
  cerr << "mime_type: " << mime_type << endl;
 
  struct stat finfo;
  if (stat(fpath, &finfo)==0) {
	  mtime = finfo.st_mtim.tv_sec;
  } else {
	  cerr << "cannot get mtime of file" << endl;
	  return 1;
  }
 
  cerr << "mtime: " << mtime << endl;
 
  gboolean res;
  res = gnome_desktop_thumbnail_factory_can_thumbnail (thumbnail_factory,
                                                       uri,
                                                       mime_type,
                                                       mtime);
  cerr << "can thumbnail res: " << res << endl;
 
  GdkPixbuf *pixbuf;
  pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory,
                                                               uri,
                                                               mime_type);
 
  cerr << "generated pixbuf??: " << (!pixbuf==NULL) << endl;
 
  if (pixbuf) {
 
    gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory,
                                                    pixbuf,
                                                    uri,
                                                    mtime);
    cerr << "after save_thumbnail" << endl;
    g_object_unref (pixbuf);
 
  } else {
 
    //gnome_desktop_thumbnail_factory_create_failed_thumbnail (thumbnail_factory,
    //                                                         uri,
    //                                                         mtime);
    //cerr << "after create_failed_thumbnail" << endl;
 
	cerr << "calling create_failed_thumbnail skipped" << endl;
  }
 
  //g_free (mime_type);
  g_free (uri);
 
}
troubleshooting/thumbnails.1510442146.txt.gz · Poslední úprava: (upraveno mimo DokuWiki)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki