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 706877 - Let TheMovieDb resolver perform searches based on file name
Let TheMovieDb resolver perform searches based on file name
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
0.2.x
Other Linux
: Normal enhancement
: ---
Assigned To: grilo-maint
grilo-maint
: 725408 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-08-27 10:22 UTC by James Henstridge
Modified: 2014-03-28 09:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Add "title-guessed-from-filename" property (2.03 KB, patch)
2014-01-28 00:50 UTC, Bastien Nocera
none Details | Review
pls: Use new "title-guessed-from-filename" property (1.03 KB, patch)
2014-01-28 00:50 UTC, Bastien Nocera
needs-work Details | Review
tracker: Use new "title-guessed-from-filename" property (1.82 KB, patch)
2014-01-28 00:51 UTC, Bastien Nocera
none Details | Review
tmdb: Override title when set from filename (1.05 KB, patch)
2014-01-28 07:21 UTC, Bastien Nocera
none Details | Review
core: Add "title-guessed-from-filename" property (2.03 KB, patch)
2014-03-27 21:22 UTC, Bastien Nocera
needs-work Details | Review
local-metadata: Override title when set from filename (4.54 KB, patch)
2014-03-27 21:23 UTC, Bastien Nocera
none Details | Review
core: Add "title-from-filename" property (2.05 KB, patch)
2014-03-28 08:50 UTC, Bastien Nocera
none Details | Review
pls: Use new "title-from-filename" property (1.07 KB, patch)
2014-03-28 08:50 UTC, Bastien Nocera
committed Details | Review
core: Add "title-from-filename" property (2.46 KB, patch)
2014-03-28 08:55 UTC, Bastien Nocera
needs-work Details | Review
tracker: Use new "title-from-filename" property (1.80 KB, patch)
2014-03-28 08:58 UTC, Bastien Nocera
accepted-commit_now Details | Review
tmdb: Override title when set from filename (1.04 KB, patch)
2014-03-28 08:58 UTC, Bastien Nocera
committed Details | Review
local-metadata: Override title when set from filename (4.51 KB, patch)
2014-03-28 08:58 UTC, Bastien Nocera
committed Details | Review
core: Add "title-from-filename" property (2.39 KB, patch)
2014-03-28 09:02 UTC, Bastien Nocera
committed Details | Review
tracker: Use new "title-from-filename" property (2.66 KB, patch)
2014-03-28 09:22 UTC, Bastien Nocera
committed Details | Review

Description James Henstridge 2013-08-27 10:22:11 UTC
I have some code using the grl-tmdb plugin to resolve the title and other metadata about videos without embedded metadata using the multi-step process described here:

http://taschenorakel.de/mathias/2012/12/21/tmdb-grilo-mock-testing/

In short:

 1. Create a GrlMedia with the title set from the file name.
 2. Resolve the tmdb-id property on the media.
 3. If that succeeds, clear the title from the GrlMedia and repeat to get
    the title and the rest of the metadata.

This seems a bit wasteful, since TheMovieDb provides us a clean title in the initial search.

I understand that it doesn't overwrite the title because resolvers are not meant to alter existing metadata, but in this case I never really had a title to start with: I just created one so the plugin had something to search with.

One way around this would be to let the plugin itself use the filename for searches.  I can easily provide this through the URL field on the GrlMedia, and that way the plugin would know that it is safe to set the title.
Comment 1 Juan A. Suarez Romero 2013-08-29 16:57:06 UTC
The idea behind your proposal was discussed with Mathias too, and I think it makes sense: a way of allowing sources to "improve" the quality of metadata provided by other sources.

So if a source (like Filesystem) is returning content with a value in , let's say title, and another source (like TMDb) says the title is different, and the later seems more confident than former, use that value instead.

The fix should be generic, and should be fixed in the core. But I don't like your approach of using the url/filename. We are using the title for the matching, and even so, there are  lot of false positives. The ideal key is tmdb-id, but of course its hard to have that value.

I know that what the tmdb mock test does is a workaround, but using the filename is very hackish too, and very likely will leave to more problems, like matches when you don't want too.

As said, we need a generic way of fixing the underlaying problem, and I have some ideas to try, but the proposal isn't the way I'd like to.
Comment 2 James Henstridge 2013-08-30 03:11:58 UTC
Right.  I understand that tmdb-id or title are better starting points for a search: I was thinking of the case where neither of those are available.

Rather than having each user of the plugin come up with its own way of synthesising a title from the file name, the plugin could handle it.  XBMC's themoviedb based scraper seems to get decent results most of the time, so presumably it wouldn't be that difficult to provide decent results.
Comment 3 Juan A. Suarez Romero 2013-08-30 07:27:26 UTC
Didn't check XBMC plugin. If it works pretty decently with the filename/URL, and we can use the same algorithm, we can try it.
Comment 4 Bastien Nocera 2014-01-28 00:03:16 UTC
(In reply to comment #0)
> This seems a bit wasteful, since TheMovieDb provides us a clean title in the
> initial search.

Well. If you want your titles "English-ified", it's cleaner. But I'd like to see "Le fabuleux destin d'Amélie Poulain" instead of just "Amélie", or "Rennt Lola Rennt" instead of "Run Lola Run".

> I understand that it doesn't overwrite the title because resolvers are not
> meant to alter existing metadata, but in this case I never really had a title
> to start with: I just created one so the plugin had something to search with.

This wouldn't really fix it. A large number of the source will create titles with the best data they have around. The filesystem plugin will try to strip suffixes, the local-metadata will also clean it up removing blacklisted suffixes.

> One way around this would be to let the plugin itself use the filename for
> searches.  I can easily provide this through the URL field on the GrlMedia, and
> that way the plugin would know that it is safe to set the title.

This is also probably very source specific. You don't want to use the filenames for UPnP URLs, but will want to for the filesystem or (in some cases) Tracker.

Maybe we could add a "title-guessed-from-filename" property, and add the filename based lookup to the tmdb plugin? It would override the title if title-guessed-from-filename is TRUE.
Comment 5 Bastien Nocera 2014-01-28 00:50:48 UTC
Created attachment 267370 [details] [review]
core: Add "title-guessed-from-filename" property

So that we know to overwrite it when resolving a new title.
Comment 6 Bastien Nocera 2014-01-28 00:50:52 UTC
Created attachment 267371 [details] [review]
pls: Use new "title-guessed-from-filename" property
Comment 7 Bastien Nocera 2014-01-28 00:51:15 UTC
Created attachment 267372 [details] [review]
tracker: Use new "title-guessed-from-filename" property
Comment 8 Bastien Nocera 2014-01-28 07:21:44 UTC
Created attachment 267380 [details] [review]
tmdb: Override title when set from filename
Comment 9 Bastien Nocera 2014-01-28 08:55:51 UTC
local-metadata should probably unset the flag when the actual title is changed.
Comment 10 Bastien Nocera 2014-03-27 21:22:58 UTC
Created attachment 273114 [details] [review]
core: Add "title-guessed-from-filename" property

So that we know to overwrite it when resolving a new title.
Comment 11 Bastien Nocera 2014-03-27 21:23:59 UTC
Created attachment 273115 [details] [review]
local-metadata: Override title when set from filename

And add test to that effect.
Comment 12 Bastien Nocera 2014-03-27 21:24:30 UTC
*** Bug 725408 has been marked as a duplicate of this bug. ***
Comment 13 Juan A. Suarez Romero 2014-03-28 08:48:46 UTC
Review of attachment 267371 [details] [review]:

::: libs/pls/grl-pls.c
@@ +1267,2 @@
     grl_media_set_title (media, str);
+    grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_GUESSED_FROM_FILENAME, TRUE);

Let's rename to GRL_METADATA_KEY_TITLE_FROM_FILENAME

@@ +1309,3 @@
 
+    grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_GUESSED_FROM_FILENAME, TRUE);
+

Ditto
Comment 14 Bastien Nocera 2014-03-28 08:50:01 UTC
Created attachment 273145 [details] [review]
core: Add "title-from-filename" property

When the title is guessed from the filename, so that we know to
overwrite it when resolving a new title.
Comment 15 Bastien Nocera 2014-03-28 08:50:06 UTC
Created attachment 273146 [details] [review]
pls: Use new "title-from-filename" property
Comment 16 Juan A. Suarez Romero 2014-03-28 08:52:02 UTC
Review of attachment 273114 [details] [review]:

Also, add a relation between GRL_METADATA_KEY_TITLE_FROM_FILENAME and GRL_METADATA_KEY_TITLE, because both are related.

::: src/grl-metadata-key.c
@@ +529,3 @@
+                                                                   G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
+                                             GRL_METADATA_KEY_TITLE_GUESSED_FROM_FILENAME,
+                                             NULL);

Let's reduce the key name, and use GRL_METADATA_KEY_TITLE_FROM_FILENAME / "title-from-filename"

::: src/grl-metadata-key.h
@@ +98,3 @@
 #define GRL_METADATA_KEY_ORIGINAL_TITLE       49
 #define GRL_METADATA_KEY_SIZE                 50
+#define GRL_METADATA_KEY_TITLE_GUESSED_FROM_FILENAME 51

GRL_METADATA_KEY_TITLE_FROM_FILENAME
Comment 17 Bastien Nocera 2014-03-28 08:55:33 UTC
Created attachment 273147 [details] [review]
core: Add "title-from-filename" property

When the title is guessed from the filename, so that we know to
overwrite it when resolving a new title.
Comment 18 Juan A. Suarez Romero 2014-03-28 08:58:20 UTC
Review of attachment 273147 [details] [review]:

::: src/grl-metadata-key.c
@@ +539,3 @@
                                                GRL_METADATA_KEY_MIME);
   grl_registry_register_metadata_key_relation (registry,
                                                GRL_METADATA_KEY_URL,

We need to create a relation between GRL_METADATA_KEY_TITLE and GRL_METADATA_KEY_TITLE_FROM_FILENAME
Comment 19 Bastien Nocera 2014-03-28 08:58:50 UTC
Created attachment 273149 [details] [review]
tracker: Use new "title-from-filename" property
Comment 20 Bastien Nocera 2014-03-28 08:58:54 UTC
Created attachment 273150 [details] [review]
tmdb: Override title when set from filename
Comment 21 Bastien Nocera 2014-03-28 08:58:58 UTC
Created attachment 273151 [details] [review]
local-metadata: Override title when set from filename

And add test to that effect.
Comment 22 Juan A. Suarez Romero 2014-03-28 08:59:10 UTC
Review of attachment 273146 [details] [review]:

Good looks.
Comment 23 Bastien Nocera 2014-03-28 09:02:59 UTC
Created attachment 273152 [details] [review]
core: Add "title-from-filename" property

When the title is guessed from the filename, so that we know to
overwrite it when resolving a new title.
Comment 24 Juan A. Suarez Romero 2014-03-28 09:03:13 UTC
Review of attachment 273149 [details] [review]:

Looks good
Comment 25 Bastien Nocera 2014-03-28 09:09:33 UTC
Attachment 273146 [details] pushed as 8bf3a62 - pls: Use new "title-from-filename" property
Attachment 273152 [details] pushed as f037119 - core: Add "title-from-filename" property
Comment 26 Juan A. Suarez Romero 2014-03-28 09:09:41 UTC
Review of attachment 273150 [details] [review]:

::: src/tmdb/grl-tmdb.c
@@ +1007,3 @@
+      g_value_unset (value);
+      g_free (value);
+    }

Shouldn't you update also TITLE_FROM_FILENAME? Because from now own, title is not guessed from filename anymore....
Comment 27 Bastien Nocera 2014-03-28 09:22:19 UTC
Created attachment 273154 [details] [review]
tracker: Use new "title-from-filename" property
Comment 28 Bastien Nocera 2014-03-28 09:26:19 UTC
Attachment 273150 [details] pushed as 1761f13 - tmdb: Override title when set from filename
Attachment 273151 [details] pushed as 32eb153 - local-metadata: Override title when set from filename
Attachment 273154 [details] pushed as 4ab87ad - tracker: Use new "title-from-filename" property