salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

When picasa album specified, it called 'name', but really, it is regex #320

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
So, name "album" will download:
* album 
* album1
* album2
and so on.

Specifying "12.13.2004" will download
* 12.13.2004 
* 1241372004

Specifying "new folder (2)" will not download album at all.

Original issue reported on code.google.com by socketp...@gmail.com on 29 Oct 2010 at 7:17

GoogleCodeExporter commented 9 years ago
there should be two different options:
1. download by name
2. download by regex

Original comment by socketp...@gmail.com on 29 Oct 2010 at 7:17

GoogleCodeExporter commented 9 years ago
You can disable regular expressions in your config file: 
http://code.google.com/p/googlecl/wiki/ConfigurationOptions

I'd recommend expanding your usage of regular expressions, however, since this 
is a major benefit of the command line. For example, to match exactly, you can 
use "^name$" ("^" will match the beginning of the string, "$" matches the end 
of the string)

The parenthesis and periods can be escaped with a backslash: "12\.13\.2004", 
"new folder \(2\)"

There's a comprehensive list of expressions at 
http://docs.python.org/library/re.html

I'll leave this issue up in case other people want a similar feature, but I 
doubt enabling/disabling regex will be included on the command line.

Original comment by thmil...@google.com on 29 Oct 2010 at 7:29

GoogleCodeExporter commented 9 years ago
Well. suppose this scenario:
1. download list of albums
2. download albums selected by user. 

So in step 2 my script (BASH) should escape all regex-special-symbols. I think 
it is wrong API.

Also, denial of service may be used when regex used in inappropriate places.:
$ egrep 'a{100000000,}'
egrep: Memory exhausted

Original comment by socketp...@gmail.com on 29 Oct 2010 at 8:40

GoogleCodeExporter commented 9 years ago
That bash script would definitely benefit from a command line option to 
enable/disable regex. But it's still not an option very useful for most users. 
And if you really want to do a bash script, you could use sed to change the 
setting in the configuration file:

PATH_TO_CONFIG = /my/config/file
sed 's/regex = True/regex = False/' $PATH_TO_CONFIG > $PATH_TO_CONFIG

As for the inappropriate regex, the user will only be able to slow down their 
own machine -- regular expression matching is done after the query to the 
server.

Original comment by tom.h.mi...@gmail.com on 29 Oct 2010 at 9:24