コード例 #1
0
 def __init__(self, service):
     self.path = service.getPath()
     logger.debug("path: %s", self.path)
     self.file_type, self.name, self.short_description, self.extended_description, self.service_reference, self.cuts, self.tags = "", "", "", "", "", "", ""
     self.size = self.length = self.event_start_time = self.recording_start_time = 0
     if self.path:
         afile = FileManager.getInstance().getFile("recordings", self.path)
         if afile:
             self.file_type = afile[FILE_IDX_TYPE]
             self.event_start_time = afile[FILE_IDX_EVENT_START_TIME]
             self.recording_start_time = afile[
                 FILE_IDX_RECORDING_START_TIME]
             self.name = afile[FILE_IDX_NAME] if afile[
                 FILE_IDX_NAME] != "trashcan" else _("trashcan")
             self.short_description = afile[FILE_IDX_DESCRIPTION]
             self.extended_description = afile[
                 FILE_IDX_EXTENDED_DESCRIPTION]
             self.length = afile[FILE_IDX_LENGTH] if afile[
                 FILE_IDX_TYPE] == FILE_TYPE_FILE else None
             self.service_reference = afile[FILE_IDX_SERVICE_REFERENCE]
             self.size = afile[FILE_IDX_SIZE]
             self.tags = afile[FILE_IDX_TAGS]
             self.cut_list = unpackCutList(afile[FILE_IDX_CUTS])
         else:
             info = eServiceCenter.getInstance().info(service)
             self.length = info.getLength(
                 service) if self.length < 86400 else 0
             if os.path.isfile(self.path):
                 self.event_start_time = self.recording_start_time = int(
                     os.stat(self.path).st_ctime)
             else:
                 self.event_start_time = self.recording_start_time = 0
コード例 #2
0
 def readCutList(self, path):
     cut_list = []
     afile = FileManager.getInstance().getFile("recordings", path)
     if afile:
         data = afile[FILE_IDX_CUTS]
         cut_list = unpackCutList(data)
     logger.info("cut_list: %s", cut_list)
     return cut_list
コード例 #3
0
 def __movieEntry(self, filedata):
     #print("MVC: MovieCache: movieEntry: %s" % filedata(IDX_PATH))
     _directory, filetype, path, _filename, ext, name, date, length, _description, _extended_description, service_reference, _size, cuts, _tags = filedata
     service = getPlayerService(path, name, ext)
     cut_list = None
     if filetype == TYPE_ISFILE:
         cut_list = verifyCutList(unpackCutList(cuts))
         #print("MVC: MovieCache: __movieEntry: path: %s, cut_list: %s" % (path, cut_list))
     selnum = 0
     return (service, date, name, path, selnum, length, ext, filetype,
             cut_list, service_reference)
コード例 #4
0
	def __readCutFile(self, path):
		from MovieCache import MovieCache, IDX_CUTS
		if path:
			#print("MVC: CutList: __readCutFile: reading cut_list from cache: " + os.path.splitext(path)[0])
			filedata = MovieCache.getInstance().getFile(os.path.splitext(path)[0])
			data = filedata[IDX_CUTS]
			cut_list = unpackCutList(data)
			#print("MVC: CutList: __readCutFile: cut_list: " + str(cut_list))
		else:
			cut_list = []
			#print("MVC: CutList: __readCutFile: no path specified")
		return cut_list
コード例 #5
0
	def __init__(self, service):
		self.path = service and service.getPath()
		_dirname, filetype, _path, _filename, _ext, name, date, length, description, extended_description, service_reference, size, cuts, tags = MovieCache.getInstance().getFile(self.path)
		self.__filetype = filetype
		self.__date = str2date(date)
		self.__name = name
		self.__eventname = name
		self.__mtime = int(mktime(self.__date.timetuple()))
		self.__shortdescription = description
		self.__extendeddescription = extended_description
		self.__length = length
		self.__rec_ref_str = service_reference
		self.__size = size
		self.__tags = tags
		self.__cut_list = unpackCutList(cuts)
		self.__id = 0
コード例 #6
0
	def updateFromCuesheet(self):
		#print("MVC: CutList: updateFromCuesheet")
		# Use non native cuesheet support
		# [Cutlist.Workaround] merge with Backup-File if exists
		if DO_CUTLIST_WORKAROUND:
			path = self.cut_file + ".save"
			if os.path.exists(path):
				#print("MVC: CutList: updateFromCuesheet: reading from Backup-File")
				data = readCutsFile(path)
				self.cut_list = mergeCutList(self.cut_list, unpackCutList(data))
				#print("MVC: CutList: updateFromCuesheet: delete Backup-File ")
				os.remove(path)
			else:
				#print("MVC: CutList: updateFromCuesheet: no Backup-File found: " + path)
				pass
		cut_list = self.__readCutFile(self.cut_file)
		self.cut_list = mergeCutList(self.cut_list, cut_list)
		self.__writeCutFile(self.cut_file, self.cut_list)
コード例 #7
0
ファイル: MovieList.py プロジェクト: dream-alpha/MovieCockpit
        def getProgress(recording, path, event_start_time, length, cuts):
            logger.debug("path: %s", path)

            if recording:
                last = time() - event_start_time
            else:
                # get last position from cut file
                cut_list = unpackCutList(cuts)
                logger.debug("cut_list: %s", cut_list)
                last = ptsToSeconds(getCutListLast(cut_list))
                logger.debug("last: %s", last)

            progress = 0
            if length > 0 and last > 0:
                last = min(last, length)
                progress = int(round(float(last) / float(length), 2) * 100)

            logger.debug("progress: %s, path: %s, length: %s, recording: %s",
                         progress, path, length, recording)
            return progress
コード例 #8
0
    def dump(self, cache=True, detailed=False):
        if not cache:
            self.cursor.execute("SELECT * FROM recordings")
            rows = self.cursor.fetchall()
            #print("MVC: MovieCache: dump: =========== database dump ==============")
        else:
            rows = self.filelist
            #print("MVC: MovieCache: dump: =========== cache dump =================")

        for directory, filetype, path, filename, ext, name, date, length, description, extended_description, service_reference, size, cuts, tags in rows:
            print("MVC: MovieCache: dump: media: %s|%s|%s|%s|%s" %
                  (directory, filetype, path, filename, ext))
            if detailed:
                print("MVC: MovieCache: dump: - name : %s" % name)
                print("MVC: MovieCache: dump: - date : %s" % date)
                print("MVC: MovieCache: dump: - len  : %s" % length)
                print("MVC: MovieCache: dump: - desc : %s" % description)
                print("MVC: MovieCache: dump: - ext  : %s" %
                      extended_description)
                print("MVC: MovieCache: dump: - sref : %s" % service_reference)
                print("MVC: MovieCache: dump: - size : %s" % size)
                print("MVC: MovieCache: dump: - cuts : %s" %
                      unpackCutList(cuts))
                print("MVC: MovieCache: dump: - tags : %s" % tags)
コード例 #9
0
 def reloadCutList(self, path):
     data = readFile(path + ".cuts")
     FileManager.getInstance().update(path, cuts=data)
     cut_list = unpackCutList(data)
     logger.info("path: %s, cut_list: %s", path, cut_list)
     return cut_list
コード例 #10
0
	def reloadCutListFromFile(self):
		from MovieCache import MovieCache
		data = readCutsFile(self.cut_file)
		MovieCache.getInstance().update(os.path.splitext(self.cut_file)[0], pcuts=data)
		self.cut_list = verifyCutList(unpackCutList(data))
		return self.cut_list