pkolarov / folders2flickr

Automatically exported from code.google.com/p/folders2flickr
7 stars 2 forks source link

Tag name incorrect when there's a space #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If folder name is "pictures\home 2008\images 02\img202.jpg"

the tags shows
home, 2008\images, 02\img202.jpg

It's supposed to show
home 2008, images 02, img202.jpg

here's the fix
add this to line 307
folderTag = "\"" + string.strip(folderTag.replace('\\','" "')) + "\""

Original issue reported on code.google.com by lim...@gmail.com on 15 Jul 2010 at 10:58

GoogleCodeExporter commented 9 years ago
Fixing this issue may break more things than it will fix. Plus searching in 
photostream with these tags should not be an issue using Fulltext search. 
May be another set of tags could be created with the \ being delimiter leaving 
original still there (e.g. for people who already have things uploaded it would 
break compatibility )

Original comment by pkola...@gmail.com on 21 Jul 2010 at 11:56

GoogleCodeExporter commented 9 years ago
how about something like this?

folderTag = image[len(IMAGE_DIR):]
historyPath = image[len(IMAGE_DIR):]
folderTag = "\"" + string.strip(folderTag.replace('\\','" "')) + "\""

if ( not self.uploaded.has_key( historyPath ) ):

self.logUpload( res.photoid, historyPath )

Original comment by lim...@gmail.com on 21 Jul 2010 at 10:25

GoogleCodeExporter commented 9 years ago
and when you use flickr2history

it'll check both types of tags.

    tags=tag.split()
     #remove multiple whitespaces,and  "and","in","at","a","the","of","an", "&" etc.
    tags = removeTags(tags)
    out=string.join(tags,",")
    retries = 0
    photos = None
    while (retries < 3):
        try:
                logging.debug(user.id)
                photos = flickr.photos_search(user_id=user.id, auth=all, tags=out,tag_mode='all')
                break
        except:
                logging.error("Flickr error while searching ....retrying")
                logging.error(sys.exc_info()[0])

        retries = retries + 1
    if (not photos or len(photos) == 0):
        tags=tag.split('\\')
        tags = removeTags(tags)
        out=string.join(tags[1:],",")
        retries = 0
        while (retries < 3):
            try:
                    logging.debug(user.id)
                    photos = flickr.photos_search(user_id=user.id, tags=out,tag_mode='all')
                    break
            except:
                    logging.error("Flickr error while searching ....retrying")
                    logging.error(sys.exc_info()[0])

            retries = retries + 1

Original comment by lim...@gmail.com on 22 Jul 2010 at 6:39

GoogleCodeExporter commented 9 years ago
OK, new version fixes this with. The resulting tags for your example 
("pictures\home 2008\images 02\img202.jpg") will be:
pictures, home, 2008, images, 02, img202, jpg, 
#pictures\home#2008\images#02\img202.jpg

This seemed to me a a best compromise. The last tag is the one that keeps the 
picture linked with its local copy.

Original comment by pkola...@gmail.com on 4 Feb 2011 at 12:22