richq / folders2flickr

Upload files to flickr
Other
102 stars 38 forks source link

changing imagedir without reloading fotos to flickr #13

Open MrBovert opened 10 years ago

MrBovert commented 10 years ago

Due to the large collection of fotos I have I played with different settings of "imagedir" in uploadr.ini:

  1. I set imagedir = d:\CamPics\aaa
    --> all fotos of aaa and subdirectories of aaa were loaded
  2. I changes to a sub directory imagedir = d:\CamPics\aaa\bbb
    --> all fotos of aaa\bbb were loaded again and appear twice in flickr

It seems as if the identifier in the history files contains not the full path of the image but a relative path. So the check against double loading fails when you change the starting point in the directory. I did 2 changes in uploafr.py to use the full path and to avoid the double uplaod to fickr when changing imagedir:

Line 319: old: if self.uploaded.has_key(folderTag): new: if self.uploaded.has_key(image):

Line 388: old: self.logUpload( res.photoid, folderTag ) new: self.logUpload( res.photoid, image )

Being new with python I am not sure if there are any side effects and ask myself if that patch is a good idea.

richq commented 10 years ago

Weeeellll, that's fine, but the problem I see is that it would mess up people who have already uploaded stuff and have a big history file with relative paths. I think I agree that absolute paths are probably a better solution. It's easier to retag things alread uploaded that spend your life re-uploading everything.

The whole history file thing is a pain TBH. I wish it were more transparent - right now it is a big binary blob that you can fiddle with if you use python's shelve, but it isn't very user friendly.

I am loathed to add a flag like "relative path" to the ini file, but that would be one solution. i.e. by default it is assumed to be a relative path, but if you like it can be an abs path. Although that wouldn't even help out in your case. Gah, it's tricky!!

MrBovert commented 10 years ago

A flag in the ini file would be a good solution I think. I am happy not having loaded up all my pics til now. Never trust a software you have not tested before ;-)

richq commented 10 years ago

The other flag problem is that I have uploaded photos already with this relative path, so I wouldn't really be able to well-test the absolute path solution. So it'd be likely to break.

I trust this for myself, as I've tested it for my use cases, but... you're right: software not tested is the same as software that's broken :)

MrBovert commented 10 years ago

Because I got bad tags when using absolute path I looked at the code again. There is an easyer way to introduce the absolute path and to get correct tags:

  1. Do not change line 319 and 388 as described above.
  2. Instead only change line 317:

old: folderTag = image[len(IMAGE_DIR):] new: folderTag = image

That's all but read the comments from Richard above because your directory will be lost.