• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

int-brain-lab / ibllib / 6161719581526678

28 Jun 2024 01:14PM UTC coverage: 64.584% (+0.03%) from 64.55%
6161719581526678

push

tests

web-flow
Stim on extraction (#788)

* Issue #775
* Handle no go trials
* Pre-6.2.5 trials extraction
* DeprecationWarning -> FutureWarning; extractor fixes; timeline trials extraction

49 of 60 new or added lines in 9 files covered. (81.67%)

2 existing lines in 1 file now uncovered.

13055 of 20214 relevant lines covered (64.58%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/ibllib/oneibl/stream.py
1
import re
×
2

3
import cv2
×
4
import one.params
×
5

6

7
class VideoStreamer(object):
×
8
    """
9
    Provides a wrapper to stream a video from a password protected HTTP server using opencv
10
    """
11

12
    def __init__(self, url_vid):
×
13
        """
14
        :param url_vid: full url of the video or dataset dictionary as output by alyx rest datasets
15
        :returns cv2.VideoCapture object
16
        """
17
        import warnings
×
NEW
18
        warnings.warn('Please use ibllib.io.video.VideoStreamer instead', FutureWarning)
×
19

20
        # pop the data url from the dataset record if the input is a dictionary
21
        if isinstance(url_vid, dict):
×
22
            url_vid = next(fr['data_url'] for fr in url_vid['file_records'] if fr['data_url'])
×
23
        self.url = url_vid
×
24
        self._par = one.params.get(silent=True)
×
25
        self.cap = cv2.VideoCapture(self._url)
×
26
        self.total_frames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT))
×
27

28
    @property
×
29
    def _url(self):
×
30
        username = self._par.HTTP_DATA_SERVER_LOGIN
×
31
        password = self._par.HTTP_DATA_SERVER_PWD
×
32
        return re.sub(r'(^https?://)', r'\1' + f'{username}:{password}@', self.url)
×
33

34
    def get_frame(self, frame_index):
×
35
        self.cap.set(cv2.CAP_PROP_POS_FRAMES, frame_index)
×
36
        return self.cap.read()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc