Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (c) 2008 Brian Zimmer <bzimmer@ziclix.com> 2 # 3 # Permission is hereby granted, free of charge, to any person obtaining a copy of 4 # this software and associated documentation files (the "Software"), to deal in 5 # the Software without restriction, including without limitation the rights to 6 # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 # of the Software, and to permit persons to whom the Software is furnished to do 8 # so, subject to the following conditions: 9 # 10 # The above copyright notice and this permission notice shall be included in all 11 # copies or substantial portions of the Software. 12 # 13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 # SOFTWARE. 20 21 import pysmug 2224 """Returns a generator of albums with ImageCount == 0. 25 """ 26 m = smugmug or pysmug.login() 27 28 b = m.batch() 29 for album in m.albums_get()["Albums"]: 30 b.albums_getInfo(albumId=album["id"], albumKey=album["Key"]) 31 for (params, info) in b(): 32 imageCount = info["Album"].get("ImageCount", 0) 33 if imageCount == 0: 34 yield info3537 """Returns a generator of categories or subcategories with no 38 albums. 39 """ 40 m = smugmug or pysmug.login() 41 42 used = dict() 43 albums = m.albums_get()["Albums"] 44 for album in albums: 45 category = album["Category"] 46 used[("category", category["id"])] = category 47 subcategory = album.get("SubCategory", None) 48 if subcategory: 49 used[("subcategory", album["SubCategory"]["id"])] = subcategory 50 tree = m.categories_getTree() 51 for c in tree["Categories"]: 52 cid = ("category", c["id"]) 53 if not cid in used: 54 c["Type"] = "Category" 55 yield c 56 for s in c["SubCategories"]: 57 sid = ("subcategory", s["id"]) 58 if not sid in used: 59 s["Type"] = "SubCategory" 60 yield s61
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue May 13 08:00:50 2008 | http://epydoc.sourceforge.net |