def delete(self): PhotoStationService.session.query('SYNO.PhotoStation.Album', { 'id': PhotoStationUtils.album_id(self.path), 'method': 'delete', 'ps_username': PhotoStationService.session.username }) self.parent.remove_item(self.name)
def items(self): if not self._items: items = PhotoStationService.session.query( 'SYNO.PhotoStation.Album', { 'method': 'list', 'id': PhotoStationUtils.album_id(self.path), 'type': 'album,photo,video', 'offset': 0, 'limit': -1, 'recursive': 'false', 'additional': 'album_permission,photo_exif,video_codec,video_quality,thumb_size,file_location' }) self._items = {} for item in items['items']: if item['type'] == 'album': album = PhotoStationAlbum.from_photostation(self, item) self.add_item(album.name, album) else: photo = PhotoStationPhoto.from_photostation(self, item) self.add_item(photo.filename, photo) return self._items
def create(self, name): PhotoStationService.session.query('SYNO.PhotoStation.Album', { 'name': name, 'title': '', 'description': '', 'id': PhotoStationUtils.album_id(self.path), 'method': 'create', 'ps_username': PhotoStationService.session.username }) album = PhotoStationAlbum(self, name) self.add_item(name, album) return album
def find_items(self, tags, recursive=True): items_raw = PhotoStationService.session.query('SYNO.PhotoStation.Album', { 'method': 'list', 'id': PhotoStationUtils.album_id(self.path), 'type': 'album,photo,video', 'offset': 0, 'limit': -1, 'recursive': recursive, 'desc_tag' : ','.join(x.id for x in tags) }) items = {} for item in items_raw['items']: if item['type'] == 'album': album = PhotoStationAlbum.from_photostation(self, item) items[album.name] = album else: photo = PhotoStationPhoto.from_photostation(self, item) items[photo.filename] = photo return items