summaryrefslogtreecommitdiff
path: root/src/tracker/grl-tracker-utils.h
blob: 41bd232d56b96ea79da2594064c2bbe512102be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * Copyright (C) 2011 Igalia S.L.
 * Copyright (C) 2011 Intel Corporation.
 *
 * Contact: Iago Toral Quiroga <itoral@igalia.com>
 *
 * Authors: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef _GRL_TRACKER_UTILS_H_
#define _GRL_TRACKER_UTILS_H_

#include "grl-tracker-source-priv.h"

/* ------- Definitions ------- */

#define RDF_TYPE_ALBUM     "nmm#MusicAlbum"
#define RDF_TYPE_ARTIST    "nmm#Artist"
#define RDF_TYPE_AUDIO     "nfo#Audio"
#define RDF_TYPE_MUSIC     "nmm#MusicPiece"
#define RDF_TYPE_IMAGE     "nmm#Photo"
#define RDF_TYPE_VIDEO     "nmm#Video"
#define RDF_TYPE_FOLDER    "nfo#Folder"
#define RDF_TYPE_DOCUMENT  "nfo#Document"
#define RDF_TYPE_CONTAINER "grilo#Container"

#define RDF_TYPE_VOLUME "tracker#Volume"
#define RDF_TYPE_UPNP   "upnp#ContentDirectory"

/**/

typedef void (*tracker_grl_sparql_setter_cb_t) (TrackerSparqlCursor *cursor,
                                                gint                 column,
                                                GrlMedia            *media,
                                                GrlKeyID             key);

typedef struct {
  GrlKeyID     grl_key;
  const gchar *sparql_key_name;
  const gchar *sparql_key_name_canon;
  const gchar *sparql_key_attr;
  const gchar *sparql_key_attr_call;
  const gchar *sparql_key_flavor;

  tracker_grl_sparql_setter_cb_t set_value;
} tracker_grl_sparql_t;

extern GrlKeyID grl_metadata_key_tracker_urn;

const GList *grl_tracker_supported_keys (GrlSource *source);

gboolean grl_tracker_key_is_supported (const GrlKeyID key);

void grl_tracker_setup_key_mappings (void);

tracker_grl_sparql_t *grl_tracker_get_mapping_from_sparql (const gchar *key);

GrlMedia *grl_tracker_build_grilo_media (const gchar *rdf_type);

gchar *grl_tracker_source_get_device_constraint (GrlTrackerSourcePriv *priv);

gchar *grl_tracker_source_get_select_string (const GList *keys);

gchar *grl_tracker_tracker_get_insert_string (GrlMedia *media,
                                              const GList *keys);

gchar *grl_tracker_get_delete_string (const GList *keys);

gchar *grl_tracker_get_delete_conditional_string (const gchar *urn,
                                                  const GList *keys);

gchar *grl_tracker_get_source_name (const gchar *rdf_type,
                                    const gchar *uri,
                                    const gchar *datasource,
                                    const gchar *datasource_name);

#endif /* _GRL_TRACKER_UTILS_H_ */