Ejemplo n.º 1
0
def pc(startMin, startSec, endMin, endSec):
    startHour = 0
    endHour = 0
    if startMin > 59:
        startHour = 1
        startMin -= 60
    if endMin > 59:
        endHour = 1
        endMin -= 60

    pcStart = nptime(hour=startHour, minute=startMin, second=startSec)
    pcExpEnd = nptime.from_time(pcStart + timedelta(minutes=7))
    print("PosConvo Start=", pcStart)
    print("PosConvo End=", pcExpEnd)
    pcEnd = nptime(hour=endHour, minute=endMin, second=endSec)
    print()

    output(pcStart, pcExpEnd, pcEnd, "PosConvo")
    outputTXT(pcStart, pcExpEnd)

    #txt to csv
    csv()

    print("*********** END *********************************")
    return
Ejemplo n.º 2
0
    def load_videos(self):
        VideoMaker.load_videos(self)

        daily = self.group_by_day(self.images)
        if len(self.images) == 0:
            return
            #raise VideoMakerError("No images meet the criteria specified")

        start_time = nptime.from_time(
            min([s.taken.time() for s in self.images]))
        end_time = nptime.from_time(max([s.taken.time() for s in self.images]))
        day_length = end_time - start_time
        start_date = min([s.taken.date() for s in self.images])
        end_date = max([s.taken.date() for s in self.images])
        # Note that len (daily) = end_date - start_date + 1, iff continuous

        # daily_advance is how much to advance the clock each day
        # like the 'descent angle' on the time v hours graph.
        daily_advance = day_length / len(daily)
        # use this as the sliceage unless manually set. it will produce a continuous video
        # i.e. the cross moves down smoothly
        sliceage = self.sliceage or daily_advance

        LOGGER.debug(f"start_time={start_time} end_time={end_time}")
        LOGGER.debug(f"start_date={start_date} end_date={end_date}")
        LOGGER.info(
            f"Diagonal: days={len(daily)} sliceage={sliceage} (specified: {self.sliceage}) daily_advance={daily_advance}"
        )

        TIME_FORMAT = "%H:%M"  # %S
        mark = start_time
        sliced_images = []
        for day in sorted(daily.keys()):
            day_slice = [
                tlf for tlf in daily[day]
                if mark <= tlf.taken.time() <= mark + sliceage
            ]
            sliced_images.extend(day_slice)
            LOGGER.debug(
                f"Day:{day} Slice:{ mark.strftime(TIME_FORMAT)}->{(mark+sliceage).strftime(TIME_FORMAT)}"
                + f" {len(day_slice)}/{len(daily[day])} files")
            mark += daily_advance
        sliced_images.sort()
        self.videos.append(Video(sliced_images))
Ejemplo n.º 3
0
def cc(startMin, startSec, endMin, endSec):
    ccStart = nptime(minute=startMin, second=startSec)
    ccExpEnd = nptime.from_time(ccStart + timedelta(minutes=7))
    print("ConConvo Start=", ccStart)
    print("ConConvo End=", ccExpEnd)
    ccEnd = nptime(minute=endMin, second=endSec)
    print()

    output(ccStart, ccExpEnd, ccEnd, "ConConvo")
    outputTXT(ccStart, ccExpEnd)
    return
Ejemplo n.º 4
0
def bl(startMin, startSec, endMin, endSec):
    blStart = nptime(minute=startMin, second=startSec)
    blExpEnd = nptime.from_time(blStart + timedelta(minutes=5, seconds=3))
    print("Baseline Start=", blStart)
    print("Baseline End=", blExpEnd)
    blEnd = nptime(minute=endMin, second=endSec)
    print()
    #print ("Baseline: expected endtime =",  blExpEnd, ", actual endtime (door-knock) =", blEnd, ", extra time =", (blEnd - blExpEnd).seconds, "s.")

    outputFilm(blStart, blExpEnd, blEnd, "Baseline")
    outputTXT(blStart, blExpEnd)
    return
Ejemplo n.º 5
0
def cp(startMin, startSec, endMin, endSec):
    startHour = 0
    endHour = 0
    if startMin > 59:
        startHour = 1
        startMin -= 60
    if endMin > 59:
        endHour = 1
        endMin -= 60
    cpStart = nptime(hour=startHour, minute=startMin, second=startSec)
    cpExpEnd = nptime.from_time(cpStart + timedelta(seconds=90))
    print("ConPrep Start=", cpStart)
    print("ConPrep End=", cpExpEnd)
    cpEnd = nptime(hour=endHour, minute=endMin, second=endSec)
    print()

    output(cpStart, cpExpEnd, cpEnd, "ConPrep")
    outputTXT(cpStart, cpExpEnd)
    return
Ejemplo n.º 6
0
def pp(startMin, startSec, endMin, endSec):
    startHour = 0
    endHour = 0
    if startMin > 59:
        startHour = 1
        startMin -= 60
    if endMin > 59:
        endHour = 1
        endMin -= 60

    ppStart = nptime(hour=startHour, minute=startMin, second=startSec)
    ppExpEnd = nptime.from_time(ppStart + timedelta(seconds=90))
    print("PosPrep Start=", ppStart)
    print("PosPrep End=", ppExpEnd)
    ppEnd = nptime(hour=endHour, minute=endMin, second=endSec)
    print()

    output(ppStart, ppExpEnd, ppEnd, "PosPrep")
    outputTXT(ppStart, ppExpEnd)
    return
Ejemplo n.º 7
0
def nf(startMin, startSec, endMin, endSec):
    startHour = 0
    endHour = 0
    if startMin > 59:
        startHour = 1
        startMin -= 60
    if endMin > 59:
        endHour = 1
        endMin -= 60

    nfStart = nptime(hour=startHour, minute=startMin, second=startSec)
    nfExpEnd = nptime.from_time(nfStart + timedelta(minutes=2, seconds=1))
    print("Neutral Film Start=", nfStart)
    print("Neutral Film End=", nfExpEnd)
    nfEnd = nptime(hour=endHour, minute=endMin, second=endSec)
    print()

    outputFilm(nfStart, nfExpEnd, nfEnd, "Neutral Film")
    outputTXT(nfStart, nfExpEnd)
    return
Ejemplo n.º 8
0
def time_window_fmt(start:datetime.time, dur:datetime.timedelta):
    if start is None or dur is None: return "Anytime"
    finish = nptime.from_time(start) + dur
    fmt = "%-H%M"
    return "%s to %s" % (start.strftime(fmt), finish.strftime(fmt))
Ejemplo n.º 9
0
def time_window_fmt(start:datetime.time, dur:datetime.timedelta):
    if start is None or dur is None: return "Anytime"
    finish = nptime.from_time(start) + dur
    fmt = "%-H%M"
    return "%s to %s" % (start.strftime(fmt), finish.strftime(fmt))
Ejemplo n.º 10
0
def time_in_timespan(test_time: time, spans_start_time: time,
                     spans_duration: timedelta) -> bool:
    test_nptime = nptime.from_time(test_time)  # type: nptime
    start_nptime = nptime.from_time(spans_start_time)  # type: nptime
    end_nptime = start_nptime + spans_duration  # type: nptime
    return start_nptime <= test_nptime < end_nptime
Ejemplo n.º 11
0
 def real_duration(self) -> timedelta:
     if self._real_interval:
         return self._real_interval * self.frames
     else:
         # self._real_end_time:
         return nptime.from_time(self._real_end_time) - nptime.from_time(self._real_start_time)