Tuba icon indicating copy to clipboard operation
Tuba copied to clipboard

feat(clapper): prepare for 0.10

Open GeopJr opened this issue 11 months ago • 7 comments

fix: #1431

GeopJr avatar May 23 '25 05:05 GeopJr

extra_data_lists_value

Ohhh, I didn't read the description, I just assumed it would only check the whole value and not treat them as a list, so I dismissed it instantly 😔... Much better than splitting and all!


It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'.

E.g.

"https", "youtube.com": passed "peertube", null: failed

Keep that in memory and next time those combinations of scheme and host are checked, instantly return whether it's supported from memory instead of checking all plugins again

GeopJr avatar May 23 '25 09:05 GeopJr

It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'.

I thought about this too, but unsure how much of a boost you would get here to be worth it. These strings are read during init, then stored in enhancer proxy object, so there is no string dup/free going on. Just saving the amount of time it takes to iterate (currently) up to 3 elements array.

Rafostar avatar May 23 '25 14:05 Rafostar

In regards of MPRIS moving to enhancers, is there anything I should do here?

GeopJr avatar Jul 12 '25 05:07 GeopJr

In regards of MPRIS moving to enhancers, is there anything I should do here?

Built-in ClapperFeature objects are on their deprecation way in favour of being re-implemented as enhancer plugins. This work is currently still ongoing, so APIs for that are still subject to change. I am trying to keep compatibility, so even if your app does not update from using old (now deprecated) implementation it should still work.

Rafostar avatar Jul 12 '25 10:07 Rafostar

Currently something like this:

#if CLAPPER_HAVE_MPRIS
  ClapperFeature *feature = CLAPPER_FEATURE (clapper_mpris_new (
      mpris_name, APP_NAME, APP_ID));
  clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
  clapper_player_add_feature (player, feature);
  gst_object_unref (feature);
#endif

Becomes this:

ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player);
ClapperEnhancerProxy *proxy;

/* Check if MPRIS enhancer is available */
if ((proxy = clapper_enhancer_proxy_list_get_proxy_by_module (proxies, "clapper-mpris"))) {
  /* Allow instances of this proxy target to be created as needed (enable this enhancer) */
  clapper_enhancer_proxy_set_target_creation_allowed (proxy, TRUE);
  
  /* Configure application scope properties */
  clapper_enhancer_proxy_set_locally (proxy,
      "own-name", mpris_name,
      "identity", APP_NAME,
      "desktop-entry", APP_ID,
      "queue-controllable", TRUE, NULL);

  gst_object_unref (proxy);
}

Optionally, an else can be added to new code with first example code for app to remain compatible with both implementations.

I also imagine that once this goes live, you might want to build clapper without mpris meson option in your Flathub manifest, since you are gonna get mpris from enhancers extension.

I have yet to test whether bindings (including VALA) for that work correctly.

Rafostar avatar Jul 12 '25 10:07 Rafostar

Sounds good to me and it makes sense to move it to enhancers! I'll add this to this PR eventually, after all this is a draft for 0.10 / I expect API changes :)

GeopJr avatar Jul 12 '25 10:07 GeopJr

I expect API changes :)

Just dropping here links to migration guide(s) in case you ever decide to continue with this PR. No rush. Even with latest Clapper version, Tuba still compiles cleanly (only deprecations warnings). Cheers.

Rafostar avatar Jan 05 '26 16:01 Rafostar