ics-query 0.1.dev8__tar.gz → 0.2.0a0__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.2.0a0}/.github/workflows/tests.yml +2 -15
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/.gitignore +1 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/PKG-INFO +222 -20
- ics_query-0.2.0a0/README.md +291 -0
- ics_query-0.2.0a0/ics-query +1 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/_version.py +2 -2
- ics_query-0.2.0a0/ics_query/cli.py +475 -0
- ics_query-0.2.0a0/ics_query/parse.py +72 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/tests/conftest.py +24 -12
- ics_query-0.2.0a0/ics_query/tests/runs/at 2019-03-04 multiple-calendars.ics -.run +20 -0
- ics_query-0.2.0a0/ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run +18 -0
- ics_query-0.2.0a0/ics_query/tests/runs/at 2019-03-07 multiple-calendars.ics -.run +11 -0
- ics_query-0.2.0a0/ics_query/tests/runs/between 20240823 4d recurring-work-events.ics -.run +24 -0
- ics_query-0.2.0a0/ics_query/tests/runs/calendars/empty-calendar.ics +7 -0
- ics_query-0.2.0a0/ics_query/tests/runs/calendars/empty-file.ics +0 -0
- ics_query-0.2.0a0/ics_query/tests/runs/calendars/multiple-calendars.ics +71 -0
- ics_query-0.2.0a0/ics_query/tests/runs/calendars/one-event-twice.ics +68 -0
- ics_query-0.2.0a0/ics_query/tests/runs/calendars/recurring-work-events.ics +223 -0
- ics_query-0.2.0a0/ics_query/tests/runs/first empty-calendar.ics -.run +0 -0
- ics_query-0.2.0a0/ics_query/tests/runs/first empty-file.ics -.run +0 -0
- ics_query-0.2.0a0/ics_query/tests/runs/first recurring-work-events.ics -.run +12 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/tests/test_command_line.py +9 -0
- ics_query-0.2.0a0/ics_query/tests/test_parse_date.py +66 -0
- ics_query-0.2.0a0/ics_query/tests/test_parse_timedelta.py +25 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/pyproject.toml +7 -4
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/tox.ini +3 -1
- ics_query-0.1.dev8/README.md +0 -92
- 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-0.2.0a0}/.github/FUNDING.yml +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/.github/dependabot.yml +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/LICENSE +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/__init__.py +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/__main__.py +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/tests/__init__.py +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/tests/runs/at 2019-03-04 one-event.ics -.run +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/tests/runs/calendars/one-event.ics +0 -0
- {ics_query-0.1.dev8 → ics_query-0.2.0a0}/ics_query/version.py +0 -0
|
@@ -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.2.0a0
|
|
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/c7eeb503fae7da069308a27a37232be96851c3e5.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
|
|
@@ -690,12 +690,15 @@ Classifier: Development Status :: 3 - Alpha
|
|
|
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
|
|
699
702
|
Provides-Extra: test
|
|
700
703
|
Requires-Dist: pytest; extra == 'test'
|
|
701
704
|
Description-Content-Type: text/markdown
|
|
@@ -713,7 +716,117 @@ You can install this package from the [PyPI](https://pypi.org/project/ics-query/
|
|
|
713
716
|
pip install ics-query
|
|
714
717
|
```
|
|
715
718
|
|
|
716
|
-
##
|
|
719
|
+
## Usage
|
|
720
|
+
|
|
721
|
+
See how to use `ics-query`.
|
|
722
|
+
|
|
723
|
+
### Examples
|
|
724
|
+
|
|
725
|
+
You can easily get a calendar from the web and see what is on.
|
|
726
|
+
In this example, we show which German National Holidays happen in August 2024:
|
|
727
|
+
|
|
728
|
+
```shell
|
|
729
|
+
$ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ./ics-query at 2024-08 - -
|
|
730
|
+
BEGIN:VEVENT
|
|
731
|
+
SUMMARY:Assumption Day (BY\, SL)
|
|
732
|
+
DTSTART;VALUE=DATE:20240815
|
|
733
|
+
DTEND;VALUE=DATE:20240815
|
|
734
|
+
DTSTAMP:20231013T092513Z
|
|
735
|
+
UID:65290cf9326601697189113@calendarlabs.com
|
|
736
|
+
SEQUENCE:0
|
|
737
|
+
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
|
|
738
|
+
ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
|
|
739
|
+
ook: http://fb.com/calendarlabs to get updates
|
|
740
|
+
LOCATION:Germany
|
|
741
|
+
STATUS:CONFIRMED
|
|
742
|
+
TRANSP:TRANSPARENT
|
|
743
|
+
END:VEVENT
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
In the following example, we query a calendar file and print the result.
|
|
747
|
+
|
|
748
|
+
```shell
|
|
749
|
+
$ ics-query at 2019-03-04 one-event.ics -
|
|
750
|
+
BEGIN:VEVENT
|
|
751
|
+
SUMMARY:test1
|
|
752
|
+
DTSTART;TZID=Europe/Berlin:20190304T080000
|
|
753
|
+
DTEND;TZID=Europe/Berlin:20190304T083000
|
|
754
|
+
DTSTAMP:20190303T111937
|
|
755
|
+
UID:UYDQSG9TH4DE0WM3QFL2J
|
|
756
|
+
CREATED:20190303T111937
|
|
757
|
+
LAST-MODIFIED:20190303T111937
|
|
758
|
+
END:VEVENT
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
We can concatenate calendars and pipe them into `ics-query`.
|
|
762
|
+
In the example below, we get all events that happen right now in two calendars.
|
|
763
|
+
|
|
764
|
+
```shell
|
|
765
|
+
$ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
|
|
766
|
+
BEGIN:VEVENT
|
|
767
|
+
...
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
### Events at Certain Times
|
|
771
|
+
|
|
772
|
+
You can query which events happen at certain times:
|
|
773
|
+
|
|
774
|
+
```shell
|
|
775
|
+
ics-query at <date-time> calendar.ics -
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
`<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
|
|
779
|
+
|
|
780
|
+
Please see the command documentation for more help:
|
|
781
|
+
|
|
782
|
+
```shell
|
|
783
|
+
ics-query at --help
|
|
784
|
+
ics-query --help
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
### Events within a Time Span
|
|
788
|
+
|
|
789
|
+
You can query which events happen between certain times:
|
|
790
|
+
|
|
791
|
+
```shell
|
|
792
|
+
ics-query between <start> <end> calendar.ics -
|
|
793
|
+
ics-query between <start> <duration> calendar.ics -
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
Please see the command documentation for more help:
|
|
797
|
+
|
|
798
|
+
```shell
|
|
799
|
+
ics-query between --help
|
|
800
|
+
ics-query --help
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### Time Span Examples
|
|
804
|
+
|
|
805
|
+
This example returns the events within the next week:
|
|
806
|
+
|
|
807
|
+
```shell
|
|
808
|
+
ics-query between `date +%Y%m%d` +7d calendar.ics -
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
This example saves the events from the 1st of May 2024 to the 10th of June in
|
|
812
|
+
events.ics:
|
|
813
|
+
|
|
814
|
+
```shell
|
|
815
|
+
ics-query between 2024-5-1 2024-6-10 calendar.ics events.ics
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
In this example, you can check what is happening on New Years Eve 2025 around
|
|
819
|
+
midnight:
|
|
820
|
+
|
|
821
|
+
```shell
|
|
822
|
+
ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
## Vision
|
|
826
|
+
|
|
827
|
+
This section shows where we would like to get to.
|
|
828
|
+
|
|
829
|
+
### `ics-query at` - occurrences at certain times
|
|
717
830
|
|
|
718
831
|
You can get all **events** that happen at a certain **day**.
|
|
719
832
|
|
|
@@ -733,33 +846,28 @@ You can get all **TODO**s that happen at in certain **month**.
|
|
|
733
846
|
ics-query --components VTODO at 2029-12-24 calendar.ics
|
|
734
847
|
```
|
|
735
848
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
## `ics-query --output=count` - count occurrences
|
|
740
|
-
|
|
849
|
+
### `ics-query at` - time ranges
|
|
741
850
|
|
|
742
|
-
|
|
851
|
+
### `ics-query --output=count` - count occurrences
|
|
743
852
|
|
|
853
|
+
### `ics-query --output=ics` - use ics as output (default)
|
|
744
854
|
|
|
745
|
-
|
|
855
|
+
### `ics-query --select-index` - reduce output size
|
|
746
856
|
|
|
747
857
|
Examples: `0,2,4` `0-10`
|
|
748
858
|
|
|
749
|
-
|
|
859
|
+
### `ics-query all` - the whole calendar
|
|
750
860
|
|
|
751
|
-
|
|
861
|
+
### `ics-query between` - time ranges
|
|
752
862
|
|
|
753
863
|
```shell
|
|
754
864
|
ics-query between dt dt
|
|
755
865
|
ics-query between dt duration
|
|
756
866
|
```
|
|
757
867
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
## `ics-query --select-uid` - filter by uid
|
|
868
|
+
### `ics-query --select-component` - filter for components
|
|
762
869
|
|
|
870
|
+
### `ics-query --select-uid` - filter by uid
|
|
763
871
|
|
|
764
872
|
## How to edit an event
|
|
765
873
|
|
|
@@ -787,8 +895,102 @@ Examples:
|
|
|
787
895
|
- There are x events today
|
|
788
896
|
- Please write a journal entry!
|
|
789
897
|
|
|
898
|
+
## Version Fixing
|
|
899
|
+
|
|
900
|
+
If you use this library in your code, you may want to make sure that
|
|
901
|
+
updates can be received but they do not break your code.
|
|
902
|
+
The version numbers are handeled this way: `a.b.c` example: `0.1.12`
|
|
903
|
+
|
|
904
|
+
- `c` is changed for each minor bug fix.
|
|
905
|
+
- `b` is changed whenever new features are added.
|
|
906
|
+
- `a` is changed when the interface or major assumptions change that may break your code.
|
|
907
|
+
|
|
908
|
+
So, I recommend to version-fix this library to stay with the same `a`
|
|
909
|
+
while `b` and `c` can change.
|
|
910
|
+
|
|
911
|
+
## Development
|
|
912
|
+
|
|
913
|
+
This section should set you up for development.
|
|
914
|
+
|
|
915
|
+
### Testing
|
|
916
|
+
|
|
917
|
+
This project's development is driven by tests.
|
|
918
|
+
Tests assure a consistent interface and less knowledge lost over time.
|
|
919
|
+
If you like to change the code, tests help that nothing breaks in the future.
|
|
920
|
+
They are required in that sense.
|
|
921
|
+
Example code and ics files can be transferred into tests and speed up fixing bugs.
|
|
922
|
+
|
|
923
|
+
You can view the tests in the [test folder](https://github.com/niccokunzmann/ics-query/tree/main/ics_query/tests)
|
|
924
|
+
If you have a calendar ICS file for which this library does not
|
|
925
|
+
generate the desired output, you can add it to the ``test/calendars``
|
|
926
|
+
folder and write tests for what you expect.
|
|
927
|
+
If you like, [open an issue](https://github.com/niccokunzmann/ics-query/issues) first, e.g. to discuss the changes and
|
|
928
|
+
how to go about it.
|
|
929
|
+
|
|
930
|
+
To run the tests, we use `tox`.
|
|
931
|
+
`tox` tests all different Python versions which we want to be compatible to.
|
|
932
|
+
|
|
933
|
+
```shell
|
|
934
|
+
pip3 install tox
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
To run all the tests:
|
|
938
|
+
|
|
939
|
+
```shell
|
|
940
|
+
tox
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
To run the tests in a specific Python version:
|
|
944
|
+
|
|
945
|
+
```shell
|
|
946
|
+
tox -e py39
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
We use ``ruff`` to format the code.
|
|
950
|
+
Run this to format the code and show problems:
|
|
951
|
+
|
|
952
|
+
```shell
|
|
953
|
+
tox -e ruff
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
### New Release
|
|
957
|
+
|
|
958
|
+
To release new versions,
|
|
959
|
+
|
|
960
|
+
1. edit the Changelog Section
|
|
961
|
+
2. create a commit and push it
|
|
962
|
+
3. wait for [GitHub Actions](https://github.com/niccokunzmann/ics-query/actions) to finish the build
|
|
963
|
+
4. create a tag and push it
|
|
964
|
+
|
|
965
|
+
```shell
|
|
966
|
+
git tag v0.1.0a
|
|
967
|
+
git push origin v0.1.0a
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
5. Notify the issues about their release
|
|
971
|
+
|
|
790
972
|
## Changelog
|
|
791
973
|
|
|
974
|
+
- v0.2.0a
|
|
975
|
+
|
|
976
|
+
- Add `ics-query first <calendar> <output>` for earliest occurrences
|
|
977
|
+
- Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
|
|
978
|
+
|
|
979
|
+
- v0.1.1a
|
|
980
|
+
|
|
981
|
+
- Add `--version`
|
|
982
|
+
- Add `ics-query at <date> <calendar> <output>`
|
|
983
|
+
- Add support for multiple calendars in one input
|
|
984
|
+
|
|
985
|
+
- v0.1.0a
|
|
986
|
+
|
|
987
|
+
- Update Python version compatibility
|
|
988
|
+
- Add development documentation
|
|
989
|
+
|
|
792
990
|
- v0.0.1a
|
|
793
991
|
|
|
794
992
|
- first version
|
|
993
|
+
|
|
994
|
+
## Related Work
|
|
995
|
+
|
|
996
|
+
- [icalBuddy](https://hasseg.org/icalBuddy/)
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# ics-query
|
|
2
|
+
|
|
3
|
+
<!-- Change description also in pyproject.toml -->
|
|
4
|
+
Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
You can install this package from the [PyPI](https://pypi.org/project/ics-query/).
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
pip install ics-query
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
See how to use `ics-query`.
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
19
|
+
|
|
20
|
+
You can easily get a calendar from the web and see what is on.
|
|
21
|
+
In this example, we show which German National Holidays happen in August 2024:
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
$ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ./ics-query at 2024-08 - -
|
|
25
|
+
BEGIN:VEVENT
|
|
26
|
+
SUMMARY:Assumption Day (BY\, SL)
|
|
27
|
+
DTSTART;VALUE=DATE:20240815
|
|
28
|
+
DTEND;VALUE=DATE:20240815
|
|
29
|
+
DTSTAMP:20231013T092513Z
|
|
30
|
+
UID:65290cf9326601697189113@calendarlabs.com
|
|
31
|
+
SEQUENCE:0
|
|
32
|
+
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
|
|
33
|
+
ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
|
|
34
|
+
ook: http://fb.com/calendarlabs to get updates
|
|
35
|
+
LOCATION:Germany
|
|
36
|
+
STATUS:CONFIRMED
|
|
37
|
+
TRANSP:TRANSPARENT
|
|
38
|
+
END:VEVENT
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
In the following example, we query a calendar file and print the result.
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
$ ics-query at 2019-03-04 one-event.ics -
|
|
45
|
+
BEGIN:VEVENT
|
|
46
|
+
SUMMARY:test1
|
|
47
|
+
DTSTART;TZID=Europe/Berlin:20190304T080000
|
|
48
|
+
DTEND;TZID=Europe/Berlin:20190304T083000
|
|
49
|
+
DTSTAMP:20190303T111937
|
|
50
|
+
UID:UYDQSG9TH4DE0WM3QFL2J
|
|
51
|
+
CREATED:20190303T111937
|
|
52
|
+
LAST-MODIFIED:20190303T111937
|
|
53
|
+
END:VEVENT
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
We can concatenate calendars and pipe them into `ics-query`.
|
|
57
|
+
In the example below, we get all events that happen right now in two calendars.
|
|
58
|
+
|
|
59
|
+
```shell
|
|
60
|
+
$ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
|
|
61
|
+
BEGIN:VEVENT
|
|
62
|
+
...
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Events at Certain Times
|
|
66
|
+
|
|
67
|
+
You can query which events happen at certain times:
|
|
68
|
+
|
|
69
|
+
```shell
|
|
70
|
+
ics-query at <date-time> calendar.ics -
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
|
|
74
|
+
|
|
75
|
+
Please see the command documentation for more help:
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
ics-query at --help
|
|
79
|
+
ics-query --help
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Events within a Time Span
|
|
83
|
+
|
|
84
|
+
You can query which events happen between certain times:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
ics-query between <start> <end> calendar.ics -
|
|
88
|
+
ics-query between <start> <duration> calendar.ics -
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Please see the command documentation for more help:
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
ics-query between --help
|
|
95
|
+
ics-query --help
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Time Span Examples
|
|
99
|
+
|
|
100
|
+
This example returns the events within the next week:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
ics-query between `date +%Y%m%d` +7d calendar.ics -
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This example saves the events from the 1st of May 2024 to the 10th of June in
|
|
107
|
+
events.ics:
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
ics-query between 2024-5-1 2024-6-10 calendar.ics events.ics
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
In this example, you can check what is happening on New Years Eve 2025 around
|
|
114
|
+
midnight:
|
|
115
|
+
|
|
116
|
+
```shell
|
|
117
|
+
ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Vision
|
|
121
|
+
|
|
122
|
+
This section shows where we would like to get to.
|
|
123
|
+
|
|
124
|
+
### `ics-query at` - occurrences at certain times
|
|
125
|
+
|
|
126
|
+
You can get all **events** that happen at a certain **day**.
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
ics-query --components VEVENT at 2029-12-24 calendar.ics
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
You can get all **events** that happen **today**.
|
|
133
|
+
|
|
134
|
+
```shell
|
|
135
|
+
ics-query --components VEVENT at `date +%Y-%m-%d` calendar.ics
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You can get all **TODO**s that happen at in certain **month**.
|
|
139
|
+
|
|
140
|
+
```shell
|
|
141
|
+
ics-query --components VTODO at 2029-12-24 calendar.ics
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### `ics-query at` - time ranges
|
|
145
|
+
|
|
146
|
+
### `ics-query --output=count` - count occurrences
|
|
147
|
+
|
|
148
|
+
### `ics-query --output=ics` - use ics as output (default)
|
|
149
|
+
|
|
150
|
+
### `ics-query --select-index` - reduce output size
|
|
151
|
+
|
|
152
|
+
Examples: `0,2,4` `0-10`
|
|
153
|
+
|
|
154
|
+
### `ics-query all` - the whole calendar
|
|
155
|
+
|
|
156
|
+
### `ics-query between` - time ranges
|
|
157
|
+
|
|
158
|
+
```shell
|
|
159
|
+
ics-query between dt dt
|
|
160
|
+
ics-query between dt duration
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### `ics-query --select-component` - filter for components
|
|
164
|
+
|
|
165
|
+
### `ics-query --select-uid` - filter by uid
|
|
166
|
+
|
|
167
|
+
## How to edit an event
|
|
168
|
+
|
|
169
|
+
To edit a component like an event, you can append it to the calendar and increase the sequence number.
|
|
170
|
+
|
|
171
|
+
Example:
|
|
172
|
+
|
|
173
|
+
1. get the first event `--select-index=0` TODO: recurring-ical-events: set recurrence-id, sequence number
|
|
174
|
+
2. change the summary
|
|
175
|
+
3. increase sequence number
|
|
176
|
+
4. add the event to the end of the calendar file
|
|
177
|
+
5. show that the occurrence has changed
|
|
178
|
+
|
|
179
|
+
## Piping calendars
|
|
180
|
+
|
|
181
|
+
```shell
|
|
182
|
+
cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Notifications
|
|
186
|
+
|
|
187
|
+
Examples:
|
|
188
|
+
|
|
189
|
+
- There are x todos in the next hour
|
|
190
|
+
- There are x events today
|
|
191
|
+
- Please write a journal entry!
|
|
192
|
+
|
|
193
|
+
## Version Fixing
|
|
194
|
+
|
|
195
|
+
If you use this library in your code, you may want to make sure that
|
|
196
|
+
updates can be received but they do not break your code.
|
|
197
|
+
The version numbers are handeled this way: `a.b.c` example: `0.1.12`
|
|
198
|
+
|
|
199
|
+
- `c` is changed for each minor bug fix.
|
|
200
|
+
- `b` is changed whenever new features are added.
|
|
201
|
+
- `a` is changed when the interface or major assumptions change that may break your code.
|
|
202
|
+
|
|
203
|
+
So, I recommend to version-fix this library to stay with the same `a`
|
|
204
|
+
while `b` and `c` can change.
|
|
205
|
+
|
|
206
|
+
## Development
|
|
207
|
+
|
|
208
|
+
This section should set you up for development.
|
|
209
|
+
|
|
210
|
+
### Testing
|
|
211
|
+
|
|
212
|
+
This project's development is driven by tests.
|
|
213
|
+
Tests assure a consistent interface and less knowledge lost over time.
|
|
214
|
+
If you like to change the code, tests help that nothing breaks in the future.
|
|
215
|
+
They are required in that sense.
|
|
216
|
+
Example code and ics files can be transferred into tests and speed up fixing bugs.
|
|
217
|
+
|
|
218
|
+
You can view the tests in the [test folder](https://github.com/niccokunzmann/ics-query/tree/main/ics_query/tests)
|
|
219
|
+
If you have a calendar ICS file for which this library does not
|
|
220
|
+
generate the desired output, you can add it to the ``test/calendars``
|
|
221
|
+
folder and write tests for what you expect.
|
|
222
|
+
If you like, [open an issue](https://github.com/niccokunzmann/ics-query/issues) first, e.g. to discuss the changes and
|
|
223
|
+
how to go about it.
|
|
224
|
+
|
|
225
|
+
To run the tests, we use `tox`.
|
|
226
|
+
`tox` tests all different Python versions which we want to be compatible to.
|
|
227
|
+
|
|
228
|
+
```shell
|
|
229
|
+
pip3 install tox
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
To run all the tests:
|
|
233
|
+
|
|
234
|
+
```shell
|
|
235
|
+
tox
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
To run the tests in a specific Python version:
|
|
239
|
+
|
|
240
|
+
```shell
|
|
241
|
+
tox -e py39
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
We use ``ruff`` to format the code.
|
|
245
|
+
Run this to format the code and show problems:
|
|
246
|
+
|
|
247
|
+
```shell
|
|
248
|
+
tox -e ruff
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### New Release
|
|
252
|
+
|
|
253
|
+
To release new versions,
|
|
254
|
+
|
|
255
|
+
1. edit the Changelog Section
|
|
256
|
+
2. create a commit and push it
|
|
257
|
+
3. wait for [GitHub Actions](https://github.com/niccokunzmann/ics-query/actions) to finish the build
|
|
258
|
+
4. create a tag and push it
|
|
259
|
+
|
|
260
|
+
```shell
|
|
261
|
+
git tag v0.1.0a
|
|
262
|
+
git push origin v0.1.0a
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
5. Notify the issues about their release
|
|
266
|
+
|
|
267
|
+
## Changelog
|
|
268
|
+
|
|
269
|
+
- v0.2.0a
|
|
270
|
+
|
|
271
|
+
- Add `ics-query first <calendar> <output>` for earliest occurrences
|
|
272
|
+
- Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
|
|
273
|
+
|
|
274
|
+
- v0.1.1a
|
|
275
|
+
|
|
276
|
+
- Add `--version`
|
|
277
|
+
- Add `ics-query at <date> <calendar> <output>`
|
|
278
|
+
- Add support for multiple calendars in one input
|
|
279
|
+
|
|
280
|
+
- v0.1.0a
|
|
281
|
+
|
|
282
|
+
- Update Python version compatibility
|
|
283
|
+
- Add development documentation
|
|
284
|
+
|
|
285
|
+
- v0.0.1a
|
|
286
|
+
|
|
287
|
+
- first version
|
|
288
|
+
|
|
289
|
+
## Related Work
|
|
290
|
+
|
|
291
|
+
- [icalBuddy](https://hasseg.org/icalBuddy/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.venv/bin/ics-query
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '0.
|
|
16
|
-
__version_tuple__ = version_tuple = (0,
|
|
15
|
+
__version__ = version = '0.2.0a0'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 2, 0)
|