ics-query 0.1.0a0__tar.gz → 0.1.dev1__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.
Files changed (63) hide show
  1. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/.github/ISSUE_TEMPLATE/bug_report.md +2 -8
  2. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/.github/workflows/tests.yml +82 -18
  3. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/PKG-INFO +366 -43
  4. ics_query-0.1.dev1/README.md +488 -0
  5. ics_query-0.1.dev1/conftest.py +15 -0
  6. ics_query-0.1.dev1/ics-query +1 -0
  7. ics_query-0.1.dev1/ics-query.cmd +3 -0
  8. ics_query-0.1.dev1/ics-query.py +5 -0
  9. ics_query-0.1.dev1/ics_query/__init__.py +27 -0
  10. ics_query-0.1.dev1/ics_query/__main__.py +20 -0
  11. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/ics_query/_version.py +2 -2
  12. ics_query-0.1.dev1/ics_query/cli.py +694 -0
  13. ics_query-0.1.dev1/ics_query/parse.py +87 -0
  14. ics_query-0.1.dev1/ics_query/query.py +78 -0
  15. ics_query-0.1.dev1/ics_query/tests/conftest.py +126 -0
  16. ics_query-0.1.dev1/ics_query/tests/runs/all --tz Singapore one-event.ics -.run +9 -0
  17. ics_query-0.1.dev1/ics_query/tests/runs/all three-events.ics -.run +33 -0
  18. ics_query-0.1.dev1/ics_query/tests/runs/at 2019-03-04 multiple-calendars.ics -.run +20 -0
  19. ics_query-0.1.dev1/ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run +18 -0
  20. ics_query-0.1.dev1/ics_query/tests/runs/at 2019-03-07 multiple-calendars.ics -.run +11 -0
  21. ics_query-0.1.dev1/ics_query/tests/runs/at 2024-08-20 Berlin-Los-Angeles.ics -.run +23 -0
  22. ics_query-0.1.dev1/ics_query/tests/runs/between 20240823 4d recurring-work-events.ics -.run +24 -0
  23. ics_query-0.1.dev1/ics_query/tests/runs/calendars/Berlin-Los-Angeles.ics +381 -0
  24. ics_query-0.1.dev1/ics_query/tests/runs/calendars/empty-calendar.ics +7 -0
  25. ics_query-0.1.dev1/ics_query/tests/runs/calendars/empty-file.ics +0 -0
  26. ics_query-0.1.dev1/ics_query/tests/runs/calendars/multiple-calendars.ics +71 -0
  27. ics_query-0.1.dev1/ics_query/tests/runs/calendars/one-event-twice.ics +68 -0
  28. ics_query-0.1.dev1/ics_query/tests/runs/calendars/one-event-without-timezone.ics +14 -0
  29. ics_query-0.1.dev1/ics_query/tests/runs/calendars/recurring-work-events.ics +223 -0
  30. ics_query-0.1.dev1/ics_query/tests/runs/calendars/simple-journal.ics +15 -0
  31. ics_query-0.1.dev1/ics_query/tests/runs/calendars/simple-todo.ics +15 -0
  32. ics_query-0.1.dev1/ics_query/tests/runs/calendars/three-events.ics +37 -0
  33. ics_query-0.1.dev1/ics_query/tests/runs/first -c VJOURNAL -c VEVENT one-event.ics -.run +9 -0
  34. ics_query-0.1.dev1/ics_query/tests/runs/first -c VJOURNAL one-event.ics -.run +0 -0
  35. ics_query-0.1.dev1/ics_query/tests/runs/first -c VJOURNAL simple-journal.ics -.run +12 -0
  36. ics_query-0.1.dev1/ics_query/tests/runs/first -c VTODO -c VJOURNAL simple-todo.ics -.run +10 -0
  37. ics_query-0.1.dev1/ics_query/tests/runs/first -c VTODO simple-todo.ics -.run +10 -0
  38. ics_query-0.1.dev1/ics_query/tests/runs/first empty-calendar.ics -.run +0 -0
  39. ics_query-0.1.dev1/ics_query/tests/runs/first empty-file.ics -.run +0 -0
  40. ics_query-0.1.dev1/ics_query/tests/runs/first recurring-work-events.ics -.run +12 -0
  41. ics_query-0.1.dev1/ics_query/tests/test_command_line.py +72 -0
  42. ics_query-0.1.dev1/ics_query/tests/test_parse_date.py +81 -0
  43. ics_query-0.1.dev1/ics_query/tests/test_parse_timedelta.py +40 -0
  44. ics_query-0.1.dev1/ics_query/version.py +49 -0
  45. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/pyproject.toml +27 -8
  46. ics_query-0.1.dev1/renovate.json +18 -0
  47. ics_query-0.1.dev1/tox.ini +49 -0
  48. ics_query-0.1.0a0/README.md +0 -170
  49. ics_query-0.1.0a0/ics_query/__init__.py +0 -11
  50. ics_query-0.1.0a0/ics_query/__main__.py +0 -5
  51. ics_query-0.1.0a0/ics_query/cli.py +0 -92
  52. ics_query-0.1.0a0/ics_query/parse.py +0 -13
  53. ics_query-0.1.0a0/ics_query/tests/conftest.py +0 -78
  54. ics_query-0.1.0a0/ics_query/tests/test_command_line.py +0 -10
  55. ics_query-0.1.0a0/ics_query/version.py +0 -16
  56. ics_query-0.1.0a0/tox.ini +0 -20
  57. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/.github/FUNDING.yml +0 -0
  58. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/.github/dependabot.yml +0 -0
  59. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/.gitignore +0 -0
  60. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/LICENSE +0 -0
  61. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/ics_query/tests/__init__.py +0 -0
  62. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/ics_query/tests/runs/at 2019-03-04 one-event.ics -.run +0 -0
  63. {ics_query-0.1.0a0 → ics_query-0.1.dev1}/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
- pip list
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 directory`
42
+ - [ ] add a test in `ics_query/tests/runs`
49
43
  - [ ] fix the bug and ensure the test code passes
@@ -14,14 +14,15 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  config:
17
- # [Python version, tox env]
18
- - ["3.9", "py39"]
19
- - ["3.10", "py310"]
20
- - ["3.11", "py311"]
21
- - ["3.12", "py312"]
22
- - ["3.9", "ruff"]
17
+ # [Python version, tox env, OS]
18
+ - ["3.9", "py39", "ubuntu-latest"]
19
+ - ["3.10", "py310", "ubuntu-latest"]
20
+ - ["3.11", "py311", "ubuntu-latest"]
21
+ - ["3.12", "py312", "ubuntu-latest"]
22
+ - ["3.9", "ruff", "ubuntu-latest"]
23
+ - ["3.11", "exe", "windows-latest"]
23
24
 
24
- runs-on: ubuntu-latest
25
+ runs-on: ${{ matrix.config[2] }}
25
26
  name: ${{ matrix.config[1] }}
26
27
  steps:
27
28
  - uses: actions/checkout@v4
@@ -29,14 +30,6 @@ jobs:
29
30
  uses: actions/setup-python@v5
30
31
  with:
31
32
  python-version: ${{ matrix.config[0] }}
32
- - name: Pip cache
33
- uses: actions/cache@v4
34
- with:
35
- path: ~/.cache/pip
36
- key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
37
- restore-keys: |
38
- ${{ runner.os }}-pip-${{ matrix.config[0] }}-
39
- ${{ runner.os }}-pip-
40
33
  - name: Install dependencies
41
34
  run: |
42
35
  python -m pip install --upgrade pip
@@ -44,13 +37,64 @@ jobs:
44
37
  - name: Test
45
38
  run: |
46
39
  tox -e ${{ matrix.config[1] }}
40
+ - uses: actions/upload-artifact@v4
41
+ with:
42
+ name: dist-${{ matrix.config[1] }}-${{ matrix.config[2] }} # dist-exe-windows-latest
43
+ path: dist
44
+ if-no-files-found: ignore
45
+ retention-days: 1
46
+ compression-level: 0
47
+
48
+ version:
49
+ name: "Determine a new version"
50
+ if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
51
+ runs-on: ubuntu-latest
52
+ outputs:
53
+ # see https://docs.github.com/de/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#example-usage-of-the-jobs-context
54
+ version: ${{ steps.version.outputs.version }}
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+
58
+ - name: "Get tags"
59
+ uses: actions-ecosystem/action-get-latest-tag@v1
60
+ id: get-latest-tag
61
+
62
+ - name: "Calculate new version"
63
+ uses: actions-ecosystem/action-bump-semver@v1
64
+ id: bump-semver
65
+ with:
66
+ current_version: ${{ steps.get-latest-tag.outputs.tag }}
67
+ level: patch
68
+
69
+ - name: "Determine version to use"
70
+ id: version
71
+ run: |
72
+ if [ "$GITHUB_REF" == "refs/heads/main" ]; then
73
+ TAG="${{ steps.get-latest-tag.outputs.tag }}"
74
+ echo "On branch main. Using new tag version $TAG."
75
+ else
76
+ TAG="${{ steps.bump-semver.outputs.new_version }}"
77
+ echo "On tag $TAG. Using that version."
78
+ fi
79
+ echo "::set-output name=version::$TAG"
80
+
81
+ - name: Publish new tag id possible
82
+ # continue on error: when the tag exists we would like to still work it out
83
+ continue-on-error: true
84
+ uses: actions-ecosystem/action-push-tag@v1
85
+ with:
86
+ tag: ${{ steps.version.outputs.version }}
87
+ message: |
88
+ ${{ steps.version.outputs.version }}: automatic release
89
+ PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}
47
90
 
48
91
  deploy-tag-to-pypi:
49
92
  name: Publish Package on PyPI
50
93
  # only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
51
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
94
+ if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
52
95
  needs:
53
96
  - run-tests
97
+ - version
54
98
  runs-on: ubuntu-latest
55
99
  # This environment stores the TWINE_USERNAME and TWINE_PASSWORD
56
100
  # see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
@@ -95,19 +139,39 @@ jobs:
95
139
  twine check dist/*
96
140
  twine upload dist/*
97
141
 
142
+ # artifact-check:
143
+ # name: artifact check
144
+ # runs-on: ubuntu-latest
145
+ # needs:
146
+ # - run-tests
147
+ # steps:
148
+ # - uses: actions/download-artifact@v4
149
+ # with:
150
+ # pattern: dist-*
151
+ # path: dist
152
+ # - run: ls -R dist
153
+
98
154
  github-release:
99
155
  name: "Publish GitHub Release"
100
156
  # only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
101
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
157
+ if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
102
158
  needs:
103
159
  - run-tests
104
160
  - deploy-tag-to-pypi
161
+ - version
105
162
  runs-on: ubuntu-latest
106
163
  steps:
107
164
  - uses: actions/checkout@v4
165
+ - uses: actions/download-artifact@v4
166
+ with:
167
+ pattern: dist-*
168
+ path: dist
169
+ - run: ls -R dist
108
170
  - name: create release
109
171
  uses: ncipollo/release-action@v1
110
172
  with:
111
173
  allowUpdates: true
112
174
  body: "For a list of changes, please refer to the [Changelog](https://github.com/niccokunzmann/ics-query#changelog)."
113
- generateReleaseNotes: false
175
+ generateReleaseNotes: false
176
+ artifacts: "dist/dist-exe-windows-latest/ics-query.exe"
177
+ tag: ${{ needs.version.outputs.version }}
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ics-query
3
- Version: 0.1.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.
3
+ Version: 0.1.dev1
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/cf4aefe6fb80c98ee554f4030ce9b2e7f16db162.zip
7
+ Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/32d7474b3079da3e7ff40136067b4f68586e7a0e.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,7 +686,7 @@ 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 :: 3 - Alpha
689
+ Classifier: Development Status :: 5 - Production/Stable
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
@@ -695,100 +695,328 @@ Classifier: Programming Language :: Python :: 3.10
695
695
  Classifier: Programming Language :: Python :: 3.11
696
696
  Classifier: Programming Language :: Python :: 3.12
697
697
  Classifier: Topic :: Office/Business :: Scheduling
698
- Requires-Python: >=3.8
699
- Requires-Dist: click
700
- Requires-Dist: icalendar
701
- Requires-Dist: recurring-ical-events
698
+ Requires-Python: >=3.9
699
+ Requires-Dist: click==8.1.7
700
+ Requires-Dist: icalendar==6.0.0
701
+ Requires-Dist: python-dateutil==2.9.0.post0
702
+ Requires-Dist: recurring-ical-events==3.3.2
703
+ Requires-Dist: six==1.16.0
704
+ Requires-Dist: tzdata==2024.2
705
+ Requires-Dist: tzlocal==5.2
706
+ Requires-Dist: x-wr-timezone==1.0.1
702
707
  Provides-Extra: test
703
708
  Requires-Dist: pytest; extra == 'test'
704
709
  Description-Content-Type: text/markdown
705
710
 
706
711
  # ics-query
707
712
 
713
+ [![GitHub Actions CI](https://github.com/niccokunzmann/ics-query/actions/workflows/tests.yml/badge.svg)][GitHub Actions]
714
+ [![PyPI Version](https://badge.fury.io/py/ics-query.svg)][PyPI]
715
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/ics-query.svg)][PyPI]
716
+ [![Support on Open Collective](https://img.shields.io/opencollective/all/open-web-calendar?label=support%20on%20open%20collective)][Open Collective]
717
+ [![Fund Issues with Polar](https://img.shields.io/github/issues/niccokunzmann/ics-query?logo=github&label=issues%20seek%20funding&color=%230062ff)][Polar]
718
+
708
719
  <!-- Change description also in pyproject.toml -->
709
720
  Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
710
721
 
711
722
  ## Installation
712
723
 
713
- You can install this package from the [PyPI](https://pypi.org/project/ics-query/).
724
+ You can install this package from the [PyPI].
714
725
 
715
726
  ```shell
716
727
  pip install ics-query
717
728
  ```
718
729
 
719
- ## `ics-query at` - occurrences at certain times
730
+ For **Windows**, you can download `ics-query.exe` from our [Releases].
731
+
732
+ ## Support
733
+
734
+ - Support using [GitHub Sponsors]
735
+ - Fund specific issues using [Polar]
736
+ - Support using [Open Collective]
737
+ - Support using [thanks.dev]
738
+
739
+ We accept donations to sustain our work, once or regular.
740
+ Consider donating money to open-source as everyone benefits.
741
+
742
+ ## Supported Features
743
+
744
+ This library is based on
745
+
746
+ - [recurring-ical-events]
747
+ - [icalendar]
748
+ - [x-wr-timezone]
749
+
750
+ [recurring-ical-events]: https://pypi.org/project/recurring-ical-events/
751
+ [icalendar]: https://pypi.org/project/icalendar/
752
+ [x-wr-timezone]: https://pypi.org/project/x-wr-timezone/
753
+
754
+ For a list of supported features and RFC compatibility,
755
+ please refer to their documentation, too.
756
+
757
+ ## Usage
758
+
759
+ `ics-query` is a command line tool that aims to make icalendar occurance calculations
760
+ accessible and easy.
761
+ This section walks you though the different functionalities.
762
+
763
+ ```shell
764
+ ics-query --help
765
+ ```
766
+
767
+ ### Examples
768
+
769
+ You can get a calendar from the web and see what is on.
770
+ In this example, we show which German National Holidays happening in August 2024:
771
+
772
+ ```shell
773
+ $ wget -qO- 'https://www.calendarlabs.com/ical-calendar/ics/46/Germany_Holidays.ics' | ics-query at 2024-08 - -
774
+ BEGIN:VEVENT
775
+ SUMMARY:Assumption Day (BY\, SL)
776
+ DTSTART;VALUE=DATE:20240815
777
+ DTEND;VALUE=DATE:20240815
778
+ DTSTAMP:20231013T092513Z
779
+ UID:65290cf9326601697189113@calendarlabs.com
780
+ SEQUENCE:0
781
+ DESCRIPTION:Visit https://calendarlabs.com/holidays/us/the-assumption-of-m
782
+ ary.php to know more about Assumption Day (BY\, SL). \n\n Like us on Faceb
783
+ ook: http://fb.com/calendarlabs to get updates
784
+ LOCATION:Germany
785
+ STATUS:CONFIRMED
786
+ TRANSP:TRANSPARENT
787
+ END:VEVENT
788
+ ```
789
+
790
+ In the following example, we query a calendar file and print the result.
791
+
792
+ ```shell
793
+ $ ics-query at 2019-03-04 one-event.ics -
794
+ BEGIN:VEVENT
795
+ SUMMARY:test1
796
+ DTSTART;TZID=Europe/Berlin:20190304T080000
797
+ DTEND;TZID=Europe/Berlin:20190304T083000
798
+ DTSTAMP:20190303T111937
799
+ UID:UYDQSG9TH4DE0WM3QFL2J
800
+ CREATED:20190303T111937
801
+ LAST-MODIFIED:20190303T111937
802
+ END:VEVENT
803
+ ```
804
+
805
+ We can concatenate calendars and pipe them into `ics-query`.
806
+ In the example below, we get all events that happen right now in two calendars.
807
+
808
+ ```shell
809
+ $ cat calendar1.ics calendar2.ics | ics-query at `date +%Y%m%d%H%M%S` - -
810
+ BEGIN:VEVENT
811
+ ...
812
+ ```
813
+
814
+ #### Piping calendars
815
+
816
+ You can pipe one or more calendars into the input.
817
+
818
+ ```shell
819
+ cat calendar.ics | ics-query first -
820
+ ```
821
+
822
+ ### Events at Certain Times
823
+
824
+ You can query which events happen at certain times:
825
+
826
+ ```shell
827
+ ics-query at TIME calendar.ics -
828
+ ```
829
+
830
+ The format of TIME:
831
+
832
+ | TIME | description |
833
+ | ------- | ----------- |
834
+ | `2019` | the whole year 2019 |
835
+ | `2019-08` | August 2019 |
836
+ | `2019-08-12` | 12th of August 2019 |
837
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
838
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
839
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
840
+
841
+
842
+ Please see the command documentation for more help:
843
+
844
+ ```shell
845
+ ics-query at --help
846
+ ics-query --help
847
+ ```
720
848
 
721
849
  You can get all **events** that happen at a certain **day**.
722
850
 
723
851
  ```shell
724
- ics-query --components VEVENT at 2029-12-24 calendar.ics
852
+ ics-query at --components VEVENT 2029-12-24 calendar.ics
725
853
  ```
726
854
 
727
855
  You can get all **events** that happen **today**.
728
856
 
729
857
  ```shell
730
- ics-query --components VEVENT at `date +%Y-%m-%d` calendar.ics
858
+ ics-query at --components VEVENT `date +%Y-%m-%d` calendar.ics
731
859
  ```
732
860
 
733
- You can get all **TODO**s that happen at in certain **month**.
861
+ You can get all **TODO**s that happen in a certain **month**.
734
862
 
735
863
  ```shell
736
- ics-query --components VTODO at 2029-12-24 calendar.ics
864
+ ics-query at --components VTODO 2029-12-24 calendar.ics
737
865
  ```
738
866
 
739
- ## `ics-query at` - time ranges
867
+ ### Events within a Time Span
740
868
 
869
+ You can query which events happen between certain times:
741
870
 
742
- ## `ics-query --output=count` - count occurrences
871
+ ```shell
872
+ ics-query between START END calendar.ics -
873
+ ics-query between START DURATION calendar.ics -
874
+ ```
743
875
 
876
+ Please see the command documentation for more help:
744
877
 
745
- ## `ics-query --output=ics` - use ics as output (default)
878
+ ```shell
879
+ ics-query between --help
880
+ ics-query --help
881
+ ```
746
882
 
883
+ The format of START and END with examples:
747
884
 
748
- ## `ics-query --select-index` - reduce output size
885
+ | START or END | Description |
886
+ | ------- | ----------- |
887
+ | `2019` | the whole year 2019 |
888
+ | `2019-08` | August 2019 |
889
+ | `2019-08-12` | 12th of August 2019 |
890
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
891
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
892
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
749
893
 
750
- Examples: `0,2,4` `0-10`
894
+ Instead of an absolute time, you can specify a duration after the START.
895
+ The `+` is optional.
751
896
 
752
- ## `ics-query all` - the whole calendar
897
+ | DURATION | Description |
898
+ | ------- | ----------- |
899
+ | `+1d` | one more day |
900
+ | `+1h` | one more hour |
901
+ | `+1m` | one more minute |
902
+ | `+1s` | one more second |
903
+ | `+3600s` | one more hour or 3600 seconds |
904
+ | `+5d10h` | five more days and 10 more hours |
753
905
 
754
- ## `ics-query between` - time ranges
906
+ ### Time Span Examples
907
+
908
+ This example returns the occurrences within the **next week**:
755
909
 
756
910
  ```shell
757
- ics-query between dt dt
758
- ics-query between dt duration
911
+ ics-query between `date +%Y%m%d` +7d calendar.ics -
759
912
  ```
760
913
 
761
- ## `ics-query --select-component` - filter for components
914
+ This example saves the **events** from the **1st of May 2024 to the 10th of June** in
915
+ events.ics:
762
916
 
917
+ ```shell
918
+ ics-query between --component VEVENT 2024-5-1 2024-6-10 calendar.ics events.ics
919
+ ```
763
920
 
764
- ## `ics-query --select-uid` - filter by uid
921
+ In this example, you can check what is happening on **New Years Eve 2025** around
922
+ midnight:
765
923
 
924
+ ```shell
925
+ ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
926
+ ```
766
927
 
767
- ## How to edit an event
928
+ ### `ics-query all` - the whole calendar
768
929
 
769
- To edit a component like an event, you can append it to the calendar and increase the sequence number.
930
+ You can get everything that is happening in a calendar but that can be a lot!
770
931
 
771
- Example:
932
+ ```shell
933
+ ics-query all calendar.ics
934
+ ```
772
935
 
773
- 1. get the first event `--select-index=0` TODO: recurring-ical-events: set recurrence-id, sequence number
774
- 2. change the summary
775
- 3. increase sequence number
776
- 4. add the event to the end of the calendar file
777
- 5. show that the occurrence has changed
936
+ ### Filtering Components
937
+
938
+ We support different component types: `VEVENT`, `VJOURNAL` and `VTODO`.
939
+ By default, we include all types in the result.
778
940
 
779
- ## Piping calendars
941
+ You can specify which components you would like to get using the
942
+ `--component` or `-c` parameter.
780
943
 
781
944
  ```shell
782
- cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
945
+ -c VEVENT # only events
946
+ -c VTODO # only TODOs
947
+ -c VJOURNAL # only journal entries
948
+ -c VEVENT -c VTODO # only events and journal entries
783
949
  ```
784
950
 
785
- ## Notifications
951
+ This example returns the first event of a calendar.
786
952
 
787
- Examples:
953
+ ```shell
954
+ ics-query first -c VEVENT calendar.ics -
955
+ ```
956
+
957
+ This option is also available as `ICS_QUERY_COMPONENT` variable.
958
+
959
+ ```shell
960
+ export ICS_QUERY_COMPONENT=VEVENT
961
+ # from now on, you will get only events
962
+ ics-query first calendar.ics
963
+ ```
964
+
965
+ Please see the command documentation for more help:
966
+
967
+ ```shell
968
+ ics-query --help
969
+ ```
788
970
 
789
- - There are x todos in the next hour
790
- - There are x events today
791
- - Please write a journal entry!
971
+
972
+ ### Timezones
973
+
974
+ You can set the timezone of the query, otherwise the event's local timezone is used and you
975
+ might miss events in your own timezone.
976
+
977
+ The first event at New Year 2000 in the **event's local time**:
978
+
979
+ ```shell
980
+ ics-query at 2000-01-01 calendar.ics
981
+ ```
982
+
983
+ The first event at New Year 2000 in **your local time**:
984
+
985
+ ```shell
986
+ ics-query at --tz=localtime 2000-01-01 calendar.ics
987
+ ```
988
+
989
+ The first event at New Year 2000 in **UTC**:
990
+
991
+ ```shell
992
+ ics-query at --tz=UTC 2000-01-01 calendar.ics
993
+ ```
994
+
995
+ The first event at New Year 2000 in **Berlin time**:
996
+
997
+ ```shell
998
+ ics-query at --tz=Europe/Berlin 2000-01-01 calendar.ics
999
+ ```
1000
+
1001
+ You can also use the `ICS_QUERY_TZ` variable.
1002
+
1003
+ ```shell
1004
+ export ICS_QUERY_TZ=localtime
1005
+ # from now on, we use your local time
1006
+ ics-query at 2000-01-01 calendar.ics
1007
+ ```
1008
+
1009
+ For all avaiable timezones see:
1010
+
1011
+ ```shell
1012
+ ics-query --available-timezones
1013
+ ```
1014
+
1015
+ Please see the command documentation for more help:
1016
+
1017
+ ```shell
1018
+ ics-query --help
1019
+ ```
792
1020
 
793
1021
  ## Version Fixing
794
1022
 
@@ -805,7 +1033,7 @@ while `b` and `c` can change.
805
1033
 
806
1034
  ## Development
807
1035
 
808
- This section should set you up for development.
1036
+ This section should set you up for developing `ics-query`.
809
1037
 
810
1038
  ### Testing
811
1039
 
@@ -848,23 +1076,72 @@ Run this to format the code and show problems:
848
1076
  tox -e ruff
849
1077
  ```
850
1078
 
851
- ## New Release
1079
+ ### New Release
852
1080
 
853
1081
  To release new versions,
854
1082
 
855
1083
  1. edit the Changelog Section
856
1084
  2. create a commit and push it
857
- 3. wait for [GitHub Actions](https://github.com/niccokunzmann/ics-query/actions) to finish the build
1085
+ 3. wait for [GitHub Actions] to finish the build
858
1086
  4. create a tag and push it
859
1087
 
860
1088
  ```shell
861
1089
  git tag v0.1.0a
1090
+ git push origin v0.1.0a
862
1091
  ```
863
1092
 
864
1093
  5. Notify the issues about their release
865
1094
 
866
1095
  ## Changelog
867
1096
 
1097
+ We automatically release the versions that only update dependencies.
1098
+ If the version you installed does not show up here, only the dependencies
1099
+ have been updated.
1100
+
1101
+ - v0.4.1
1102
+
1103
+ - Automatic release with patch level version number increased
1104
+ - Increase patch version instead of minor version for automatic releases
1105
+
1106
+ - v0.3.4
1107
+
1108
+ - Update dependencies
1109
+ - Start automatic release of dependencies increasing the version number
1110
+
1111
+ - v0.3.3b
1112
+
1113
+ - Update dependencies
1114
+
1115
+ - v0.3.2b
1116
+
1117
+ - Fix that `--tz localtime` would use `localtime` as timezone name instead of the local timezone name.
1118
+ - Fix tests on Windows
1119
+ - Add Windows .exe build artifact
1120
+
1121
+ - v0.3.1b
1122
+
1123
+ - Add `--license` option
1124
+
1125
+ - v0.3.0b
1126
+
1127
+ - Add `--tz` timezone parameter
1128
+ - Add `ics-query all` to get all occurrences
1129
+
1130
+ - v0.2.1a
1131
+
1132
+ - Add `--component` to filter component types VEVENT, VJOURNAL and VTODO
1133
+
1134
+ - v0.2.0a
1135
+
1136
+ - Add `ics-query first <calendar> <output>` for earliest occurrences
1137
+ - Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
1138
+
1139
+ - v0.1.1a
1140
+
1141
+ - Add `--version`
1142
+ - Add `ics-query at <date> <calendar> <output>`
1143
+ - Add support for multiple calendars in one input
1144
+
868
1145
  - v0.1.0a
869
1146
 
870
1147
  - Update Python version compatibility
@@ -873,3 +1150,49 @@ To release new versions,
873
1150
  - v0.0.1a
874
1151
 
875
1152
  - first version
1153
+
1154
+ ## Related Work
1155
+
1156
+ - [icalBuddy](https://hasseg.org/icalBuddy/)
1157
+ - [Blog Post](https://opencollective.com/open-web-calendar/updates/calendar-calculation-on-the-command-line-ics-query)
1158
+ - [#icsquery on mastodon](https://toot.wales/tags/icsquery)
1159
+
1160
+ ## Vision
1161
+
1162
+ This section shows where we would like to get to.
1163
+
1164
+ ### `ics-query --select-index` - reduce output size
1165
+
1166
+ Examples: `0,2,4` `0-10`
1167
+
1168
+
1169
+ ### `ics-query --select-uid` - filter by uid
1170
+
1171
+ ### How to edit an event
1172
+
1173
+ To edit a component like an event, you can append it to the calendar and increase the sequence number.
1174
+
1175
+ Example:
1176
+
1177
+ 1. get the event `--select-index=0`
1178
+ 2. change the summary
1179
+ 3. increase sequence number
1180
+ 4. add the event to the end of the calendar file
1181
+ 5. show that the occurrence has changed
1182
+
1183
+
1184
+ ### Notifications
1185
+
1186
+ Examples:
1187
+
1188
+ - There are x todos in the next hour
1189
+ - There are x events today
1190
+ - Please write a journal entry!
1191
+
1192
+ [PyPI]: https://pypi.org/project/ics-query/
1193
+ [GitHub Actions]: https://github.com/niccokunzmann/ics-query/actions
1194
+ [Open Collective]: https://opencollective.com/open-web-calendar/
1195
+ [Polar]: https://polar.sh/niccokunzmann/ics-query
1196
+ [GitHub Sponsors]: https://github.com/sponsors/niccokunzmann
1197
+ [thanks.dev]: https://thanks.dev
1198
+ [Releases]: https://github.com/niccokunzmann/ics-query/releases