boris-behav-obs 9.4__py2.py3-none-any.whl → 9.4.1__py2.py3-none-any.whl
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.
- boris/core.py +43 -54
- boris/observation.py +8 -4
- boris/observation_operations.py +2 -0
- boris/player_dock_widget.py +0 -24
- boris/version.py +2 -2
- boris/write_event.py +11 -2
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/METADATA +1 -1
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/RECORD +12 -13
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/WHEEL +1 -1
- boris/1.py +0 -45
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/entry_points.txt +0 -0
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/licenses/LICENSE.TXT +0 -0
- {boris_behav_obs-9.4.dist-info → boris_behav_obs-9.4.1.dist-info}/top_level.txt +0 -0
boris/core.py
CHANGED
|
@@ -23,11 +23,11 @@ This file is part of BORIS.
|
|
|
23
23
|
|
|
24
24
|
import os
|
|
25
25
|
import sys
|
|
26
|
-
|
|
26
|
+
from pathlib import Path
|
|
27
27
|
|
|
28
28
|
# os.environ["PATH"] = os.path.dirname(__file__) + os.sep + "misc" + os.pathsep + os.environ["PATH"]
|
|
29
29
|
|
|
30
|
-
os.environ["PATH"] = str(
|
|
30
|
+
os.environ["PATH"] = str(Path(__file__).parent / "misc") + os.pathsep + os.environ["PATH"]
|
|
31
31
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".")))
|
|
32
32
|
|
|
33
33
|
import datetime
|
|
@@ -1023,8 +1023,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1023
1023
|
tmp_dir = self.ffmpeg_cache_dir if self.ffmpeg_cache_dir and os.path.isdir(self.ffmpeg_cache_dir) else tempfile.gettempdir()
|
|
1024
1024
|
|
|
1025
1025
|
wav_file_path = (
|
|
1026
|
-
|
|
1027
|
-
/ pl.Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1026
|
+
Path(tmp_dir) / Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1028
1027
|
)
|
|
1029
1028
|
|
|
1030
1029
|
self.spectro = plot_spectrogram_rt.Plot_spectrogram_RT()
|
|
@@ -1113,8 +1112,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1113
1112
|
tmp_dir = self.ffmpeg_cache_dir if self.ffmpeg_cache_dir and os.path.isdir(self.ffmpeg_cache_dir) else tempfile.gettempdir()
|
|
1114
1113
|
|
|
1115
1114
|
wav_file_path = (
|
|
1116
|
-
|
|
1117
|
-
/ pl.Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1115
|
+
Path(tmp_dir) / Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1118
1116
|
)
|
|
1119
1117
|
|
|
1120
1118
|
self.waveform = plot_waveform_rt.Plot_waveform_RT()
|
|
@@ -1224,8 +1222,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1224
1222
|
|
|
1225
1223
|
try:
|
|
1226
1224
|
wav_file_path = str(
|
|
1227
|
-
|
|
1228
|
-
/ pl.Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1225
|
+
Path(tmp_dir) / Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"] + ".wav").name
|
|
1229
1226
|
)
|
|
1230
1227
|
except Exception:
|
|
1231
1228
|
return
|
|
@@ -1373,7 +1370,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1373
1370
|
return
|
|
1374
1371
|
|
|
1375
1372
|
# check if a .git is present
|
|
1376
|
-
if (
|
|
1373
|
+
if (Path(__file__).parent.parent / Path(".git")).is_dir():
|
|
1377
1374
|
QMessageBox.critical(self, cfg.programName, "A .git directory is present, BORIS cannot be automatically updated.")
|
|
1378
1375
|
return
|
|
1379
1376
|
|
|
@@ -1403,7 +1400,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1403
1400
|
|
|
1404
1401
|
# copy from temp dir to current BORIS dir
|
|
1405
1402
|
try:
|
|
1406
|
-
shutil.copytree(f"{temp_dir.name}/BORIS-{last_version}",
|
|
1403
|
+
shutil.copytree(f"{temp_dir.name}/BORIS-{last_version}", Path(__file__).parent.parent, dirs_exist_ok=True)
|
|
1407
1404
|
except Exception:
|
|
1408
1405
|
QMessageBox.critical(self, cfg.programName, "A problem occurred during the copy the new version of BORIS.")
|
|
1409
1406
|
return
|
|
@@ -1526,15 +1523,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1526
1523
|
if self.image_idx == 0:
|
|
1527
1524
|
return
|
|
1528
1525
|
|
|
1529
|
-
current_dir =
|
|
1526
|
+
current_dir = Path(self.images_list[self.image_idx]).parent
|
|
1530
1527
|
for image_path in self.images_list[self.image_idx - 1 :: -1]:
|
|
1531
|
-
if
|
|
1528
|
+
if Path(image_path).parent != current_dir:
|
|
1532
1529
|
self.image_idx = self.images_list.index(image_path)
|
|
1533
1530
|
|
|
1534
1531
|
# seek to first image of directory
|
|
1535
|
-
current_dir2 =
|
|
1532
|
+
current_dir2 = Path(self.images_list[self.image_idx]).parent
|
|
1536
1533
|
for image_path2 in self.images_list[self.image_idx - 1 :: -1]:
|
|
1537
|
-
if
|
|
1534
|
+
if Path(image_path2).parent != current_dir2:
|
|
1538
1535
|
self.image_idx = self.images_list.index(image_path2) + 1
|
|
1539
1536
|
break
|
|
1540
1537
|
if self.images_list.index(image_path2) == 0:
|
|
@@ -1571,9 +1568,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1571
1568
|
if self.playerType == cfg.IMAGES:
|
|
1572
1569
|
if len(self.pj[cfg.OBSERVATIONS][self.observationId].get(cfg.DIRECTORIES_LIST, [])) <= 1:
|
|
1573
1570
|
return
|
|
1574
|
-
current_dir =
|
|
1571
|
+
current_dir = Path(self.images_list[self.image_idx]).parent
|
|
1575
1572
|
for image_path in self.images_list[self.image_idx + 1 :]:
|
|
1576
|
-
if
|
|
1573
|
+
if Path(image_path).parent != current_dir:
|
|
1577
1574
|
self.image_idx = self.images_list.index(image_path)
|
|
1578
1575
|
self.extract_frame(self.dw_player[0])
|
|
1579
1576
|
break
|
|
@@ -1706,8 +1703,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1706
1703
|
msg += f"<br>Time from 1st image: <b>{seconds_from_1st_formated}</b>"
|
|
1707
1704
|
|
|
1708
1705
|
# image path
|
|
1709
|
-
msg += f"<br><br>Directory: <b>{
|
|
1710
|
-
msg += f"<br>File name: <b>{
|
|
1706
|
+
msg += f"<br><br>Directory: <b>{Path(self.images_list[self.image_idx]).parent}</b>"
|
|
1707
|
+
msg += f"<br>File name: <b>{Path(self.images_list[self.image_idx]).name}</b>"
|
|
1711
1708
|
msg += f"<br><small>Image resolution: <b>{pixmap.size().width()}x{pixmap.size().height()}</b></small>"
|
|
1712
1709
|
|
|
1713
1710
|
self.lb_current_media_time.setText(msg)
|
|
@@ -1819,16 +1816,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1819
1816
|
if self.pj[cfg.OBSERVATIONS][self.observationId][cfg.TYPE] == cfg.IMAGES:
|
|
1820
1817
|
pixmap = QPixmap(self.images_list[self.image_idx])
|
|
1821
1818
|
# draw measurements
|
|
1822
|
-
RADIUS = 6
|
|
1819
|
+
# RADIUS = 6
|
|
1823
1820
|
painter = QPainter()
|
|
1824
1821
|
painter.begin(pixmap)
|
|
1825
1822
|
for element in self.measurement_w.draw_mem.get(self.image_idx, []):
|
|
1826
1823
|
painter = draw_element(painter, element)
|
|
1827
1824
|
painter.end()
|
|
1828
1825
|
|
|
1829
|
-
image_file_path = str(
|
|
1826
|
+
image_file_path = str(Path(output_dir) / f"{Path(self.images_list[self.image_idx]).stem}.jpg")
|
|
1830
1827
|
# check if file already exists
|
|
1831
|
-
if
|
|
1828
|
+
if Path(image_file_path).is_file():
|
|
1832
1829
|
if (
|
|
1833
1830
|
dialog.MessageDialog(cfg.programName, f"The file {image_file_path} already exists.", (cfg.CANCEL, cfg.OVERWRITE))
|
|
1834
1831
|
== cfg.CANCEL
|
|
@@ -1841,11 +1838,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1841
1838
|
for n_player, dw in enumerate(self.dw_player):
|
|
1842
1839
|
pixmap = util.pil2pixmap(dw.player.screenshot_raw())
|
|
1843
1840
|
|
|
1844
|
-
p =
|
|
1845
|
-
image_file_path = str(
|
|
1841
|
+
p = Path(dw.player.playlist[dw.player.playlist_pos]["filename"])
|
|
1842
|
+
image_file_path = str(Path(output_dir) / f"{p.stem}_{n_player}_{dw.player.estimated_frame_number:06}.jpg")
|
|
1846
1843
|
|
|
1847
1844
|
# draw measurements
|
|
1848
|
-
RADIUS = 6
|
|
1845
|
+
# RADIUS = 6
|
|
1849
1846
|
painter = QPainter()
|
|
1850
1847
|
painter.begin(pixmap)
|
|
1851
1848
|
|
|
@@ -1856,7 +1853,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1856
1853
|
|
|
1857
1854
|
painter.end()
|
|
1858
1855
|
# check if file already exists
|
|
1859
|
-
if
|
|
1856
|
+
if Path(image_file_path).is_file():
|
|
1860
1857
|
if (
|
|
1861
1858
|
dialog.MessageDialog(
|
|
1862
1859
|
cfg.programName, f"The file {image_file_path} already exists.", (cfg.CANCEL, cfg.OVERWRITE)
|
|
@@ -1873,16 +1870,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1873
1870
|
pixmap = QPixmap(self.images_list[frame_idx])
|
|
1874
1871
|
|
|
1875
1872
|
# draw measurements
|
|
1876
|
-
RADIUS = 6
|
|
1873
|
+
# RADIUS = 6
|
|
1877
1874
|
painter = QPainter()
|
|
1878
1875
|
painter.begin(pixmap)
|
|
1879
1876
|
for element in self.measurement_w.draw_mem.get(frame_idx, []):
|
|
1880
1877
|
painter = draw_element(painter, element)
|
|
1881
1878
|
painter.end()
|
|
1882
1879
|
|
|
1883
|
-
image_file_path = str(
|
|
1880
|
+
image_file_path = str(Path(output_dir) / f"{Path(self.images_list[frame_idx]).stem}.jpg")
|
|
1884
1881
|
# check if file already exists
|
|
1885
|
-
if
|
|
1882
|
+
if Path(image_file_path).is_file():
|
|
1886
1883
|
if (
|
|
1887
1884
|
dialog.MessageDialog(
|
|
1888
1885
|
cfg.programName, f"The file {image_file_path} already exists.", (cfg.CANCEL, cfg.OVERWRITE)
|
|
@@ -1905,10 +1902,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1905
1902
|
|
|
1906
1903
|
for frame_idx in d:
|
|
1907
1904
|
for n_player in d[frame_idx]:
|
|
1908
|
-
media_path =
|
|
1905
|
+
media_path = Path(
|
|
1909
1906
|
self.dw_player[n_player - 1].player.playlist[self.dw_player[n_player - 1].player.playlist_pos]["filename"]
|
|
1910
1907
|
)
|
|
1911
|
-
file_name =
|
|
1908
|
+
file_name = Path(f"{media_path.stem}_{element['player']}_{frame_idx:06}")
|
|
1912
1909
|
|
|
1913
1910
|
ffmpeg_command = [
|
|
1914
1911
|
self.ffmpeg_bin,
|
|
@@ -1919,14 +1916,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1919
1916
|
rf"select=gte(n\, {frame_idx})",
|
|
1920
1917
|
"-frames:v",
|
|
1921
1918
|
"1",
|
|
1922
|
-
str(
|
|
1919
|
+
str(Path(output_dir) / file_name.with_suffix(".jpg")),
|
|
1923
1920
|
]
|
|
1924
1921
|
|
|
1925
1922
|
p = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # do not use shell=True!
|
|
1926
1923
|
out, error = p.communicate()
|
|
1927
1924
|
|
|
1928
|
-
pixmap = QPixmap(str(
|
|
1929
|
-
RADIUS = 6
|
|
1925
|
+
pixmap = QPixmap(str(Path(output_dir) / file_name.with_suffix(".jpg")))
|
|
1926
|
+
# RADIUS = 6
|
|
1930
1927
|
painter = QPainter()
|
|
1931
1928
|
painter.begin(pixmap)
|
|
1932
1929
|
|
|
@@ -1935,10 +1932,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1935
1932
|
|
|
1936
1933
|
painter.end()
|
|
1937
1934
|
# check if file already exists
|
|
1938
|
-
if (
|
|
1935
|
+
if (Path(output_dir) / file_name.with_suffix(".jpg")).is_file():
|
|
1939
1936
|
answer = dialog.MessageDialog(
|
|
1940
1937
|
cfg.programName,
|
|
1941
|
-
f"The file {
|
|
1938
|
+
f"The file {Path(output_dir) / file_name.with_suffix('.jpg')} already exists.",
|
|
1942
1939
|
(cfg.CANCEL, cfg.OVERWRITE, "Abort"),
|
|
1943
1940
|
)
|
|
1944
1941
|
if answer == cfg.CANCEL:
|
|
@@ -1946,7 +1943,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
1946
1943
|
if answer == "Abort":
|
|
1947
1944
|
return
|
|
1948
1945
|
|
|
1949
|
-
pixmap.save(str(
|
|
1946
|
+
pixmap.save(str(Path(output_dir) / file_name.with_suffix(".jpg")), "JPG")
|
|
1950
1947
|
|
|
1951
1948
|
def resize_dw(self, dw_id):
|
|
1952
1949
|
"""
|
|
@@ -2420,7 +2417,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
2420
2417
|
"""
|
|
2421
2418
|
self.menuRecent_projects.clear()
|
|
2422
2419
|
for project_file_path in self.recent_projects:
|
|
2423
|
-
if
|
|
2420
|
+
if Path(project_file_path).is_file():
|
|
2424
2421
|
action = QAction(self, visible=False, triggered=self.open_project_activated)
|
|
2425
2422
|
action.setText(project_file_path)
|
|
2426
2423
|
action.setVisible(True)
|
|
@@ -2751,7 +2748,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
2751
2748
|
self.projectChanged = project_changed
|
|
2752
2749
|
self.load_behaviors_in_twEthogram([self.pj[cfg.ETHOGRAM][x][cfg.BEHAVIOR_CODE] for x in self.pj[cfg.ETHOGRAM]])
|
|
2753
2750
|
self.load_subjects_in_twSubjects([self.pj[cfg.SUBJECTS][x][cfg.SUBJECT_NAME] for x in self.pj[cfg.SUBJECTS]])
|
|
2754
|
-
self.projectFileName = str(
|
|
2751
|
+
self.projectFileName = str(Path(project_path).absolute())
|
|
2755
2752
|
self.project = True
|
|
2756
2753
|
if str(self.projectFileName) not in self.recent_projects:
|
|
2757
2754
|
self.recent_projects = [str(self.projectFileName)] + self.recent_projects
|
|
@@ -3335,7 +3332,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
3335
3332
|
project_new_file_name = os.path.splitext(os.path.splitext(project_new_file_name)[0])[0]
|
|
3336
3333
|
project_new_file_name += ".boris"
|
|
3337
3334
|
# check if file name with extension already exists
|
|
3338
|
-
if
|
|
3335
|
+
if Path(project_new_file_name).is_file():
|
|
3339
3336
|
if (
|
|
3340
3337
|
dialog.MessageDialog(
|
|
3341
3338
|
cfg.programName,
|
|
@@ -3351,7 +3348,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
3351
3348
|
project_new_file_name = os.path.splitext(project_new_file_name)[0]
|
|
3352
3349
|
project_new_file_name += ".boris.gz"
|
|
3353
3350
|
# check if file name with extension already exists
|
|
3354
|
-
if
|
|
3351
|
+
if Path(project_new_file_name).is_file():
|
|
3355
3352
|
if (
|
|
3356
3353
|
dialog.MessageDialog(
|
|
3357
3354
|
cfg.programName,
|
|
@@ -3431,7 +3428,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
3431
3428
|
self.projectFileName = os.path.splitext(os.path.splitext(self.projectFileName)[0])[0]
|
|
3432
3429
|
self.projectFileName += ".boris"
|
|
3433
3430
|
# check if file name with extension already exists
|
|
3434
|
-
if
|
|
3431
|
+
if Path(self.projectFileName).is_file():
|
|
3435
3432
|
if (
|
|
3436
3433
|
dialog.MessageDialog(
|
|
3437
3434
|
cfg.programName,
|
|
@@ -3450,7 +3447,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
3450
3447
|
|
|
3451
3448
|
self.projectFileName += ".boris.gz"
|
|
3452
3449
|
# check if file name with extension already exists
|
|
3453
|
-
if
|
|
3450
|
+
if Path(self.projectFileName).is_file():
|
|
3454
3451
|
if (
|
|
3455
3452
|
dialog.MessageDialog(
|
|
3456
3453
|
cfg.programName,
|
|
@@ -4044,14 +4041,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
4044
4041
|
"""
|
|
4045
4042
|
enable or disable video if any and audio if any
|
|
4046
4043
|
"""
|
|
4047
|
-
# if video
|
|
4048
|
-
# print(f"{n_player=} {enable=}")
|
|
4049
|
-
# print(f"{self.dw_player[n_player].player.video_format=}")
|
|
4050
|
-
# print(f"{self.dw_player[n_player].player.audio_bitrate=}")
|
|
4051
|
-
|
|
4052
|
-
# self.pj[cfg.OBSERVATIONS][self.observationId][cfg.MEDIA_INFO][cfg.HAS_VIDEO][]
|
|
4053
|
-
# if self.dw_player[n_player].player.playlist_pos is not None:
|
|
4054
|
-
# print(self.dw_player[n_player].player.playlist[self.dw_player[n_player].player.playlist_pos]["filename"])
|
|
4055
4044
|
|
|
4056
4045
|
if self.dw_player[n_player].player.video_format:
|
|
4057
4046
|
self.dw_player[n_player].stack.setCurrentIndex(1 if not enable else 0)
|
|
@@ -4245,7 +4234,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
4245
4234
|
|
|
4246
4235
|
# current media name
|
|
4247
4236
|
if self.dw_player[0].player.playlist_pos is not None:
|
|
4248
|
-
current_media_name =
|
|
4237
|
+
current_media_name = Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"]).name
|
|
4249
4238
|
current_playlist_index = self.dw_player[0].player.playlist_pos
|
|
4250
4239
|
else:
|
|
4251
4240
|
current_media_name = ""
|
|
@@ -5144,7 +5133,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
5144
5133
|
),
|
|
5145
5134
|
)
|
|
5146
5135
|
return
|
|
5147
|
-
media_file_name = self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"]
|
|
5136
|
+
media_file_name = Path(self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"]).as_posix()
|
|
5148
5137
|
|
|
5149
5138
|
time_ -= self.pj[cfg.OBSERVATIONS][self.observationId][cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME][media_file_name]
|
|
5150
5139
|
|
|
@@ -5704,7 +5693,7 @@ def main():
|
|
|
5704
5693
|
url = "https://github.com/boris-behav-obs/boris-behav-obs.github.io/releases/download/files/"
|
|
5705
5694
|
|
|
5706
5695
|
# search where to download ffmpeg
|
|
5707
|
-
ffmpeg_dir =
|
|
5696
|
+
ffmpeg_dir = Path(__file__).parent / "misc"
|
|
5708
5697
|
|
|
5709
5698
|
logging.debug(f"{ffmpeg_dir=}")
|
|
5710
5699
|
|
|
@@ -5792,7 +5781,7 @@ def main():
|
|
|
5792
5781
|
# check project integrity
|
|
5793
5782
|
# read config
|
|
5794
5783
|
config_param: dict = {}
|
|
5795
|
-
ini_file_path =
|
|
5784
|
+
ini_file_path = Path.home() / Path(".boris")
|
|
5796
5785
|
if ini_file_path.is_file():
|
|
5797
5786
|
settings = QSettings(str(ini_file_path), QSettings.IniFormat)
|
|
5798
5787
|
try:
|
boris/observation.py
CHANGED
|
@@ -1241,9 +1241,11 @@ class Observation(QDialog, Ui_Form):
|
|
|
1241
1241
|
str: error message or empty string
|
|
1242
1242
|
"""
|
|
1243
1243
|
|
|
1244
|
+
logging.debug(f"check_media function for {file_path}")
|
|
1245
|
+
|
|
1244
1246
|
media_info = util.accurate_media_analysis(self.ffmpeg_bin, file_path)
|
|
1245
1247
|
|
|
1246
|
-
|
|
1248
|
+
logging.debug(f"{media_info=}")
|
|
1247
1249
|
|
|
1248
1250
|
if "error" in media_info:
|
|
1249
1251
|
return (True, media_info["error"])
|
|
@@ -1265,6 +1267,9 @@ class Observation(QDialog, Ui_Form):
|
|
|
1265
1267
|
self.mediaFPS[file_path] = float(media_info["fps"])
|
|
1266
1268
|
self.mediaHasVideo[file_path] = media_info["has_video"]
|
|
1267
1269
|
self.mediaHasAudio[file_path] = media_info["has_audio"]
|
|
1270
|
+
|
|
1271
|
+
logging.debug(f"{file_path=}")
|
|
1272
|
+
|
|
1268
1273
|
self.add_media_to_listview(file_path)
|
|
1269
1274
|
return (False, "")
|
|
1270
1275
|
|
|
@@ -1324,6 +1329,8 @@ class Observation(QDialog, Ui_Form):
|
|
|
1324
1329
|
if "media " in mode:
|
|
1325
1330
|
file_paths, _ = fd.getOpenFileNames(self, "Add media file(s)", "", "All files (*)")
|
|
1326
1331
|
|
|
1332
|
+
logging.debug(f"{file_paths=}")
|
|
1333
|
+
|
|
1327
1334
|
if file_paths:
|
|
1328
1335
|
# store directory for next usage
|
|
1329
1336
|
self.mem_dir = str(pl.Path(file_paths[0]).parent)
|
|
@@ -1341,9 +1348,6 @@ class Observation(QDialog, Ui_Form):
|
|
|
1341
1348
|
|
|
1342
1349
|
for file_path in file_paths:
|
|
1343
1350
|
(error, msg) = self.check_media(file_path, mode)
|
|
1344
|
-
|
|
1345
|
-
print(f"{(error, msg)=}")
|
|
1346
|
-
|
|
1347
1351
|
if error:
|
|
1348
1352
|
QMessageBox.critical(self, cfg.programName, f"<b>{file_path}</b>. {msg}")
|
|
1349
1353
|
|
boris/observation_operations.py
CHANGED
|
@@ -1055,6 +1055,8 @@ def new_observation(self, mode: str = cfg.NEW, obsId: str = "") -> None:
|
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
1057
|
if self.pj[cfg.OBSERVATIONS][new_obs_id][cfg.MEDIA_CREATION_DATE_AS_OFFSET]:
|
|
1058
|
+
print("\n", observationWindow.media_creation_time, "\n")
|
|
1059
|
+
|
|
1058
1060
|
self.pj[cfg.OBSERVATIONS][new_obs_id][cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME] = observationWindow.media_creation_time
|
|
1059
1061
|
|
|
1060
1062
|
try:
|
boris/player_dock_widget.py
CHANGED
|
@@ -43,30 +43,6 @@ from PySide6.QtCore import Signal, QEvent, Qt
|
|
|
43
43
|
from PySide6.QtGui import QIcon, QAction
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
"""
|
|
47
|
-
try:
|
|
48
|
-
# import last version of python-mpv
|
|
49
|
-
from . import mpv2 as mpv
|
|
50
|
-
|
|
51
|
-
# check if MPV API v. 1
|
|
52
|
-
# is v. 1 use the old version of mpv.py
|
|
53
|
-
try:
|
|
54
|
-
if "libmpv.so.1" in mpv.sofile:
|
|
55
|
-
from . import mpv as mpv
|
|
56
|
-
except AttributeError:
|
|
57
|
-
if "mpv-1.dll" in mpv.dll:
|
|
58
|
-
from . import mpv as mpv
|
|
59
|
-
|
|
60
|
-
except RuntimeError: # libmpv found but version too old
|
|
61
|
-
from . import mpv as mpv
|
|
62
|
-
|
|
63
|
-
except OSError: # libmpv not found
|
|
64
|
-
msg = "LIBMPV library not found!\n"
|
|
65
|
-
logging.critical(msg)
|
|
66
|
-
sys.exit()
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
|
-
|
|
70
46
|
class Clickable_label(QLabel):
|
|
71
47
|
"""
|
|
72
48
|
QLabel class for visualiziong frames for geometric measurments
|
boris/version.py
CHANGED
boris/write_event.py
CHANGED
|
@@ -95,15 +95,24 @@ def write_event(self, event: dict, mem_time: dec) -> int:
|
|
|
95
95
|
if self.pj[cfg.OBSERVATIONS][self.observationId][cfg.TYPE] in (cfg.MEDIA):
|
|
96
96
|
if self.pj[cfg.OBSERVATIONS][self.observationId].get(cfg.MEDIA_CREATION_DATE_AS_OFFSET, False):
|
|
97
97
|
media_file_name = self.dw_player[0].player.playlist[self.dw_player[0].player.playlist_pos]["filename"]
|
|
98
|
+
|
|
99
|
+
logging.debug(f"{media_file_name=}")
|
|
100
|
+
|
|
101
|
+
media_file_name_posix = pl.Path(media_file_name).as_posix()
|
|
102
|
+
|
|
103
|
+
logging.debug(f"{media_file_name_posix=}")
|
|
104
|
+
|
|
98
105
|
# add media creation date/time
|
|
99
106
|
|
|
100
107
|
"""
|
|
101
108
|
print(f"{media_file_name=}")
|
|
102
109
|
print(f"{mem_time=}")
|
|
103
|
-
print(f"{dec(self.pj[cfg.OBSERVATIONS][self.observationId][cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME][media_file_name])=}")
|
|
104
110
|
"""
|
|
111
|
+
print(f"{self.pj[cfg.OBSERVATIONS][self.observationId][cfg.MEDIA_INFO]=}")
|
|
105
112
|
|
|
106
|
-
mem_time += dec(
|
|
113
|
+
mem_time += dec(
|
|
114
|
+
self.pj[cfg.OBSERVATIONS][self.observationId][cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME][media_file_name_posix]
|
|
115
|
+
)
|
|
107
116
|
|
|
108
117
|
# check if time > 2**31 - 1 (2147483647)
|
|
109
118
|
if self.pj[cfg.OBSERVATIONS][self.observationId][cfg.TYPE] in (cfg.MEDIA, cfg.VIEWER_MEDIA, cfg.LIVE, cfg.VIEWER_LIVE):
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
boris/1.py,sha256=rb6Nstw1vIHlBwMnzExVOlgU2F75Tuf1VYRXBTrZUFg,1082
|
|
2
1
|
boris/__init__.py,sha256=iAtmVMy22TJpMmxVTMSK_6-wXnCbx1ogvWgfYEcbHzU,773
|
|
3
2
|
boris/__main__.py,sha256=ANjTbXgXDoz2nB1tCtOIllfIVotCa602iebACX7rXaE,764
|
|
4
3
|
boris/about.py,sha256=VPa8zeu0bMb1LRXDq8uUSG_7mSbkb2HTk1AtWbzWQwE,5366
|
|
@@ -17,7 +16,7 @@ boris/connections.py,sha256=rVI18AuXh8cEnnoCKJk0RMWAaiNOpiaS554Okgk3SBY,19383
|
|
|
17
16
|
boris/converters.py,sha256=n6gDM9x2hS-ZOoHLruiifuXxnC7ERsUukiFokhHZPoQ,11678
|
|
18
17
|
boris/converters_ui.py,sha256=uu7LOBV_fKv2DBdOqsqPwjGsjgONr5ODBoscAA-EP48,9900
|
|
19
18
|
boris/cooccurence.py,sha256=tVERC-V8MWjWHlGEfDuu08iS94qjt4do-38jwI62QaY,10367
|
|
20
|
-
boris/core.py,sha256=
|
|
19
|
+
boris/core.py,sha256=ZvL5qYRiWU-KWvopKr-9HQhAwMsSC5aV2fMyCyADH8Y,230953
|
|
21
20
|
boris/core_qrc.py,sha256=J0kom27nrmi4-TCDLJZCZbtUAitiXQ4WEDfErawuxt8,639879
|
|
22
21
|
boris/core_ui.py,sha256=SeC26uveDCjrCBLsRPuQ6FaapKfON_HIRcQStEDLhl4,76384
|
|
23
22
|
boris/db_functions.py,sha256=Uw9wWH_Pe-qNzpV1k21YG_jKsoOmfY_iiK_7ARZHGDc,13352
|
|
@@ -47,14 +46,14 @@ boris/modifiers_coding_map.py,sha256=oT56ZY_PXhEJsMoblEsyNMAPbDpv7ZMOCnvmt7Ibx_Y
|
|
|
47
46
|
boris/mpv-1.0.3.py,sha256=EXRtzQqFjOn4wMC6482Ilq3fNQ9N1GRP1VxwLzdeaBY,88077
|
|
48
47
|
boris/mpv.py,sha256=EfzIHjPbgewG4w3smEtqEUPZoVwYmMQkL4Q8ZyW-a58,76410
|
|
49
48
|
boris/mpv2.py,sha256=IUI4t4r9GYX7G5OXTjd3RhMMOkDdfal_15buBgksLsk,92152
|
|
50
|
-
boris/observation.py,sha256=
|
|
51
|
-
boris/observation_operations.py,sha256=
|
|
49
|
+
boris/observation.py,sha256=10UkVyY8TDySntIX_-H-IsuFdiF6tEcmC6JQUzD6wYg,57139
|
|
50
|
+
boris/observation_operations.py,sha256=P4CNsUXAM3QBFLu66fBlGQd7huGdiq20nXLn1Si8MbU,106677
|
|
52
51
|
boris/observation_ui.py,sha256=DAnU94QBNvkLuHT6AxTwqSk_D_n6VUhSl8PexZv_dUk,33309
|
|
53
52
|
boris/observations_list.py,sha256=NqwECGHtHYmKhSe-qCfqPmJ24SSfzlXvIXS2i3op_zE,10591
|
|
54
53
|
boris/otx_parser.py,sha256=70QvilzFHXbjAHR88YH0aEXJ3xxheLS5fZGgHFHGpNE,16367
|
|
55
54
|
boris/param_panel.py,sha256=G0XzNmJIX89-n2OQTDccuY_wWMhr3p7GB4ZorbU6EWc,8786
|
|
56
55
|
boris/param_panel_ui.py,sha256=4emQDFmuL4_R7bKxosLjdUb-VSPWkDm7suy38F5EKcA,13260
|
|
57
|
-
boris/player_dock_widget.py,sha256=
|
|
56
|
+
boris/player_dock_widget.py,sha256=_qQyj7eet69gjoQnqagmsC41rk4Zp3cQO1lwEm5uZR4,5638
|
|
58
57
|
boris/plot_data_module.py,sha256=6QbLKfyGp4TYRyHnB9G45y5XrpeXLytcorltEAWfYak,16562
|
|
59
58
|
boris/plot_events.py,sha256=CF6gnsTeaPG-P1USwh4An2s31NoMJ1roHDImcQrQj3c,24060
|
|
60
59
|
boris/plot_events_rt.py,sha256=xig__Uea3mQqO5raMBVB3pm3vuQkjAbJpwSS7AwIob8,8327
|
|
@@ -79,13 +78,13 @@ boris/time_budget_functions.py,sha256=y5He8crz0xsTxVfz0jATwFFQVnPAIrNHja_0sF6NtR
|
|
|
79
78
|
boris/time_budget_widget.py,sha256=z-tyITBtIz-KH1H2OdMB5a8x9QQLK7Wu96-zkC6NVDA,43213
|
|
80
79
|
boris/transitions.py,sha256=_aZJfJWv3EBrtmQ7qsdTCayQo6uWU7BXqtQQgflEhr4,12250
|
|
81
80
|
boris/utilities.py,sha256=suquxdukTUscCy2M3fbR2-OcFtf_vrx4HcQD3i18XYo,56502
|
|
82
|
-
boris/version.py,sha256=
|
|
81
|
+
boris/version.py,sha256=pGQyUdeah1LGsy2_FS1kbsQZu-UFsxxMxKMycE_Ctiw,787
|
|
83
82
|
boris/video_equalizer.py,sha256=FartoGghFK-T53zklP70rPKYqTuzL8qdvfGlsOF2wwc,5854
|
|
84
83
|
boris/video_equalizer_ui.py,sha256=1CG3s79eM4JAbaCx3i1ILZXLceb41_gGXlOLNfpBgnw,10142
|
|
85
84
|
boris/video_operations.py,sha256=mh3iR__Sm2KnV44L_sW2pOo3AgLwlM7wiTnnqQiAVs4,9381
|
|
86
85
|
boris/view_df.py,sha256=AKScLASX2Uatw7rqPbsnio83eVT4GZYCFhL091eMvlY,3370
|
|
87
86
|
boris/view_df_ui.py,sha256=CaMeRH_vQ00CTDDFQn73ZZaS-r8BSTWpL-dMCFqzJ_Q,2775
|
|
88
|
-
boris/write_event.py,sha256=
|
|
87
|
+
boris/write_event.py,sha256=RN_cFQZNE2jWbM_BiodL4tsyKT0JPREvUy7xgZnrfaM,24041
|
|
89
88
|
boris/analysis_plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
89
|
boris/analysis_plugins/_latency.py,sha256=vLWCPh0cPpAEpdMboCkVIuYO1e3pJlP5tEICe27Sqms,2027
|
|
91
90
|
boris/analysis_plugins/number_of_occurences.py,sha256=IDyDrdezqvSKT3BlD8QWpSYk8X9nnBBLI80OUnFJ3bY,509
|
|
@@ -97,9 +96,9 @@ boris/portion/dict.py,sha256=SyHxc7PfDw2ufNLFQycwJtzmRfL48rDp4UrM2KN7IWc,11282
|
|
|
97
96
|
boris/portion/func.py,sha256=3TkQtFKLfsqntwd27HSGHceFhnXHmT-EbNMqktElC5Q,2174
|
|
98
97
|
boris/portion/interval.py,sha256=bAdUiJjGeUAPgsBAImwNeviiwfQq5odfhFZccAWzOTA,20299
|
|
99
98
|
boris/portion/io.py,sha256=ppNeRpiLNrocF1yzGeuEUIhYMf2LfsR-cji3d0nmvUs,6371
|
|
100
|
-
boris_behav_obs-9.4.dist-info/licenses/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
101
|
-
boris_behav_obs-9.4.dist-info/METADATA,sha256=
|
|
102
|
-
boris_behav_obs-9.4.dist-info/WHEEL,sha256=
|
|
103
|
-
boris_behav_obs-9.4.dist-info/entry_points.txt,sha256=k__8XvFi4vaA4QFvQehCZjYkKmZH34HSAJI2iYCWrMs,52
|
|
104
|
-
boris_behav_obs-9.4.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
|
|
105
|
-
boris_behav_obs-9.4.dist-info/RECORD,,
|
|
99
|
+
boris_behav_obs-9.4.1.dist-info/licenses/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
100
|
+
boris_behav_obs-9.4.1.dist-info/METADATA,sha256=LvDrzfRGh4Fok9MBJMCHN_O0-BIMElGDK4Ztsb-ezT8,4514
|
|
101
|
+
boris_behav_obs-9.4.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
102
|
+
boris_behav_obs-9.4.1.dist-info/entry_points.txt,sha256=k__8XvFi4vaA4QFvQehCZjYkKmZH34HSAJI2iYCWrMs,52
|
|
103
|
+
boris_behav_obs-9.4.1.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
|
|
104
|
+
boris_behav_obs-9.4.1.dist-info/RECORD,,
|
boris/1.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
from PIL import Image, ImageDraw, ImageFont
|
|
3
|
-
import mpv
|
|
4
|
-
|
|
5
|
-
player = mpv.MPV()
|
|
6
|
-
|
|
7
|
-
player.loop = True
|
|
8
|
-
player.play('/home/olivier/gdrive_sync/src/python/generate_video_test/video1.mp4')
|
|
9
|
-
player.wait_until_playing()
|
|
10
|
-
|
|
11
|
-
font = ImageFont.truetype('DejaVuSans.ttf', 40)
|
|
12
|
-
|
|
13
|
-
overlay = player.create_image_overlay()
|
|
14
|
-
|
|
15
|
-
img = Image.new('RGBA', (400, 150), (255, 255, 255, 0))
|
|
16
|
-
d = ImageDraw.Draw(img)
|
|
17
|
-
d.text((10, 10), 'Hello World', font=font, fill=(0, 255, 255, 128))
|
|
18
|
-
#d.text((10, 60), f't={ts:.3f}', font=font, fill=(255, 0, 255, 255))
|
|
19
|
-
|
|
20
|
-
pos = 100
|
|
21
|
-
|
|
22
|
-
overlay.update(img, pos=(2*pos, pos))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
while not player.core_idle:
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'''
|
|
30
|
-
for pos in range(0, 500, 5):
|
|
31
|
-
ts = player.time_pos
|
|
32
|
-
if ts is None:
|
|
33
|
-
break
|
|
34
|
-
|
|
35
|
-
img = Image.new('RGBA', (400, 150), (255, 255, 255, 0))
|
|
36
|
-
d = ImageDraw.Draw(img)
|
|
37
|
-
d.text((10, 10), 'Hello World', font=font, fill=(0, 255, 255, 128))
|
|
38
|
-
d.text((10, 60), f't={ts:.3f}', font=font, fill=(255, 0, 255, 255))
|
|
39
|
-
|
|
40
|
-
overlay.update(img, pos=(2*pos, pos))
|
|
41
|
-
time.sleep(0.05)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
overlay.remove()
|
|
45
|
-
'''
|
|
File without changes
|
|
File without changes
|
|
File without changes
|