icalfilter: do some work to make it work again

This commit is contained in:
Luke Granger-Brown 2023-06-18 20:32:25 +01:00
parent 364eaa2c55
commit c46298132e
3 changed files with 10 additions and 11 deletions

View file

@ -114,6 +114,8 @@ async def all_occurrences_before(
) -> bool:
parsed_event = icalevents.icalparser.create_event(event, cutoff.tzinfo)
if not parsed_event.recurring:
if type(parsed_event.end) is datetime.date:
return parsed_event.end < cutoff.date()
return parsed_event.end < cutoff
loop = asyncio.get_running_loop()
@ -127,11 +129,12 @@ async def keep_event(
event: icalendar.Event,
seen_timezones: Dict[str, icalendar.Timezone],
) -> bool:
summary = event.get('summary', '')
if source_cal.keep_hashtags:
if not contains_any_hashtag(event["summary"], source_cal.keep_hashtags):
if not contains_any_hashtag(summary, source_cal.keep_hashtags):
return False
if source_cal.drop_hashtags:
if contains_any_hashtag(event["summary"], source_cal.drop_hashtags):
if contains_any_hashtag(summary, source_cal.drop_hashtags):
return False
if source_cal.skip_before:
if "dtstart" not in event:

View file

@ -25,16 +25,12 @@ let
icalevents = ps: ps.buildPythonPackage rec {
pname = "icalevents";
version = "0.1.26";
version = "0.1.27";
format = "pyproject";
prePatch = ''
substituteInPlace pyproject.toml \
--replace 'pytz = "==2021.3"' 'pytz = "*"' \
--replace '= "==' '= "^'
'';
nativeBuildInputs = with ps; [ poetry-core pythonRelaxDepsHook ];
nativeBuildInputs = with ps; [ poetry-core ];
pythonRelaxDeps = true;
propagatedBuildInputs = with ps; [
httplib2
@ -48,7 +44,7 @@ let
owner = "jazzband";
repo = pname;
rev = "v${version}";
hash = "sha256:06mq3nzn7vipmb1jvw3c05cw3k3bgvkgs02xqzry94pjvbn0nmiz";
hash = "sha256:191j9ki8y5gg9g34ilx6yv5vghxm1gch413cw42pb3a1j48109mx";
};
};

View file

@ -8,7 +8,7 @@ let
!package.json
!package-lock.json
'' ./.;
nodeComposition = import ./node-composition.nix { inherit pkgs; };
nodeComposition = import ./node-composition.nix { inherit pkgs; nodejs = pkgs."nodejs_20"; };
in
pkgs.runCommand "icalfilter-webui" {
inherit src;