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 749977 - videosite: Allow looking for alternative resolution scripts
videosite: Allow looking for alternative resolution scripts
Status: RESOLVED FIXED
Product: totem-pl-parser
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: totem-pl-parser-maint
totem-pl-parser-maint
Depends on:
Blocks:
 
 
Reported: 2015-05-27 15:42 UTC by Bastien Nocera
Modified: 2015-06-11 21:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
videosite: Fix URI leak (1.98 KB, patch)
2015-05-27 15:42 UTC, Bastien Nocera
committed Details | Review
videosite: Split off finding the appropriate helper script (1.83 KB, patch)
2015-05-27 15:42 UTC, Bastien Nocera
none Details | Review
videosite: Allow looking for alternative resolution scripts (2.50 KB, patch)
2015-05-27 15:42 UTC, Bastien Nocera
none Details | Review
videosite: Split off finding the appropriate helper script (2.39 KB, patch)
2015-06-10 10:01 UTC, Bastien Nocera
committed Details | Review
videosite: Allow looking for alternative resolution scripts (2.42 KB, patch)
2015-06-10 10:01 UTC, Bastien Nocera
none Details | Review
videosite: Allow looking for alternative resolution scripts (2.68 KB, patch)
2015-06-11 11:58 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2015-05-27 15:42:11 UTC
.
Comment 1 Bastien Nocera 2015-05-27 15:42:14 UTC
Created attachment 304082 [details] [review]
videosite: Fix URI leak

Make sure that "uri" is freed when exiting the function.
Comment 2 Bastien Nocera 2015-05-27 15:42:19 UTC
Created attachment 304083 [details] [review]
videosite: Split off finding the appropriate helper script

This also fixes the location of the script when building uninstalled
tests.
Comment 3 Bastien Nocera 2015-05-27 15:42:23 UTC
Created attachment 304084 [details] [review]
videosite: Allow looking for alternative resolution scripts

Third-parties are allowed to install scripts or binaries in
$(libexecdir)/totem-pl-parser/. The first script (as sorted through
strcmp()) will be chosen to resolve all possible websites.
Comment 4 Philip Withnall 2015-05-27 19:13:18 UTC
Review of attachment 304082 [details] [review]:

++
Comment 5 Philip Withnall 2015-05-27 19:14:18 UTC
Review of attachment 304083 [details] [review]:

::: plparse/totem-pl-parser-videosite.c
@@ +37,3 @@
+	return g_strdup (LIBEXECDIR "/totem-pl-parser-videosite");
+#endif
+}

This is leaked at both call sites. Why strdup() it?
Comment 6 Philip Withnall 2015-05-27 19:20:38 UTC
Review of attachment 304084 [details] [review]:

How do third parties choose which number to prefix their binary with? Aren’t they all going to go for ‘1-foo’? Where is this all documented?

::: plparse/totem-pl-parser-videosite.c
@@ +36,3 @@
 #else
+	GDir *dir;
+	GList *list = NULL;

Why build a list? Why not just assign to ret iff the value of g_dir_read_name() compares lower than the current value of ret?

@@ +46,3 @@
+	while ((name = g_dir_read_name (dir)) != NULL) {
+		if (name[0] == '.')
+			continue;

g_dir_read_name() explicitly excludes ‘.’ and ‘..’.
Comment 7 Bastien Nocera 2015-06-10 09:53:35 UTC
(In reply to Philip Withnall from comment #5)
> Review of attachment 304083 [details] [review] [review]:
> 
> ::: plparse/totem-pl-parser-videosite.c
> @@ +37,3 @@
> +	return g_strdup (LIBEXECDIR "/totem-pl-parser-videosite");
> +#endif
> +}
> 
> This is leaked at both call sites. Why strdup() it?

Because it will be variable in the subsequent commit. Fixed the leak though.
Comment 8 Bastien Nocera 2015-06-10 10:01:42 UTC
Created attachment 304931 [details] [review]
videosite: Split off finding the appropriate helper script

This also fixes the location of the script when building uninstalled
tests.
Comment 9 Bastien Nocera 2015-06-10 10:01:47 UTC
Created attachment 304932 [details] [review]
videosite: Allow looking for alternative resolution scripts

Third-parties are allowed to install scripts or binaries in
$(libexecdir)/totem-pl-parser/. The first script (as sorted through
strcmp()) will be chosen to resolve all possible websites.
Comment 10 Bastien Nocera 2015-06-10 10:02:15 UTC
(In reply to Philip Withnall from comment #6)
> Review of attachment 304084 [details] [review] [review]:
> 
> How do third parties choose which number to prefix their binary with? Aren’t
> they all going to go for ‘1-foo’?

Likely not...

> Where is this all documented?

Nowhere, internal easter egg-ish.

> ::: plparse/totem-pl-parser-videosite.c
> @@ +36,3 @@
>  #else
> +	GDir *dir;
> +	GList *list = NULL;
> 
> Why build a list? Why not just assign to ret iff the value of
> g_dir_read_name() compares lower than the current value of ret?

Yep, good idea.

> @@ +46,3 @@
> +	while ((name = g_dir_read_name (dir)) != NULL) {
> +		if (name[0] == '.')
> +			continue;
> 
> g_dir_read_name() explicitly excludes ‘.’ and ‘..’.

I also wanted to skip hidden files.
Comment 11 Philip Withnall 2015-06-10 10:27:48 UTC
Review of attachment 304931 [details] [review]:

++
Comment 12 Philip Withnall 2015-06-10 10:28:02 UTC
Review of attachment 304931 [details] [review]:

.
Comment 13 Philip Withnall 2015-06-10 10:31:10 UTC
Review of attachment 304932 [details] [review]:

::: plparse/totem-pl-parser-videosite.c
@@ +39,3 @@
+	char *ret = NULL;
+
+	dir = g_dir_open (LIBEXECDIR "/totem-pl-parser", 0, NULL);

A simple comment explaining that the first non-hidden file in the directory (by lexicographic ordering) is chosen would be quite useful.

@@ +51,3 @@
+		} else if (g_strcmp0 (name, ret) < 0) {
+			g_free (ret);
+			ret = g_strdup (name);

You could combine these two branches.
Comment 14 Bastien Nocera 2015-06-11 11:58:56 UTC
Created attachment 305070 [details] [review]
videosite: Allow looking for alternative resolution scripts

Third-parties are allowed to install scripts or binaries in
$(libexecdir)/totem-pl-parser/. The first script (as sorted through
strcmp()) will be chosen to resolve all possible websites.
Comment 15 Philip Withnall 2015-06-11 17:15:01 UTC
Review of attachment 305070 [details] [review]:

++
Comment 16 Bastien Nocera 2015-06-11 21:15:32 UTC
Attachment 304082 [details] pushed as 5c21901 - videosite: Fix URI leak
Attachment 304931 [details] pushed as b524675 - videosite: Split off finding the appropriate helper script
Attachment 305070 [details] pushed as 1147853 - videosite: Allow looking for alternative resolution scripts