407
409
G_PARAM_STATIC_STRINGS));
412
* GrlSource:source-tags:
414
* A string array of tags relevant this source.
416
* The tags are arbitrary, and applications should just pass over the tags
417
* it does not understand. Applications would usually use this to either
418
* group sources together, or hide certain sources: a radio application
419
* would filter for %GRL_MEDIA_TYPE_AUDIO in GrlSource::supported-media as
420
* well as "radio" being listed in the tags.
422
* To avoid irrelevant content being listed in applications, sources
423
* such as generic video sites should not be tagged as "cinema" or
424
* "tv" as they contain a lot of content that's not either of those.
426
* This is a list of commonly used values:
428
* - "cinema", or "tv"
429
* The content served is from cinema or TV sources. For example, a
430
* source for movie trailers would select the former, a source for
431
* streaming live TV would select the latter.
434
* The content served is from streaming radios.
437
* The content served is music, for example, music stores such as
438
* Jamendo or Magnatune.
440
* - "country:country-code"
441
* The content is mostly relevant to users from a particular country,
442
* such as a national broadcaster. For example, BBC content would be
443
* tagged as "country:uk". Country codes should be an ISO-639-1 or
446
* - "protocol:protocol-name"
447
* The content browsing or searching uses a particular protocol, such
448
* as DLNA/UPnP or DMAP/DAAP. This makes it easier to whitelist or
449
* blacklist sources rather than matching the implementation specific
450
* source ID. Examples are "protocol:dlna" and "protocol:dmap".
452
* - "localhost", or "localuser"
453
* The content is served from the machine the application is running on,
454
* or by an application the user is running. Applications might choose to
455
* avoid showing the user's own data in their interfaces, or integrate it
456
* in the user's local collection.
460
g_object_class_install_property (gobject_class,
462
g_param_spec_boxed ("source-tags",
464
"String array of tags relevant this source",
468
G_PARAM_STATIC_STRINGS));
410
471
* GrlSource::content-changed:
411
472
* @source: source that has changed
412
473
* @changed_medias: (element-type GrlMedia): a #GPtrArray with the medias
435
registry_signals[SIG_CONTENT_CHANGED] =
496
source_signals[SIG_CONTENT_CHANGED] =
436
497
g_signal_new("content-changed",
437
498
G_TYPE_FROM_CLASS (gobject_class),
438
499
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
472
534
GrlSource *source = GRL_SOURCE (object);
474
536
g_clear_object (&source->priv->icon);
537
g_clear_pointer (&source->priv->tags, g_ptr_array_unref);
475
538
g_free (source->priv->id);
476
539
g_free (source->priv->name);
477
540
g_free (source->priv->desc);
483
546
set_string_property (gchar **property, const GValue *value)
548
g_clear_pointer (property, g_free);
488
549
*property = g_value_dup_string (value);
553
grl_source_set_tags (GrlSource *source,
558
g_ptr_array_set_size (source->priv->tags, 0);
562
for (i = 0; strv[i] != NULL; i++)
563
g_ptr_array_add (source->priv->tags, g_strdup (strv[i]));
564
g_ptr_array_add (source->priv->tags, NULL);
492
568
grl_source_set_property (GObject *object,
494
570
const GValue *value,
1934
2013
rrc->specs_to_invoke = g_hash_table_get_values (rrc->resolve_specs);
1935
2014
if (rrc->specs_to_invoke) {
1936
g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
1937
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2016
id = g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
2017
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2021
g_source_set_name_by_id (id, "[grilo] resolve_idle");
1942
g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
1943
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2024
id = g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
2025
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2029
g_source_set_name_by_id (id, "[grilo] resolve_all_done");
2017
2100
if (!brc->dispatcher_running) {
2018
2101
qelement = g_queue_peek_head (brc->queue);
2019
2102
if (qelement && qelement->is_ready) {
2020
g_idle_add (queue_process, brc);
2103
guint id = g_idle_add (queue_process, brc);
2104
g_source_set_name_by_id (id, "[grilo] queue_process");
2021
2105
brc->dispatcher_running = TRUE;
2133
2218
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
2134
2219
grl_operation_options_get_skip (brc->spec.browse->options),
2135
2220
grl_operation_options_get_count (brc->spec.browse->options));
2136
g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2137
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2221
id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2222
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2226
g_source_set_name_by_id (id, "[grilo] browse_idle");
2142
2228
case GRL_OP_SEARCH:
2143
2229
grl_operation_options_set_skip (brc->spec.search->options,
2148
2234
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
2149
2235
grl_operation_options_get_skip (brc->spec.search->options),
2150
2236
grl_operation_options_get_count (brc->spec.search->options));
2151
g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2152
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2237
id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2238
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2242
g_source_set_name_by_id (id, "[grilo] search_idle");
2157
2244
case GRL_OP_QUERY:
2158
2245
grl_operation_options_set_skip (brc->spec.query->options,
2163
2250
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
2164
2251
grl_operation_options_get_skip (brc->spec.query->options),
2165
2252
grl_operation_options_get_count (brc->spec.query->options));
2166
g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2167
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2253
id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
2254
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
2258
g_source_set_name_by_id (id, "[grilo] query_idle");
2173
2261
g_assert_not_reached ();
2750
2839
smrc->user_callback = callback;
2751
2840
smrc->user_data = user_data;
2753
g_idle_add (store_metadata_idle, smrc);
2842
id = g_idle_add (store_metadata_idle, smrc);
2843
g_source_set_name_by_id (id, "[grilo] store_metadata_idle");
2756
2846
static gboolean
3173
3279
/* If there are no sources able to solve just send the media */
3174
3280
if (g_list_length (sources) == 0) {
3175
3282
g_list_free (_keys);
3176
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3177
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3283
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3284
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3288
g_source_set_name_by_id (id, "[grilo] resolve_all_done");
3181
3289
return operation_id;
3206
3314
rrc->specs_to_invoke = g_hash_table_get_values (rrc->resolve_specs);
3207
3315
if (rrc->specs_to_invoke) {
3208
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3209
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3317
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3318
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3322
g_source_set_name_by_id (id, "[grilo] resolve_idle");
3214
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3215
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3325
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3326
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3330
g_source_set_name_by_id (id, "[grilo] resolve_all_done");
3221
3333
return operation_id;
3466
3579
operation_set_ongoing (source, operation_id);
3468
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3469
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3470
media_from_uri_idle,
3581
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY?
3582
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3583
media_from_uri_idle,
3586
g_source_set_name_by_id (id, "[grilo] media_from_uri_idle");
3474
3588
return operation_id;
3629
3744
operation_set_ongoing (source, operation_id);
3631
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3746
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3750
g_source_set_name_by_id (id, "[grilo] browse_idle");
3636
3752
return operation_id;
3786
3903
operation_set_ongoing (source, operation_id);
3788
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3905
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
3909
g_source_set_name_by_id (id, "[grilo] search_idle");
3793
3911
return operation_id;
3946
4065
operation_set_ongoing (source, operation_id);
3948
g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
4067
id = g_idle_add_full (flags & GRL_RESOLVE_IDLE_RELAY? G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
4071
g_source_set_name_by_id (id, "[grilo] query_idle");
3953
4073
return operation_id;