2

Closed

Unrolling Hierarchical Tags

description

I'm using lots of tags -- hierarchical. And when I upload to Flickr I'd like them to be unrolled (so People/Friends/Anna becomes People, Friends, and Anna tags. The is clearly an optional choice. The code to do this is fairly simple and can be added to your PictureItem.cs code. Then, depending on user preference, you can use the "SplitTagListForFlickr" or "TagListForFlickr" in the FlickrHelper picture upload code. Further development could include dropping certian tags (like "Other" as in "Other/Sky" in my tag list).
 
    /// <summary>
    /// Returns the tag list including original tags split by their hierarchical tags
    /// </summary>
    public string SplitTagListForFlickr
    {
        get
        {
            StringBuilder tags = new StringBuilder();
            foreach (string keyword in _keywords)
            {
                tags.AppendFormat("{1}{0}{1} ", keyword, keyword.Contains(" ") ? "\"" : "");
                string[] split_keywords = keyword.Split('/');
                if (split_keywords.Length > 1)
                {
                    foreach (string split_keyword in split_keywords)
                    {
                        tags.AppendFormat("{1}{0}{1} ", split_keyword, split_keyword.Contains(" ") ? "\"" : "");
                    }
                }
            }
            if (tags.Length >= 1)
            {
                tags.Length -= 1;
            }
            return tags.ToString();
        }
    }
Closed May 17, 2007 at 4:15 PM by m2xdam

comments

m2xdam wrote May 17, 2007 at 4:12 PM

I´ve added 2 configuration settings: TagSeparator and TagsToExclude. Tags will be seperated by the first and all tags contained in the latter will be excluded for Flickr.

wrote May 17, 2007 at 4:12 PM

wrote May 17, 2007 at 4:15 PM

wrote Feb 2, 2013 at 4:35 AM

wrote May 13, 2013 at 6:34 PM