GNOME Bugzilla – Bug 770944
I have no Metadata options in the batch rename dialog
Last modified: 2017-02-03 09:48:50 UTC
Created attachment 334894 [details] Screenshot I donn't know why but I have no options for metadata in the rename dialog. I tried it with ogg and mp3 files. Any idea?
Are they present in tracker?
I came accross this same bug today. The files are indexed by tracker. I get the following warning when the batch rename dialog opens: ** (nautilus:13668): WARNING **: Error on batch rename tracker query cursor: Invalid arguments Thanks
I can still reproduce this with nautilus git master using jhbuild
Created attachment 342722 [details] [review] batch-rename-utilities: escape strings in the sparql query The sparql query will fail if the file name or the parent uri have a character that needs escaping. An example would be the character ' To fix this, escape the file name and the parent uri in the query.
Review of attachment 342722 [details] [review]: LGTM apart from one thing. ::: src/nautilus-batch-rename-utilities.c @@ +1070,3 @@ file = NAUTILUS_FILE (l->data); file_name = nautilus_file_get_name (file); + file_name_escaped = g_markup_escape_text (file_name, -1); My understanding is that this is cleaned up after it goes out of scope (because g_autofree attribute). file_name_escaped is declared at the function scope, so it only is cleaned up when the function returns, resulting in leaks here.
(In reply to Mohammed Sadiq from comment #2) > I came accross this same bug today. The files are indexed by tracker. > > I get the following warning when the batch rename dialog opens: > ** (nautilus:13668): WARNING **: Error on batch rename tracker query cursor: > Invalid arguments > > Thanks I couldn't reproduce this error, but I think that what's most likely to cause the problem is something going wrong with an argument of tracker:uri-is-parent, so it could be a problem with one of the files' metadata. Can you give me the steps you followed to get this error or two files for which this occurs? Thanks!
Created attachment 342723 [details] [review] batch-rename-utilities: escape strings in the sparql query The sparql query will fail if the file name or the parent uri have a character that needs escaping. An example would be the character ' To fix this, escape the file name and the parent uri in the query.
Review of attachment 342723 [details] [review]: Sure, thanks! ::: src/nautilus-batch-rename-utilities.c @@ +1036,3 @@ g_autofree gchar *parent_uri = NULL; + g_autofree gchar *parent_uri_escaped = NULL; + gchar *file_name_escaped; I can’t remember our declaration policy for the life of me - only at the function scope? Wherever? Moving file_name_escaped to the loop and slapping on the g_autofree attribute would work fine. Note to Carlos: we really need to document this someplace (maybe the HACKING file, since it needs some touching up anyway, probably).
Created attachment 342736 [details] [review] batch-rename-utilities: check if file has nie:url If there is a file indexed by tracker that doesn't have nie:url, then the query will fail everytime, because it will pass null to uri-is-parent which will then give an error. To fix this, in the query, check first that the file has nie:url.
> Note to Carlos: we really need to document this someplace (maybe the HACKING > file, since it needs some touching up anyway, probably). Oh yes, still figuring it out. The https://etherpad.gnome.org/p/nautilus had some of these to ask contributors what is preferred (you missed that videocall).
>I can’t remember our declaration policy for the life of me - only at the function scope? Wherever? At the start of any scope, since this is required for the autopointers.
Review of attachment 342736 [details] [review]: really? If the file doesn't have url attribute, then we cannot even match with it and it will disappear from the query no? Do you know when this happen?
(In reply to Carlos Soriano from comment #12) > Review of attachment 342736 [details] [review] [review]: > > really? If the file doesn't have url attribute, then we cannot even match > with it and it will disappear from the query no? > Do you know when this happen? The problem is that the files may have the attribute, but the warning is still emitted. Mohammed was working with Alex to get to the bottom of that.
Ah okay, let's wait for more info then :)
Alex, sorry I missed you. The patch indeed makes the warning go away.
Np, thanks for testing it :)
Review of attachment 342736 [details] [review]: Ok so the discussion is: a more practical example, playlists in gnome-music: both the m3u files in your fs and the playlists you create through gnome-music will be a nmm:Playlist, but only the former will additionally be a nfo:FileDataObject with a nie:url" he gave me this example csoriano alexp_: so the playlist you create in gnome-music are in tracker, but not in the fs right? alexp_ csoriano: right csoriano alexp_: and those appear in the batch renaming? and we try to get the url? is this what I don't understand alexp_ csoriano: they don't appear in the batch renaming, but the query also looks at those csoriano aha! ok let me look then alexp_: oh right makes sense thanks for explaining Therefore makes sense to me, thanks!
Attachment 342723 [details] pushed as 73ac9ee - batch-rename-utilities: escape strings in the sparql query Attachment 342736 [details] pushed as 783d816 - batch-rename-utilities: check if file has nie:url