After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740871 - opensubtitles: Add plugin
opensubtitles: Add plugin
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
unspecified
Other All
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2014-11-28 18:08 UTC by Bastien Nocera
Modified: 2014-12-08 22:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
opensubtitles: Add plugin (26.44 KB, patch)
2014-11-28 18:08 UTC, Bastien Nocera
none Details | Review
opensubtitles: Add plugin (26.78 KB, patch)
2014-11-28 19:57 UTC, Bastien Nocera
none Details | Review
opensubtitles: Add plugin (26.82 KB, patch)
2014-11-30 16:03 UTC, Bastien Nocera
reviewed Details | Review
opensubtitles: Add plugin (27.84 KB, patch)
2014-12-05 17:27 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-11-28 18:08:14 UTC
.
Comment 1 Bastien Nocera 2014-11-28 18:08:28 UTC
Created attachment 291742 [details] [review]
opensubtitles: Add plugin

Add a plugin that will get a list of available subtitles available
for a video, given its gibest hash.
Comment 2 Bastien Nocera 2014-11-28 19:57:02 UTC
Created attachment 291751 [details] [review]
opensubtitles: Add plugin

Add a plugin that will get a list of available subtitles available
for a video, given its gibest hash.
Comment 3 Bastien Nocera 2014-11-30 16:03:48 UTC
Created attachment 291833 [details] [review]
opensubtitles: Add plugin

Add a plugin that will get a list of available subtitles available
for a video, given its gibest hash.
Comment 4 Juan A. Suarez Romero 2014-12-02 16:16:51 UTC
Review of attachment 291833 [details] [review]:

Some comments.

::: src/Makefile.am
@@ +118,3 @@
    apple-trailers bliptv bookmarks dleyna dmap filesystem flickr freebox gravatar jamendo \
    lastfm-albumart local-metadata lua-factory magnatune metadata-store optical-media   \
+   pocket podcasts raitv shoutcast thetvdb tmdb tracker vimeo youtube opensubtitles

Could you sort it?

::: src/opensubtitles/Makefile.am
@@ +4,3 @@
+# Author: Guillaume Emont <gemont@igalia.com>
+#
+# Copyright (C) 2010-2011 Igalia S.L. All rights reserved.

Fix header. You should be the author.

::: src/opensubtitles/grl-opensubtitles.c
@@ +445,3 @@
+    parse_results (rs->media, msg);
+
+  rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);

In case of errors, shouldn't we send a GError?

@@ +493,3 @@
+  while ((rs = g_async_queue_try_pop (priv->queue))) {
+    if (failed) {
+      rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);

If failed, shouldn't we send a GError?

@@ +512,3 @@
+  static GList *keys = NULL;
+  if (!keys) {
+    keys = grl_metadata_key_list_new (GRL_OPENSUBTITLES_METADATA_KEY_SUBTITLES_URL,

Shouldn't add also GRL_OPENSUBTITLES_METADATA_KEY_SUBTITLES_LANG?

@@ +519,3 @@
+
+static void
+ensure_hash_keyid (GrlOpenSubtitlesSourcePriv *priv)

This is not part of the API. Should be moved to above "utilities" section

@@ +551,3 @@
+  if (!grl_data_has_key (GRL_DATA (media), priv->hash_keyid))
+    return FALSE;
+

If it doesn't contain key, but missing_keys is not NULL, we need to add that key in missing_keys, to inform that we can't resolve due missing that key.

@@ +598,3 @@
+  msg = new_search_message (priv->token,
+                            grl_data_get_string (GRL_DATA (rs->media), priv->hash_keyid),
+                            grl_media_get_size (rs->media));

If we require size to compute get the subtitle, we should add that key in the list of required keys, in may_resolve.
Comment 5 Bastien Nocera 2014-12-05 17:26:56 UTC
(In reply to comment #4)
> Review of attachment 291833 [details] [review]:
> 
> Some comments.
> 
> ::: src/Makefile.am
> @@ +118,3 @@
>     apple-trailers bliptv bookmarks dleyna dmap filesystem flickr freebox
> gravatar jamendo \
>     lastfm-albumart local-metadata lua-factory magnatune metadata-store
> optical-media   \
> +   pocket podcasts raitv shoutcast thetvdb tmdb tracker vimeo youtube
> opensubtitles
> 
> Could you sort it?

Done.

> ::: src/opensubtitles/Makefile.am
> @@ +4,3 @@
> +# Author: Guillaume Emont <gemont@igalia.com>
> +#
> +# Copyright (C) 2010-2011 Igalia S.L. All rights reserved.
> 
> Fix header. You should be the author.

I just removed it. I haven't seen anyone use copyrights for Makefiles in any project I've been working on.

> ::: src/opensubtitles/grl-opensubtitles.c
> @@ +445,3 @@
> +    parse_results (rs->media, msg);
> +
> +  rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);
> 
> In case of errors, shouldn't we send a GError?

Sure, done.

> @@ +493,3 @@
> +  while ((rs = g_async_queue_try_pop (priv->queue))) {
> +    if (failed) {
> +      rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data,
> NULL);
> 
> If failed, shouldn't we send a GError?

Fixed.

> @@ +512,3 @@
> +  static GList *keys = NULL;
> +  if (!keys) {
> +    keys = grl_metadata_key_list_new
> (GRL_OPENSUBTITLES_METADATA_KEY_SUBTITLES_URL,
> 
> Shouldn't add also GRL_OPENSUBTITLES_METADATA_KEY_SUBTITLES_LANG?

Done.

> @@ +519,3 @@
> +
> +static void
> +ensure_hash_keyid (GrlOpenSubtitlesSourcePriv *priv)
> 
> This is not part of the API. Should be moved to above "utilities" section

Merging the register_keys patches would fix that problem...

> @@ +551,3 @@
> +  if (!grl_data_has_key (GRL_DATA (media), priv->hash_keyid))
> +    return FALSE;
> +
> 
> If it doesn't contain key, but missing_keys is not NULL, we need to add that
> key in missing_keys, to inform that we can't resolve due missing that key.

Done.

> @@ +598,3 @@
> +  msg = new_search_message (priv->token,
> +                            grl_data_get_string (GRL_DATA (rs->media),
> priv->hash_keyid),
> +                            grl_media_get_size (rs->media));
> 
> If we require size to compute get the subtitle, we should add that key in the
> list of required keys, in may_resolve.

Done.
Comment 6 Bastien Nocera 2014-12-05 17:27:16 UTC
Created attachment 292208 [details] [review]
opensubtitles: Add plugin

Add a plugin that will get a list of available subtitles available
for a video, given its gibest hash.
Comment 7 Juan A. Suarez Romero 2014-12-08 21:00:33 UTC
Review of attachment 292208 [details] [review]:

Nice!
Comment 8 Bastien Nocera 2014-12-08 22:49:51 UTC
Attachment 292208 [details] pushed as 5a96850 - opensubtitles: Add plugin