GNOME Bugzilla – Bug 752611
validate:launcher: handle folder names with spaces in --medias-paths.
Last modified: 2015-08-16 13:37:24 UTC
If we pass a directory name with spaces to --medias-paths, it doesn't create the media info, but it shows that it passed, which is wrong. So first things first, returning error in this scenario.
Created attachment 307729 [details] [review] handle error cases
Review of attachment 307729 [details] [review]: OK
Heu, you need to put "quotes/when there are spaces in the name"
The reason, the folders with special characters are not being handled is we use path2url and url2path to convert the path to url in python. This converts space to %20 and similarly for other special characters And while passing it to g_file_set_contents, it is not able to handle '%20' By doing path = urllib.unquote(path) in url2path, i was able to remove '%20' and replace it with space. With this change, media_info was getting created. But, while passing the same to --set-media-info like below, gst-validate-1.0 playbin uri=file:///home/user/gst/master/11%202/garden.mp3 --set-media-info /home/user/gst/master/11 2/garden.mp3.media_info the file path is getting truncated like /home/user/gst/master/11, since there is a space after 11. So it is not able to set the media info.. gst-validate-1.0 playbin uri=file:///home/user/gst/master/11%202/garden.mp3 --set-media-info /home/user/gst/master/11%202/garden.mp3.media_info this also fails.. The only way media-info is being accepted is like below gst-validate-1.0 playbin uri=file:///home/user/gst/master/11%202/garden.mp3 --set-media-info /home/user/gst/master/11\ 2/garden.mp3.media_info So i was wondering, if there is any way to convert the special characters in python to handle this scenario
even when i use quotes there is the same problem... after some experimentation found that along with the change mentioned above "path = urllib.unquote(path) in url2path" if i replace space with "\ " then it works ok. But there needs to be some common API to do conversion for all special characters i guess right? or is there any better way to do the conversion?
gst-validate-1.0 playbin uri="file:///home/user/gst/master/11%202/garden.mp3" --set-media-info "/home/user/gst/master/11 2/garden.mp3.media_info"
Created attachment 307751 [details] [review] unquote the file path
Created attachment 307753 [details] [review] add path inside double quotes. Not exactly sure if this is proper way of adding the quotes. Please check if it is ok..
Review of attachment 307753 [details] [review]: ok
Review of attachment 307751 [details] [review]: Is it still needed if you quote?
yes... this is change is for creating the media_info file. When creating media_info file, we are using g_file_set_contents, which is not able to recognize %20 in place of space. And it fails even with double quotes.
Review of attachment 307751 [details] [review]: OK
Review of attachment 307729 [details] [review]: commit e4906c72899e485f674ce818181306875201ad92 Author: Vineeth TM <vineeth.tm@samsung.com> Date: Mon Jul 20 17:27:56 2015 +0900 validate:launcher: return on error cases properly When folder name contains spaces during --medias-paths, it does not create the media info, but still it shows as passed. Returing failed during this case https://bugzilla.gnome.org/show_bug.cgi?id=752611
Review of attachment 307751 [details] [review]: commit 074406bc2c87df79641c03ab3910789d7e35d5a0 Author: Vineeth T M <vineeth.tm@samsung.com> Date: Mon Jul 20 19:35:34 2015 +0900 validate:launcher: unquote the path to remove special characters When getting path from url using, url2path, it is returning special characters (%20 for space etc..), instead of returning plain path. path.unquote replaces the same.. https://bugzilla.gnome.org/show_bug.cgi?id=752611
Review of attachment 307753 [details] [review]: commit aa6aebe41e85f2e6b65af5af70d2ddffe0731f9a Author: Vineeth T M <vineeth.tm@samsung.com> Date: Mon Jul 20 19:37:41 2015 +0900 validate:launcher: add quotes to the file path When folder name contains space or other special characters, it fails to recognise the same and error is thrown. Adding the path inside to recognise the same https://bugzilla.gnome.org/show_bug.cgi?id=752611