Product SiteDocumentation Site

Chapter 4. Services

4.1. Screenshot service
AppStream provides some services to fetch additional data from.

4.1. Screenshot service

4.1.1. Introduction

To make give users an impression on how the application they are about to install will look like, screenshots are provided to software-centers via a web service.

4.1.2. Webservice

Distributors provide a service like debshots. They can either use the original debshots service, which does not only work for Debian but also any other distribution, or they can set up their own service which mimicks the debshots API.
In future, it is planned to allow applications to specify own screenshots via their AppData files.
In order to make a new screenshot service known to software-centers, distributors need to place information about their webservice in the config file of libappstream, whis is usually located at /etc/appstream.conf.

4.1.3. Client API

Software center applications can access the screenshot service either directly, or via the libappstream API. Simple example:
#include <glib.h>
#include <appstream.h>

gchar* get_screenshot_url (const gchar* pkgname, gboolean thumbnail) {
    AppstreamScreenshotService *scrservice;
    gchar *url;

    scrservice = appstream_screenshot_service_new ();
    if (thumbnail)
        /* return URL of a screenshot thumbnail */
        url = appstream_screenshot_service_get_thumbnail_url (scrservice, pkgname);
        /* return URL of the full screenshot */
        url = appstream_screenshot_service_get_screenshot_url (scrservice, pkgname);
    g_object_unref (scrservice);

    return url;