1
0
This commit is contained in:
Jon Michael Aanes 2025-03-16 22:01:01 +01:00
parent b690ffc51c
commit 2636127045

View File

@ -194,8 +194,9 @@ def import_activity_samples(
group_category: str | None = None,
default_estimated_duration: datetime.timedelta | None = None,
) -> int:
samples = heuristically_realize_samples(raw_samples,
default_estimated_duration=default_estimated_duration)
samples = heuristically_realize_samples(
raw_samples, default_estimated_duration=default_estimated_duration,
)
if group_category is not None:
samples = merge_adjacent_samples(list(samples), group_category)
@ -233,6 +234,7 @@ def import_activity_samples(
return num_updated
def import_activity_sample_csv(
vault: ObsidianVault,
rows: Rows,
@ -273,7 +275,11 @@ def import_wanikani_events(vault: ObsidianVault, rows: Rows):
for row in rows:
for k in keys:
if k in row:
raw_samples.append(ActivitySample([Label('application.name', 'WaniKani')], None, row[k]))
raw_samples.append(
ActivitySample(
[Label('application.name', 'WaniKani')], None, row[k],
),
)
del k
del row
@ -285,9 +291,14 @@ def import_wanikani_events(vault: ObsidianVault, rows: Rows):
comment='',
)
return import_activity_samples(vault, raw_samples, mapper,
group_category='application.name',
default_estimated_duration=datetime.timedelta(minutes=5))
return import_activity_samples(
vault,
raw_samples,
mapper,
group_category='application.name',
default_estimated_duration=datetime.timedelta(minutes=5),
)
PATH_WATCHED = Path('output/show_episodes_watched.csv')
PATH_PLAYED = Path('output/games_played.csv')
@ -300,7 +311,11 @@ PATH_STEPMANIA = Path('output/stepmania.csv')
IMPORTERS = [
{'path': PATH_WANIKANI, 'standard_variant': True, 'import_rows': import_wanikani_events},
{
'path': PATH_WANIKANI,
'standard_variant': True,
'import_rows': import_wanikani_events,
},
{'path': PATH_WORKOUT, 'standard_variant': True, 'import_rows': import_workout_csv},
{'path': PATH_STEP_COUNTS, 'import_rows': import_step_counts_csv},
{