예제 #1
0
    def getVideoLength(self, filename):
        self.log("getVideoLength, " + filename)
        if len(filename) == 0:
            self.log("getVideoLength, No file name specified")
            return 0

        if FileAccess.exists(filename) == False:
            if filename[0:6].lower() == 'smb://':
                self.log(
                    "getVideoLength, Unknown SMB file found, Trying to mount drive"
                )
                filename = FileAccess._openSMB(filename)
            else:
                self.log("getVideoLength, Unable to find the file")
                return 0

        base, ext = os.path.splitext(filename)
        ext = ext.lower()

        if ext in self.AVIExts:
            self.parser = AVIParser.AVIParser()
        elif ext in self.MP4Exts:
            self.parser = MP4Parser.MP4Parser()
        elif ext in self.MKVExts:
            self.parser = MKVParser.MKVParser()
        elif ext in self.FLVExts:
            self.parser = FLVParser.FLVParser()
        elif ext in self.TSExts:
            self.parser = TSParser.TSParser()
        elif ext in self.STRMExts:
            self.parser = STRMParser.STRMParser()
        else:
            self.log("getVideoLength, No parser found for extension " + ext)
            return 0
        return self.parser.determineLength(filename)
예제 #2
0
    def getVideoLength(self, filename):
        self.log("getVideoLength " + filename)

        if len(filename) == 0:
            self.log("No file name specified")
            return 0

        base, ext = os.path.splitext(filename)
        ext = ext.lower()

        if ext in self.AVIExts:
            self.parser = AVIParser.AVIParser()
        elif ext in self.MP4Exts:
            self.parser = MP4Parser.MP4Parser()
        elif ext in self.MKVExts:
            self.parser = MKVParser.MKVParser()
        elif ext in self.FLVExts:
            self.parser = FLVParser.FLVParser()
        elif ext in self.TSExts:
            self.parser = TSParser.TSParser()
        else:
            self.log("No parser found for extension %s" % ext)
            return 0

        return self.parser.determineLength(filename)
예제 #3
0
    def getVideoLength(self, filename):
        self.log("getVideoLength " + filename)

        if len(filename) == 0:
            self.log("No file name specified")
            return 0

        if FileAccess.exists(filename) == False:
            self.log("Unable to find the file")
            return 0

        base, ext = os.path.splitext(filename)
        ext = ext.lower()

        if ext in self.AVIExts:
            self.parser = AVIParser.AVIParser()
        elif ext in self.MP4Exts:
            self.parser = MP4Parser.MP4Parser()
        elif ext in self.MKVExts:
            self.parser = MKVParser.MKVParser()
        elif ext in self.FLVExts:
            self.parser = FLVParser.FLVParser()
        elif ext in self.TSExts:
            self.parser = TSParser.TSParser()
        elif ext in self.STRMExts:
            self.parser = STRMParser.STRMParser()
        else:
            self.log("No parser found for extension " + ext)
            return 0

        return self.parser.determineLength(filename)
예제 #4
0
    def getVideoLength(self, filename):
        filename = xbmc.makeLegalFilename(filename)
        self.log("getVideoLength " + filename)

        if len(filename) == 0:
            self.log("No file name specified")
            return 0

        self.log("os name is " + os.name)

        if os.path.exists(filename) == False:
            if filename[0:6].lower() == 'smb://':
                filename = self.handleSMB(filename)
            else:
                self.log("Unable to open the file")
                return 0

        base, ext = os.path.splitext(filename)
        ext = ext.lower()

        if ext in self.AVIExts:
            self.parser = AVIParser.AVIParser()
        elif ext in self.MP4Exts:
            self.parser = MP4Parser.MP4Parser()
        elif ext in self.MKVExts:
            self.parser = MKVParser.MKVParser()
        elif ext in self.FLVExts:
            self.parser = FLVParser.FLVParser()
        else:
            self.log("No parser found for extension " + ext)
            return 0

        return self.parser.determineLength(filename)