bool SmugMug::getSubCategoryList(OwnedArray<SubCategory>& subCategories) { StringPairArray params; XmlElement* n = smugMugRequest(("smugmug.subcategories.getAll"), params); if (n) { XmlElement* c = n->getChildByName(("SubCategories")); if (c) { XmlElement* subCat = c->getChildByName(("SubCategory")); while (subCat) { SubCategory* subCategory = new SubCategory(); subCategory->id = subCat->getIntAttribute(("id")); subCategory->title = subCat->getStringAttribute(("Name")); XmlElement* cat = subCat->getChildByName(("Category")); if (cat) subCategory->parentId = cat->getIntAttribute(("id")); subCategories.add(subCategory); subCat = subCat->getNextElementWithTagName(("SubCategory")); } } delete n; return true; } return false; }
bool SmugMug::getCategoryList(OwnedArray<Category>& categories) { StringPairArray params; XmlElement* n = smugMugRequest(("smugmug.categories.get"), params); if (n) { XmlElement* c = n->getChildByName(("Categories")); if (c) { XmlElement* cat = c->getChildByName(("Category")); while (cat) { Category* category = new Category(); category->id = cat->getIntAttribute(("id")); category->title = cat->getStringAttribute(("Name")); categories.add(category); cat = cat->getNextElementWithTagName(("Category")); } } delete n; return true; } return false; }
bool SmugMug::getImages(OwnedArray<ImageItem>& images, SmugID albumId) { StringPairArray params; params.set(("AlbumID"), String(albumId.id)); params.set(("AlbumKey"), albumId.key); params.set(("Heavy"), ("1")); XmlElement* n = smugMugRequest(("smugmug.images.get"), params); if (n) { XmlElement* a = n->getChildByName(("Album")); if (a) { XmlElement* i = a->getChildByName(("Images")); if (i) { XmlElement* img = i->getChildByName(("Image")); while (img) { ImageItem* itm = new ImageItem(); itm->id.id = img->getIntAttribute(("id")); itm->id.key = img->getStringAttribute(("Key")); itm->filename = img->getStringAttribute(("FileName")); itm->caption = img->getStringAttribute(("")); itm->keywords = img->getStringAttribute(("")); itm->position = img->getIntAttribute(("Position")); itm->date = img->getStringAttribute(("Date")); itm->format = img->getStringAttribute(("Format")); itm->serial = img->getIntAttribute(("Serial")); itm->watermark = img->getBoolAttribute(("Watermark")); itm->size = img->getIntAttribute(("Size")); itm->width = img->getIntAttribute(("Width")); itm->height = img->getIntAttribute(("Height")); itm->md5sum = img->getStringAttribute(("MD5Sum")); itm->lastUpdated = img->getStringAttribute(("LastUpdated")); itm->originalURL = img->getStringAttribute(("OriginalURL")); itm->largeURL = img->getStringAttribute(("LargeURL")); itm->mediumURL = img->getStringAttribute(("MediumURL")); itm->smallURL = img->getStringAttribute(("SmallURL")); itm->tinyURL = img->getStringAttribute(("TinyURL")); itm->thumbURL = img->getStringAttribute(("ThumbURL")); itm->albumURL = img->getStringAttribute(("AlbumURL")); images.add(itm); img = img->getNextElementWithTagName(("Image")); } } } delete n; return images.size() > 0; } return false; }
bool SmugMug::getAlbumList(OwnedArray<Album>& albums) { StringPairArray params; XmlElement* n = smugMugRequest(("smugmug.albums.get"), params); if (n) { XmlElement* a = n->getChildByName(("Albums")); if (a) { XmlElement* alb = a->getChildByName(("Album")); while (alb) { Album* album = new Album(); album->id.id = alb->getIntAttribute(("id")); album->id.key = alb->getStringAttribute(("Key")); album->title = alb->getStringAttribute(("Title")); XmlElement* cat = alb->getChildByName(("Category")); if (cat) { album->category = cat->getStringAttribute(("Name")); album->categoryId = cat->getIntAttribute(("id")); } else { album->category = String::empty; album->categoryId = -1; } XmlElement* subcat = alb->getChildByName(("SubCategory")); if (subcat) { album->subCategory = subcat->getStringAttribute(("Name")); album->subCategoryId = subcat->getIntAttribute(("id")); } else { album->subCategory = String::empty; album->subCategoryId = -1; } albums.add(album); alb = alb->getNextElementWithTagName(("Album")); } } delete n; return true; } return false; }
bool SmugMug::getNumberOfViews(int month, int year, OwnedArray<Views>& albums, OwnedArray<Views>& images) { StringPairArray params; params.set(("Month"), String(month)); params.set(("Year"), String(year)); XmlElement* n = smugMugRequest(("smugmug.users.getTransferStats"), params); if (n) { XmlElement* albs = n->getChildByName(("Albums")); if (albs) { XmlElement* alb = albs->getChildByName(("Album")); while (alb) { Views* v = new Views(); v->id = alb->getIntAttribute(("id")); v->views = alb->getIntAttribute(("Tiny")) + alb->getIntAttribute(("Small")) + alb->getIntAttribute(("Medium")) + alb->getIntAttribute(("Large")) + roundDoubleToInt(alb->getDoubleAttribute(("Original"))); albums.add(v); XmlElement* img = n->getChildByName(("Image")); while (img) { Views* v = new Views(); v->id = img->getIntAttribute(("id")); v->views = img->getIntAttribute(("Tiny")) + img->getIntAttribute(("Small")) + img->getIntAttribute(("Medium")) + img->getIntAttribute(("Large")) + roundDoubleToInt(img->getDoubleAttribute(("Original"))); img = img->getNextElementWithTagName(("Image")); } alb = alb->getNextElementWithTagName(("Album")); } } delete n; return true; } return false; }