mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-01-22 07:39:00 +00:00
Merge branch 'develop'
This commit is contained in:
commit
feba7ef258
42
.github/workflows/pythonpackage.yml
vendored
Normal file
42
.github/workflows/pythonpackage.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Python package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
strategy:
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.5, 3.6, 3.7, 3.8]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: Lint with flake8
|
||||||
|
run: |
|
||||||
|
pip install flake8
|
||||||
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
pip install pytest
|
||||||
|
pytest -v
|
@ -1,9 +1,10 @@
|
|||||||
language: python
|
language: python
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
- "3.7"
|
- "3.7"
|
||||||
|
- "3.8"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- pytest -v
|
- pytest -v
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
# sync_ics2gcal
|
# sync_ics2gcal
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/b4tman/sync_ics2gcal.svg?branch=master)](https://travis-ci.org/b4tman/sync_ics2gcal)
|
[![Build Status](https://travis-ci.org/b4tman/sync_ics2gcal.svg?branch=master)](https://travis-ci.org/b4tman/sync_ics2gcal)
|
||||||
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=b4tman/sync_ics2gcal)](https://dependabot.com)
|
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=b4tman/sync_ics2gcal)](https://dependabot.com)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fb4tman%2Fsync_ics2gcal.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fb4tman%2Fsync_ics2gcal?ref=badge_shield)
|
||||||
|
![Python package status](https://github.com/b4tman/sync_ics2gcal/workflows/Python%20package/badge.svg)
|
||||||
|
|
||||||
Python scripts for sync .ics file with Google calendar
|
Python scripts for sync .ics file with Google calendar
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
![How it works](how-it-works.png)
|
![How it works](how-it-works.png)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fb4tman%2Fsync_ics2gcal.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fb4tman%2Fsync_ics2gcal?ref=badge_large)
|
@ -30,6 +30,12 @@ def parse_args():
|
|||||||
'remove', help='remove calendar')
|
'remove', help='remove calendar')
|
||||||
parser_remove.add_argument(
|
parser_remove.add_argument(
|
||||||
'id', action='store', help='calendar id to remove')
|
'id', action='store', help='calendar id to remove')
|
||||||
|
parser_rename = command_subparsers.add_parser(
|
||||||
|
'rename', help='rename calendar')
|
||||||
|
parser_rename.add_argument(
|
||||||
|
'id', action='store', help='calendar id')
|
||||||
|
parser_rename.add_argument(
|
||||||
|
'summary', action='store', help='new summary')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.command is None:
|
if args.command is None:
|
||||||
@ -39,7 +45,7 @@ def parse_args():
|
|||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
with open('config.yml', 'r', encoding='utf-8') as f:
|
with open('config.yml', 'r', encoding='utf-8') as f:
|
||||||
result = yaml.load(f)
|
result = yaml.safe_load(f)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +74,10 @@ def remove_calendar(service, id):
|
|||||||
calendar.delete()
|
calendar.delete()
|
||||||
print('removed: {}'.format(id))
|
print('removed: {}'.format(id))
|
||||||
|
|
||||||
|
def rename_calendar(service, id, summary):
|
||||||
|
calendar = {'summary': summary}
|
||||||
|
service.calendars().patch(body=calendar, calendarId=id).execute()
|
||||||
|
print('{}: {}'.format(summary, id))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
@ -87,6 +97,8 @@ def main():
|
|||||||
add_owner(service, args.id, args.owner_email)
|
add_owner(service, args.id, args.owner_email)
|
||||||
elif 'remove' == args.command:
|
elif 'remove' == args.command:
|
||||||
remove_calendar(service, args.id)
|
remove_calendar(service, args.id)
|
||||||
|
elif 'rename' == args.command:
|
||||||
|
rename_calendar(service, args.id, args.summary)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
google-auth==1.6.3
|
google-auth==1.11.0
|
||||||
google-api-python-client==1.7.9
|
google-api-python-client==1.7.11
|
||||||
icalendar==4.0.3
|
icalendar==4.0.4
|
||||||
pytz==2019.1
|
pytz==2019.3
|
||||||
PyYAML==5.1
|
PyYAML==5.3
|
||||||
|
@ -14,7 +14,7 @@ from gcal_sync import (
|
|||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
with open('config.yml', 'r', encoding='utf-8') as f:
|
with open('config.yml', 'r', encoding='utf-8') as f:
|
||||||
result = yaml.load(f)
|
result = yaml.safe_load(f)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user