Skip to content

Commit 96352fd

Browse files
committed
Add extractor tasks to task class; copy video at end of session
1 parent e72de7f commit 96352fd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

iblrig_custom_tasks/_sp_passiveVideo/task.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
TODO Add custom task list to Session class
55
"""
66
import time
7+
import shutil
78
from pathlib import Path
89
from collections import defaultdict
910
from functools import partial
@@ -157,6 +158,7 @@ class Session(BpodMixin):
157158
"""Play a single video."""
158159

159160
protocol_name = '_sp_passiveVideo'
161+
extractor_tasks = ['PassiveVideoTimeline']
160162

161163
def __init__(self, **kwargs):
162164
super().__init__(**kwargs)
@@ -179,6 +181,14 @@ def save(self):
179181
if 20 > self._log_level > 0:
180182
stats = self.video.stats
181183
stats.to_parquet(self.paths.STATS_FILE_PATH)
184+
if self.video._media and self.video._media.get_mrl().endswith(str(self.task_params.VIDEO)):
185+
ext = Path(self.task_params.VIDEO).suffix
186+
video_file_path = self.paths.DATA_FILE_PATH.with_name(f'_sp_video.raw{ext}')
187+
_logger.info('Copying %s -> %s', self.task_params.VIDEO, video_file_path)
188+
shutil.copy(self.task_params.VIDEO, video_file_path)
189+
else:
190+
_logger.warning('Video not copied (video most likely was not played)')
191+
self. self.video._media.get_mrl()
182192
self.paths.SESSION_FOLDER.joinpath('transfer_me.flag').touch()
183193

184194
def start_hardware(self):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "project_extraction"
7-
version = "0.5.2"
7+
version = "0.5.3"
88
description = "Custom extractors for satellite tasks"
99
dynamic = [ "readme" ]
1010
keywords = [ "IBL", "neuro-science" ]

0 commit comments

Comments
 (0)