GNOME Bugzilla – Bug 706877
Let TheMovieDb resolver perform searches based on file name
Last modified: 2014-03-28 09:26:31 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.
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.
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.
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.
(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.
Created attachment 267370 [details] [review] core: Add "title-guessed-from-filename" property So that we know to overwrite it when resolving a new title.
Created attachment 267371 [details] [review] pls: Use new "title-guessed-from-filename" property
Created attachment 267372 [details] [review] tracker: Use new "title-guessed-from-filename" property
Created attachment 267380 [details] [review] tmdb: Override title when set from filename
local-metadata should probably unset the flag when the actual title is changed.
Created attachment 273114 [details] [review] core: Add "title-guessed-from-filename" property So that we know to overwrite it when resolving a new title.
Created attachment 273115 [details] [review] local-metadata: Override title when set from filename And add test to that effect.
*** Bug 725408 has been marked as a duplicate of this bug. ***
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
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.
Created attachment 273146 [details] [review] pls: Use new "title-from-filename" property
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
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.
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
Created attachment 273149 [details] [review] tracker: Use new "title-from-filename" property
Created attachment 273150 [details] [review] tmdb: Override title when set from filename
Created attachment 273151 [details] [review] local-metadata: Override title when set from filename And add test to that effect.
Review of attachment 273146 [details] [review]: Good looks.
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.
Review of attachment 273149 [details] [review]: Looks good
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
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....
Created attachment 273154 [details] [review] tracker: Use new "title-from-filename" property
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