ics-query 0.1.dev8__tar.gz → 0.3.1b0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/.github/ISSUE_TEMPLATE/bug_report.md +2 -8
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/.github/workflows/tests.yml +3 -16
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/.gitignore +1 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/PKG-INFO +393 -37
- ics_query-0.3.1b0/README.md +444 -0
- ics_query-0.3.1b0/ics-query +1 -0
- ics_query-0.3.1b0/ics_query/__init__.py +27 -0
- ics_query-0.3.1b0/ics_query/__main__.py +20 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/ics_query/_version.py +2 -2
- ics_query-0.3.1b0/ics_query/cli.py +692 -0
- ics_query-0.3.1b0/ics_query/parse.py +87 -0
- ics_query-0.3.1b0/ics_query/query.py +71 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/ics_query/tests/conftest.py +39 -12
- ics_query-0.3.1b0/ics_query/tests/runs/all --tz Singapore one-event.ics -.run +9 -0
- ics_query-0.3.1b0/ics_query/tests/runs/all three-events.ics -.run +33 -0
- ics_query-0.3.1b0/ics_query/tests/runs/at 2019-03-04 multiple-calendars.ics -.run +20 -0
- ics_query-0.3.1b0/ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run +18 -0
- ics_query-0.3.1b0/ics_query/tests/runs/at 2019-03-07 multiple-calendars.ics -.run +11 -0
- ics_query-0.3.1b0/ics_query/tests/runs/at 2024-08-20 Berlin-Los-Angeles.ics -.run +23 -0
- ics_query-0.3.1b0/ics_query/tests/runs/between 20240823 4d recurring-work-events.ics -.run +24 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/Berlin-Los-Angeles.ics +381 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/empty-calendar.ics +7 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/empty-file.ics +0 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/multiple-calendars.ics +71 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/one-event-twice.ics +68 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/recurring-work-events.ics +223 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/simple-journal.ics +15 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/simple-todo.ics +15 -0
- ics_query-0.3.1b0/ics_query/tests/runs/calendars/three-events.ics +37 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first -c VJOURNAL -c VEVENT one-event.ics -.run +9 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first -c VJOURNAL one-event.ics -.run +0 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first -c VJOURNAL simple-journal.ics -.run +12 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first -c VTODO -c VJOURNAL simple-todo.ics -.run +10 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first -c VTODO simple-todo.ics -.run +10 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first empty-calendar.ics -.run +0 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first empty-file.ics -.run +0 -0
- ics_query-0.3.1b0/ics_query/tests/runs/first recurring-work-events.ics -.run +12 -0
- ics_query-0.3.1b0/ics_query/tests/test_command_line.py +53 -0
- ics_query-0.3.1b0/ics_query/tests/test_parse_date.py +81 -0
- ics_query-0.3.1b0/ics_query/tests/test_parse_timedelta.py +40 -0
- ics_query-0.3.1b0/ics_query/version.py +46 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/pyproject.toml +25 -7
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/tox.ini +3 -1
- ics_query-0.1.dev8/README.md +0 -92
- ics_query-0.1.dev8/ics_query/__init__.py +0 -11
- ics_query-0.1.dev8/ics_query/__main__.py +0 -5
- ics_query-0.1.dev8/ics_query/cli.py +0 -92
- ics_query-0.1.dev8/ics_query/parse.py +0 -13
- ics_query-0.1.dev8/ics_query/tests/test_command_line.py +0 -10
- ics_query-0.1.dev8/ics_query/version.py +0 -16
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/.github/FUNDING.yml +0 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/.github/dependabot.yml +0 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/LICENSE +0 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/ics_query/tests/__init__.py +0 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/ics_query/tests/runs/at 2019-03-04 one-event.ics -.run +0 -0
- {ics_query-0.1.dev8 → ics_query-0.3.1b0}/ics_query/tests/runs/calendars/one-event.ics +0 -0
|
@@ -27,15 +27,9 @@ assignees: ''
|
|
|
27
27
|
|
|
28
28
|
**Version:**
|
|
29
29
|
<!-- Which Version do you use? -->
|
|
30
|
-
v0.0.1
|
|
31
30
|
|
|
32
|
-
<!-- Sometimes, the problems are in other packages. You can provide an overview
|
|
33
|
-
by running this command and passing the output:
|
|
34
|
-
|
|
35
|
-
pip list
|
|
36
|
-
-->
|
|
37
31
|
```shell
|
|
38
|
-
|
|
32
|
+
$ ics-query --version
|
|
39
33
|
```
|
|
40
34
|
|
|
41
35
|
## Additional context
|
|
@@ -45,5 +39,5 @@ pip list
|
|
|
45
39
|
<!-- If possible, suggest a way of solving this or just let this text down there remain as it is. -->
|
|
46
40
|
|
|
47
41
|
- [ ] add an ICS file in `ics_query/tests/runs/calendars`
|
|
48
|
-
- [ ] add a test in `ics_query/tests/runs
|
|
42
|
+
- [ ] add a test in `ics_query/tests/runs`
|
|
49
43
|
- [ ] fix the bug and ensure the test code passes
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
uses: actions/cache@v4
|
|
34
34
|
with:
|
|
35
35
|
path: ~/.cache/pip
|
|
36
|
-
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('
|
|
36
|
+
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
|
|
37
37
|
restore-keys: |
|
|
38
38
|
${{ runner.os }}-pip-${{ matrix.config[0] }}-
|
|
39
39
|
${{ runner.os }}-pip-
|
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
# see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
|
|
57
57
|
environment:
|
|
58
58
|
name: PyPI
|
|
59
|
-
url: https://pypi.org/project/
|
|
59
|
+
url: https://pypi.org/project/ics-query/
|
|
60
60
|
# after using the environment, we need to make the secrets available
|
|
61
61
|
# see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash
|
|
62
62
|
env:
|
|
@@ -72,18 +72,6 @@ jobs:
|
|
|
72
72
|
run: |
|
|
73
73
|
python -m pip install --upgrade pip
|
|
74
74
|
pip install --upgrade wheel twine build
|
|
75
|
-
# - name: Check the tag
|
|
76
|
-
# run: |
|
|
77
|
-
# PACKAGE_VERSION=`python setup.py --version`
|
|
78
|
-
# TAG_NAME=v$PACKAGE_VERSION
|
|
79
|
-
# echo "Package version $PACKAGE_VERSION with possible tag name $TAG_NAME on $GITHUB_REF_NAME"
|
|
80
|
-
# # test that the tag represents the version
|
|
81
|
-
# # see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
|
82
|
-
# # see https://docs.github.com/en/actions/learn-github-actions/environment-variables
|
|
83
|
-
# if [ "$TAG_NAME" != "$GITHUB_REF_NAME" ]; then
|
|
84
|
-
# echo "ERROR: This tag is for the wrong version. Got \"$GITHUB_REF_NAME\" expected \"$TAG_NAME\"."
|
|
85
|
-
# exit 1
|
|
86
|
-
# fi
|
|
87
75
|
- name: remove old files
|
|
88
76
|
run: rm -rf dist/*
|
|
89
77
|
- name: build distribution files
|
|
@@ -113,7 +101,6 @@ jobs:
|
|
|
113
101
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
114
102
|
needs:
|
|
115
103
|
- run-tests
|
|
116
|
-
- dockerhub
|
|
117
104
|
- deploy-tag-to-pypi
|
|
118
105
|
runs-on: ubuntu-latest
|
|
119
106
|
steps:
|
|
@@ -122,5 +109,5 @@ jobs:
|
|
|
122
109
|
uses: ncipollo/release-action@v1
|
|
123
110
|
with:
|
|
124
111
|
allowUpdates: true
|
|
125
|
-
body: "For a list of changes, please refer to the [Changelog](https://
|
|
112
|
+
body: "For a list of changes, please refer to the [Changelog](https://github.com/niccokunzmann/ics-query#changelog)."
|
|
126
113
|
generateReleaseNotes: false
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ics-query
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Find out what happens in ICS calendar files - query and filter RFC 5545 compatible
|
|
3
|
+
Version: 0.3.1b0
|
|
4
|
+
Summary: Find out what happens in ICS calendar files - query and filter RFC 5545 compatible .ics files for events, journals, TODOs and more.
|
|
5
5
|
Project-URL: Homepage, https://github.com/niccokunzmann/ics-query/
|
|
6
6
|
Project-URL: Repository, https://github.com/niccokunzmann/ics-query/
|
|
7
|
-
Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/
|
|
7
|
+
Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/985400ff5c4df0ea4ad62422ef5c5c5e98face07.zip
|
|
8
8
|
Project-URL: Issues, https://github.com/niccokunzmann/ics-query/issues
|
|
9
9
|
Project-URL: Documentation, https://github.com/niccokunzmann/ics-query/
|
|
10
10
|
Project-URL: Changelog, https://github.com/niccokunzmann/ics-query/#changelog
|
|
@@ -686,100 +686,455 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
686
686
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
687
687
|
License-File: LICENSE
|
|
688
688
|
Keywords: calendar,command line,icalendar,ics,rfc5545,scheduling
|
|
689
|
-
Classifier: Development Status ::
|
|
689
|
+
Classifier: Development Status :: 4 - Beta
|
|
690
690
|
Classifier: Intended Audience :: Developers
|
|
691
691
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
692
692
|
Classifier: Operating System :: OS Independent
|
|
693
|
-
Classifier: Programming Language :: Python :: 3
|
|
693
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
694
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
695
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
696
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
694
697
|
Classifier: Topic :: Office/Business :: Scheduling
|
|
695
|
-
Requires-Python: >=3.
|
|
698
|
+
Requires-Python: >=3.9
|
|
696
699
|
Requires-Dist: click
|
|
697
700
|
Requires-Dist: icalendar
|
|
698
|
-
Requires-Dist: recurring-ical-events
|
|
701
|
+
Requires-Dist: recurring-ical-events<4,>=3.2.0
|
|
702
|
+
Requires-Dist: x-wr-timezone
|
|
699
703
|
Provides-Extra: test
|
|
700
704
|
Requires-Dist: pytest; extra == 'test'
|
|
701
705
|
Description-Content-Type: text/markdown
|
|
702
706
|
|
|
703
707
|
# ics-query
|
|
704
708
|
|
|
709
|
+
[][GitHub Actions]
|
|
710
|
+
[][PyPI]
|
|
711
|
+
[][PyPI]
|
|
712
|
+
[][Open Collective]
|
|
713
|
+
[][Polar]
|
|
714
|
+
|
|
705
715
|
<!-- Change description also in pyproject.toml -->
|
|
706
716
|
Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
|
|
707
717
|
|
|
708
718
|
## Installation
|
|
709
719
|
|
|
710
|
-
You can install this package from the [PyPI]
|
|
720
|
+
You can install this package from the [PyPI].
|
|
711
721
|
|
|
712
722
|
```shell
|
|
713
723
|
pip install ics-query
|
|
714
724
|
```
|
|
715
725
|
|
|
716
|
-
##
|
|
726
|
+
## Support
|
|
727
|
+
|
|
728
|
+
- Support using [GitHub Sponsors]
|
|
729
|
+
- Fund specific issues using [Polar]
|
|
730
|
+
- Support using [Open Collective]
|
|
731
|
+
- Support using [thanks.dev]
|
|
732
|
+
|
|
733
|
+
We accept donations to sustain our work, once or regular.
|
|
734
|
+
Consider donating money to open-source as everyone benefits.
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
## Usage
|
|
739
|
+
|
|
740
|
+
`ics-query` is a command line tool that aims to make icalendar occurance calculations
|
|
741
|
+
accessible and easy.
|
|
742
|
+
This section walks you though the different functionalities.
|
|
743
|
+
|
|
744
|
+
### Examples
|
|
745
|
+
|
|
746
|
+
You can get a calendar from the web and see what is on.
|
|
747
|
+
In this example, we show which German National Holidays happening in August 2024:
|
|
748
|
+
|
|
749
|
+
```shell
|
|
750
|
+
$ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ics-query at 2024-08 - -
|
|
751
|
+
BEGIN:VEVENT
|
|
752
|
+
SUMMARY:Assumption Day (BY\, SL)
|
|
753
|
+
DTSTART;VALUE=DATE:20240815
|
|
754
|
+
DTEND;VALUE=DATE:20240815
|
|
755
|
+
DTSTAMP:20231013T092513Z
|
|
756
|
+
UID:65290cf9326601697189113@calendarlabs.com
|
|
757
|
+
SEQUENCE:0
|
|
758
|
+
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
|
|
759
|
+
ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
|
|
760
|
+
ook: http://fb.com/calendarlabs to get updates
|
|
761
|
+
LOCATION:Germany
|
|
762
|
+
STATUS:CONFIRMED
|
|
763
|
+
TRANSP:TRANSPARENT
|
|
764
|
+
END:VEVENT
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
In the following example, we query a calendar file and print the result.
|
|
768
|
+
|
|
769
|
+
```shell
|
|
770
|
+
$ ics-query at 2019-03-04 one-event.ics -
|
|
771
|
+
BEGIN:VEVENT
|
|
772
|
+
SUMMARY:test1
|
|
773
|
+
DTSTART;TZID=Europe/Berlin:20190304T080000
|
|
774
|
+
DTEND;TZID=Europe/Berlin:20190304T083000
|
|
775
|
+
DTSTAMP:20190303T111937
|
|
776
|
+
UID:UYDQSG9TH4DE0WM3QFL2J
|
|
777
|
+
CREATED:20190303T111937
|
|
778
|
+
LAST-MODIFIED:20190303T111937
|
|
779
|
+
END:VEVENT
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
We can concatenate calendars and pipe them into `ics-query`.
|
|
783
|
+
In the example below, we get all events that happen right now in two calendars.
|
|
784
|
+
|
|
785
|
+
```shell
|
|
786
|
+
$ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
|
|
787
|
+
BEGIN:VEVENT
|
|
788
|
+
...
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
#### Piping calendars
|
|
792
|
+
|
|
793
|
+
You can pipe one or more calendars into the input.
|
|
794
|
+
|
|
795
|
+
```shell
|
|
796
|
+
cat calendar.ics | ics-query first -
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
### Events at Certain Times
|
|
800
|
+
|
|
801
|
+
You can query which events happen at certain times:
|
|
802
|
+
|
|
803
|
+
```shell
|
|
804
|
+
ics-query at TIME calendar.ics -
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
The format of TIME:
|
|
808
|
+
|
|
809
|
+
| TIME | description |
|
|
810
|
+
| ------- | ----------- |
|
|
811
|
+
| `2019` | the whole year 2019 |
|
|
812
|
+
| `2019-08` | August 2019 |
|
|
813
|
+
| `2019-08-12` | 12th of August 2019 |
|
|
814
|
+
| `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
|
|
815
|
+
| `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
|
|
816
|
+
| `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
Please see the command documentation for more help:
|
|
820
|
+
|
|
821
|
+
```shell
|
|
822
|
+
ics-query at --help
|
|
823
|
+
ics-query --help
|
|
824
|
+
```
|
|
717
825
|
|
|
718
826
|
You can get all **events** that happen at a certain **day**.
|
|
719
827
|
|
|
720
828
|
```shell
|
|
721
|
-
ics-query --components VEVENT
|
|
829
|
+
ics-query at --components VEVENT 2029-12-24 calendar.ics
|
|
722
830
|
```
|
|
723
831
|
|
|
724
832
|
You can get all **events** that happen **today**.
|
|
725
833
|
|
|
726
834
|
```shell
|
|
727
|
-
ics-query --components VEVENT
|
|
835
|
+
ics-query at --components VEVENT `date +%Y-%m-%d` calendar.ics
|
|
728
836
|
```
|
|
729
837
|
|
|
730
|
-
You can get all **TODO**s that happen
|
|
838
|
+
You can get all **TODO**s that happen in a certain **month**.
|
|
731
839
|
|
|
732
840
|
```shell
|
|
733
|
-
ics-query --components VTODO
|
|
841
|
+
ics-query at --components VTODO 2029-12-24 calendar.ics
|
|
734
842
|
```
|
|
735
843
|
|
|
736
|
-
|
|
844
|
+
### Events within a Time Span
|
|
737
845
|
|
|
846
|
+
You can query which events happen between certain times:
|
|
738
847
|
|
|
739
|
-
|
|
848
|
+
```shell
|
|
849
|
+
ics-query between START END calendar.ics -
|
|
850
|
+
ics-query between START DURATION calendar.ics -
|
|
851
|
+
```
|
|
740
852
|
|
|
853
|
+
Please see the command documentation for more help:
|
|
741
854
|
|
|
742
|
-
|
|
855
|
+
```shell
|
|
856
|
+
ics-query between --help
|
|
857
|
+
ics-query --help
|
|
858
|
+
```
|
|
743
859
|
|
|
860
|
+
The format of START and END with examples:
|
|
744
861
|
|
|
745
|
-
|
|
862
|
+
| START or END | Description |
|
|
863
|
+
| ------- | ----------- |
|
|
864
|
+
| `2019` | the whole year 2019 |
|
|
865
|
+
| `2019-08` | August 2019 |
|
|
866
|
+
| `2019-08-12` | 12th of August 2019 |
|
|
867
|
+
| `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
|
|
868
|
+
| `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
|
|
869
|
+
| `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
|
|
746
870
|
|
|
747
|
-
|
|
871
|
+
Instead of an absolute time, you can specify a duration after the START.
|
|
872
|
+
The `+` is optional.
|
|
873
|
+
|
|
874
|
+
| DURATION | Description |
|
|
875
|
+
| ------- | ----------- |
|
|
876
|
+
| `+1d` | one more day |
|
|
877
|
+
| `+1h` | one more hour |
|
|
878
|
+
| `+1m` | one more minute |
|
|
879
|
+
| `+1s` | one more second |
|
|
880
|
+
| `+3600s` | one more hour or 3600 seconds |
|
|
881
|
+
| `+5d10h` | five more days and 10 more hours |
|
|
882
|
+
|
|
883
|
+
### Time Span Examples
|
|
884
|
+
|
|
885
|
+
This example returns the occurrences within the **next week**:
|
|
886
|
+
|
|
887
|
+
```shell
|
|
888
|
+
ics-query between `date +%Y%m%d` +7d calendar.ics -
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
This example saves the **events** from the **1st of May 2024 to the 10th of June** in
|
|
892
|
+
events.ics:
|
|
893
|
+
|
|
894
|
+
```shell
|
|
895
|
+
ics-query between --component VEVENT 2024-5-1 2024-6-10 calendar.ics events.ics
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
In this example, you can check what is happening on **New Years Eve 2025** around
|
|
899
|
+
midnight:
|
|
900
|
+
|
|
901
|
+
```shell
|
|
902
|
+
ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
### `ics-query all` - the whole calendar
|
|
906
|
+
|
|
907
|
+
You can get everything that is happening in a calendar but that can be a lot!
|
|
908
|
+
|
|
909
|
+
```shell
|
|
910
|
+
ics-query all calendar.ics
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
### Filtering Components
|
|
914
|
+
|
|
915
|
+
We support different component types: `VEVENT`, `VJOURNAL` and `VTODO`.
|
|
916
|
+
By default, we include all types in the result.
|
|
917
|
+
|
|
918
|
+
You can specify which components you would like to get using the
|
|
919
|
+
`--component` or `-c` parameter.
|
|
920
|
+
|
|
921
|
+
```shell
|
|
922
|
+
-c VEVENT # only events
|
|
923
|
+
-c VTODO # only TODOs
|
|
924
|
+
-c VJOURNAL # only journal entries
|
|
925
|
+
-c VEVENT -v VTODO # only events and journal entries
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
This example returns the first event of a calendar.
|
|
929
|
+
|
|
930
|
+
```shell
|
|
931
|
+
ics-query first -c VEVENT calendar.ics -
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
This option is also available as `ICS_QUERY_COMPONENT` variable.
|
|
935
|
+
|
|
936
|
+
```shell
|
|
937
|
+
export ICS_QUERY_COMPONENT=VEVENT
|
|
938
|
+
# from now on, you will get only events
|
|
939
|
+
ics-query first calendar.ics
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
Please see the command documentation for more help:
|
|
943
|
+
|
|
944
|
+
```shell
|
|
945
|
+
ics-query --help
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
### Timezones
|
|
950
|
+
|
|
951
|
+
You can set the timezone of the query, otherwise the event's local timezone is used and you
|
|
952
|
+
might miss events in your own timezone.
|
|
953
|
+
|
|
954
|
+
The first event at New Year 2000 in the **event's local time**:
|
|
748
955
|
|
|
749
|
-
|
|
956
|
+
```shell
|
|
957
|
+
ics-query at 2000-01-01 calendar.ics
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
The first event at New Year 2000 in **your local time**:
|
|
961
|
+
|
|
962
|
+
```shell
|
|
963
|
+
ics-query at --tz=localtime 2000-01-01 calendar.ics
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
The first event at New Year 2000 in **UTC**:
|
|
967
|
+
|
|
968
|
+
```shell
|
|
969
|
+
ics-query at --tz=UTC 2000-01-01 calendar.ics
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
The first event at New Year 2000 in **Berlin time**:
|
|
973
|
+
|
|
974
|
+
```shell
|
|
975
|
+
ics-query at --tz=Europe/Berlin 2000-01-01 calendar.ics
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
You can also use the `ICS_QUERY_TZ` variable.
|
|
979
|
+
|
|
980
|
+
```shell
|
|
981
|
+
export ICS_QUERY_TZ=localtime
|
|
982
|
+
# from now on, we use your local time
|
|
983
|
+
ics-query at 2000-01-01 calendar.ics
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
For all avaiable timezones see:
|
|
987
|
+
|
|
988
|
+
```shell
|
|
989
|
+
ics-query --available-timezones
|
|
990
|
+
```
|
|
750
991
|
|
|
751
|
-
|
|
992
|
+
Please see the command documentation for more help:
|
|
752
993
|
|
|
753
994
|
```shell
|
|
754
|
-
ics-query
|
|
755
|
-
ics-query between dt duration
|
|
995
|
+
ics-query --help
|
|
756
996
|
```
|
|
757
997
|
|
|
758
|
-
##
|
|
998
|
+
## Version Fixing
|
|
999
|
+
|
|
1000
|
+
If you use this library in your code, you may want to make sure that
|
|
1001
|
+
updates can be received but they do not break your code.
|
|
1002
|
+
The version numbers are handeled this way: `a.b.c` example: `0.1.12`
|
|
1003
|
+
|
|
1004
|
+
- `c` is changed for each minor bug fix.
|
|
1005
|
+
- `b` is changed whenever new features are added.
|
|
1006
|
+
- `a` is changed when the interface or major assumptions change that may break your code.
|
|
1007
|
+
|
|
1008
|
+
So, I recommend to version-fix this library to stay with the same `a`
|
|
1009
|
+
while `b` and `c` can change.
|
|
1010
|
+
|
|
1011
|
+
## Development
|
|
1012
|
+
|
|
1013
|
+
This section should set you up for developing `ics-query`.
|
|
759
1014
|
|
|
1015
|
+
### Testing
|
|
760
1016
|
|
|
761
|
-
|
|
1017
|
+
This project's development is driven by tests.
|
|
1018
|
+
Tests assure a consistent interface and less knowledge lost over time.
|
|
1019
|
+
If you like to change the code, tests help that nothing breaks in the future.
|
|
1020
|
+
They are required in that sense.
|
|
1021
|
+
Example code and ics files can be transferred into tests and speed up fixing bugs.
|
|
1022
|
+
|
|
1023
|
+
You can view the tests in the [test folder](https://github.com/niccokunzmann/ics-query/tree/main/ics_query/tests)
|
|
1024
|
+
If you have a calendar ICS file for which this library does not
|
|
1025
|
+
generate the desired output, you can add it to the ``test/calendars``
|
|
1026
|
+
folder and write tests for what you expect.
|
|
1027
|
+
If you like, [open an issue](https://github.com/niccokunzmann/ics-query/issues) first, e.g. to discuss the changes and
|
|
1028
|
+
how to go about it.
|
|
1029
|
+
|
|
1030
|
+
To run the tests, we use `tox`.
|
|
1031
|
+
`tox` tests all different Python versions which we want to be compatible to.
|
|
1032
|
+
|
|
1033
|
+
```shell
|
|
1034
|
+
pip3 install tox
|
|
1035
|
+
```
|
|
762
1036
|
|
|
1037
|
+
To run all the tests:
|
|
763
1038
|
|
|
764
|
-
|
|
1039
|
+
```shell
|
|
1040
|
+
tox
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
To run the tests in a specific Python version:
|
|
1044
|
+
|
|
1045
|
+
```shell
|
|
1046
|
+
tox -e py39
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
We use ``ruff`` to format the code.
|
|
1050
|
+
Run this to format the code and show problems:
|
|
1051
|
+
|
|
1052
|
+
```shell
|
|
1053
|
+
tox -e ruff
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
### New Release
|
|
1057
|
+
|
|
1058
|
+
To release new versions,
|
|
1059
|
+
|
|
1060
|
+
1. edit the Changelog Section
|
|
1061
|
+
2. create a commit and push it
|
|
1062
|
+
3. wait for [GitHub Actions] to finish the build
|
|
1063
|
+
4. create a tag and push it
|
|
1064
|
+
|
|
1065
|
+
```shell
|
|
1066
|
+
git tag v0.1.0a
|
|
1067
|
+
git push origin v0.1.0a
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
5. Notify the issues about their release
|
|
1071
|
+
|
|
1072
|
+
## Changelog
|
|
1073
|
+
|
|
1074
|
+
- v0.3.1b
|
|
1075
|
+
|
|
1076
|
+
- Add `--license` option
|
|
1077
|
+
|
|
1078
|
+
- v0.3.0b
|
|
1079
|
+
|
|
1080
|
+
- Add `--tz` timezone parameter
|
|
1081
|
+
- Add `ics-query all` to get all occurrences
|
|
1082
|
+
|
|
1083
|
+
- v0.2.1a
|
|
1084
|
+
|
|
1085
|
+
- Add `--component` to filter component types VEVENT, VJOURNAL and VTODO
|
|
1086
|
+
|
|
1087
|
+
- v0.2.0a
|
|
1088
|
+
|
|
1089
|
+
- Add `ics-query first <calendar> <output>` for earliest occurrences
|
|
1090
|
+
- Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
|
|
1091
|
+
|
|
1092
|
+
- v0.1.1a
|
|
1093
|
+
|
|
1094
|
+
- Add `--version`
|
|
1095
|
+
- Add `ics-query at <date> <calendar> <output>`
|
|
1096
|
+
- Add support for multiple calendars in one input
|
|
1097
|
+
|
|
1098
|
+
- v0.1.0a
|
|
1099
|
+
|
|
1100
|
+
- Update Python version compatibility
|
|
1101
|
+
- Add development documentation
|
|
1102
|
+
|
|
1103
|
+
- v0.0.1a
|
|
1104
|
+
|
|
1105
|
+
- first version
|
|
1106
|
+
|
|
1107
|
+
## Related Work
|
|
1108
|
+
|
|
1109
|
+
- [icalBuddy](https://hasseg.org/icalBuddy/)
|
|
1110
|
+
- [Blog Post](https://opencollective.com/open-web-calendar/updates/calendar-calculation-on-the-command-line-ics-query)
|
|
1111
|
+
- [#icsquery on mastodon](https://toot.wales/tags/icsquery)
|
|
1112
|
+
|
|
1113
|
+
## Vision
|
|
1114
|
+
|
|
1115
|
+
This section shows where we would like to get to.
|
|
1116
|
+
|
|
1117
|
+
### `ics-query --select-index` - reduce output size
|
|
1118
|
+
|
|
1119
|
+
Examples: `0,2,4` `0-10`
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
### `ics-query --select-uid` - filter by uid
|
|
1123
|
+
|
|
1124
|
+
### How to edit an event
|
|
765
1125
|
|
|
766
1126
|
To edit a component like an event, you can append it to the calendar and increase the sequence number.
|
|
767
1127
|
|
|
768
1128
|
Example:
|
|
769
1129
|
|
|
770
|
-
1. get the
|
|
1130
|
+
1. get the event `--select-index=0`
|
|
771
1131
|
2. change the summary
|
|
772
1132
|
3. increase sequence number
|
|
773
1133
|
4. add the event to the end of the calendar file
|
|
774
1134
|
5. show that the occurrence has changed
|
|
775
1135
|
|
|
776
|
-
## Piping calendars
|
|
777
|
-
|
|
778
|
-
```shell
|
|
779
|
-
cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
|
|
780
|
-
```
|
|
781
1136
|
|
|
782
|
-
|
|
1137
|
+
### Notifications
|
|
783
1138
|
|
|
784
1139
|
Examples:
|
|
785
1140
|
|
|
@@ -787,8 +1142,9 @@ Examples:
|
|
|
787
1142
|
- There are x events today
|
|
788
1143
|
- Please write a journal entry!
|
|
789
1144
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1145
|
+
[PyPI]: https://pypi.org/project/ics-query/
|
|
1146
|
+
[GitHub Actions]: https://github.com/niccokunzmann/ics-query/actions
|
|
1147
|
+
[Open Collective]: https://opencollective.com/open-web-calendar/
|
|
1148
|
+
[Polar]: https://polar.sh/niccokunzmann/ics-query
|
|
1149
|
+
[GitHub Sponsors]: https://github.com/sponsors/niccokunzmann
|
|
1150
|
+
[thanks.dev]: https://thanks.dev
|