mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-01-21 23:38:58 +00:00
+ manage_calendars: get\set calendar properties
This commit is contained in:
parent
c17d3cd0ea
commit
55b67469be
@ -36,6 +36,20 @@ def parse_args():
|
|||||||
'id', action='store', help='calendar id')
|
'id', action='store', help='calendar id')
|
||||||
parser_rename.add_argument(
|
parser_rename.add_argument(
|
||||||
'summary', action='store', help='new summary')
|
'summary', action='store', help='new summary')
|
||||||
|
parser_get = command_subparsers.add_parser(
|
||||||
|
'get', help='get calendar property')
|
||||||
|
parser_get.add_argument(
|
||||||
|
'id', action='store', help='calendar id')
|
||||||
|
parser_get.add_argument(
|
||||||
|
'property', action='store', help='property key')
|
||||||
|
parser_get = command_subparsers.add_parser(
|
||||||
|
'set', help='set calendar property')
|
||||||
|
parser_get.add_argument(
|
||||||
|
'id', action='store', help='calendar id')
|
||||||
|
parser_get.add_argument(
|
||||||
|
'property', action='store', help='property key')
|
||||||
|
parser_get.add_argument(
|
||||||
|
'property_value', action='store', help='property value')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.command is None:
|
if args.command is None:
|
||||||
@ -84,6 +98,15 @@ def rename_calendar(service, id, summary):
|
|||||||
service.calendars().patch(body=calendar, calendarId=id).execute()
|
service.calendars().patch(body=calendar, calendarId=id).execute()
|
||||||
print('{}: {}'.format(summary, id))
|
print('{}: {}'.format(summary, id))
|
||||||
|
|
||||||
|
def get_calendar_property(service, id, property):
|
||||||
|
response = service.calendarList().get(calendarId=id, fields=property).execute()
|
||||||
|
print(response.get(property))
|
||||||
|
|
||||||
|
def set_calendar_property(service, id, property, property_value):
|
||||||
|
body = {property: property_value}
|
||||||
|
response = service.calendarList().patch(body=body, calendarId=id).execute()
|
||||||
|
print(response)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
config = load_config()
|
config = load_config()
|
||||||
@ -103,6 +126,10 @@ def main():
|
|||||||
remove_calendar(service, args.id)
|
remove_calendar(service, args.id)
|
||||||
elif 'rename' == args.command:
|
elif 'rename' == args.command:
|
||||||
rename_calendar(service, args.id, args.summary)
|
rename_calendar(service, args.id, args.summary)
|
||||||
|
elif 'get' == args.command:
|
||||||
|
get_calendar_property(service, args.id, args.property)
|
||||||
|
elif 'set' == args.command:
|
||||||
|
set_calendar_property(service, args.id, args.property, args.property_value)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user