Exemplo n.º 1
0
    def AddPoint(self, marktime, player, marktype = None):
        edltype = marktype if marktype else self.default
        self.player = player
        update = True

        # Check if this the first marker
        if not self.is_open and not self.edllist:
            first = yesno("This is your first marker. "
                          "Do you want to create a marker from the beginning of"
                          " the video to here?")
            if first:
                self.current["start"] = 0
                self.is_open = True

        # If using advanced mode then we call the necessary function
        if ADVANCED_MODE:
            update, marktime = self.adjustTime(marktime)

        # If we want to add the marker...
        if update:

            if self.is_open:
                self.current["end"] = self.player.toMillis(marktime) / 1000.0
                self.current["type"] = self.selectEDLtype()
                self.edllist.append(self.current)
                notify("New markers added.")
                self.current = {}
                self.is_open = False

            else:
                self.current["start"] = self.player.toMillis(marktime) / 1000.0
                notify("Starting marker added.")
                self.is_open = True
Exemplo n.º 2
0
    def AddPoint(self, marktime, player, marktype=None):
        edltype = marktype if marktype else self.default
        self.player = player
        update = True

        # Check if this the first marker
        if not self.is_open and not self.edllist:
            first = yesno(
                "This is your first marker. "
                "Do you want to create a marker from the beginning of"
                " the video to here?")
            if first:
                self.current["start"] = 0
                self.is_open = True

        # If using advanced mode then we call the necessary function
        if ADVANCED_MODE:
            update, marktime = self.adjustTime(marktime)

        # If we want to add the marker...
        if update:

            if self.is_open:
                self.current["end"] = self.player.toMillis(marktime) / 1000.0
                self.current["type"] = self.selectEDLtype()
                self.edllist.append(self.current)
                notify("New markers added.")
                self.current = {}
                self.is_open = False

            else:
                self.current["start"] = self.player.toMillis(marktime) / 1000.0
                notify("Starting marker added.")
                self.is_open = True
Exemplo n.º 3
0
    def takeSnapshot(self):

        self.capture.capture(400, 400)
        while self.capture.getCaptureState() == xbmc.CAPTURE_STATE_WORKING:
            xbmc.sleep(100)
        if self.capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE:

            size = (self.capture.getWidth(), self.capture.getHeight())
            mode = 'RGBA'
            img = Image.frombuffer(mode, size, self.capture.getImage(), 'raw', mode, 0, 1)
            img.save("test.jpg")

        else:
            notify("Capture error.")
Exemplo n.º 4
0
    def takeSnapshot(self):

        self.capture.capture(400, 400)
        while self.capture.getCaptureState() == xbmc.CAPTURE_STATE_WORKING:
            xbmc.sleep(100)
        if self.capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE:

            size = (self.capture.getWidth(), self.capture.getHeight())
            mode = 'RGBA'
            img = Image.frombuffer(mode, size, self.capture.getImage(), 'raw',
                                   mode, 0, 1)
            img.save("test.jpg")

        else:
            notify("Capture error.")
Exemplo n.º 5
0
 def Finish(self):
     with open("{0}.edl".format(self.videoname), "w") as edl:
         for scene in self.edllist:
             edl.write("{start:.3f}\t{end:.3f}\t{type}\n".format(**scene))
         edl.write("# File generated by script.edl.creator addon for Kodi.")
     notify("EDL file written successfully!")
Exemplo n.º 6
0
        millis = 0
        millis += oldtime["hours"] * 60 * 60 * 1000
        millis += oldtime["minutes"] * 60 * 1000
        millis += oldtime["seconds"] * 1000
        millis += oldtime["milliseconds"]
        return millis

    def fromMillis(self, millis):
        s = int(float(millis)/1000)
        ms = millis - (s * 1000)
        m, s = divmod(s, 60)
        h, m = divmod(m, 60)
        return {"hours": h,
                "minutes": m,
                "seconds": s,
                "milliseconds": ms}

    def Toggle(self):
        params = {"playerid": self.playerid}
        sendJSON("Player.PlayPause", params)

writer = EDLWriter()
player = EDLPlayer(xbmc.PLAYER_CORE_DVDPLAYER, writer=writer)

notify("Script started.")

while player.is_active:
    xbmc.sleep(1000)

notify("EDL script stopped.")
Exemplo n.º 7
0
 def Finish(self):
     with open("{0}.edl".format(self.videoname), "w") as edl:
         for scene in self.edllist:
             edl.write("{start:.3f}\t{end:.3f}\t{type}\n".format(**scene))
         edl.write("# File generated by script.edl.creator addon for Kodi.")
     notify("EDL file written successfully!")