Exemplo n.º 1
0
    def do_list_media(pipe):
        import mimetypes
        parent_pipe.close()

        mf = _list_media_files(target_dir, exts=exts, prefix=prefix)
        for (p, st) in mf:
            path = p[len(target_dir):]
            if not path.startswith('/'):
                path = '/' + path

            timestamp = st.st_mtime
            size = st.st_size

            pipe.send({
                'path':
                path,
                'mimeType':
                mimetypes.guess_type(path)[0]
                if mimetypes.guess_type(path)[0] is not None else 'video/mpeg',
                'momentStr':
                utils.pretty_date_time(
                    datetime.datetime.fromtimestamp(timestamp)),
                'momentStrShort':
                utils.pretty_date_time(
                    datetime.datetime.fromtimestamp(timestamp), short=True),
                'sizeStr':
                utils.pretty_size(size),
                'timestamp':
                timestamp
            })

        pipe.close()
Exemplo n.º 2
0
    def do_list_media(pipe):
        mf = _list_media_files(target_dir, exts=exts, prefix=prefix)
        for (p, st) in mf:
            path = p[len(target_dir):]
            if not path.startswith('/'):
                path = '/' + path

            timestamp = st.st_mtime
            size = st.st_size

            pipe.send({
                'path':
                path,
                'momentStr':
                utils.pretty_date_time(
                    datetime.datetime.fromtimestamp(timestamp)),
                'momentStrShort':
                utils.pretty_date_time(
                    datetime.datetime.fromtimestamp(timestamp), short=True),
                'sizeStr':
                utils.pretty_size(size),
                'timestamp':
                timestamp
            })

        pipe.close()
Exemplo n.º 3
0
 def do_list_media(pipe):
     mf = _list_media_files(target_dir, exts=exts, prefix=prefix)
     for (p, st) in mf:
         path = p[len(target_dir):]
         if not path.startswith('/'):
             path = '/' + path
 
         timestamp = st.st_mtime
         size = st.st_size
         
         pipe.send({
             'path': path,
             'momentStr': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp)),
             'momentStrShort': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp), short=True),
             'sizeStr': utils.pretty_size(size),
             'timestamp': timestamp
         })
     
     pipe.close()
Exemplo n.º 4
0
    def do_list_media(pipe):
        mf = _list_media_files(target_dir, exts=exts, prefix=prefix)
        for (p, st) in mf:
            path = p[len(target_dir) :]
            if not path.startswith("/"):
                path = "/" + path

            timestamp = st.st_mtime
            size = st.st_size

            pipe.send(
                {
                    "path": path,
                    "momentStr": utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp)),
                    "momentStrShort": utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp), short=True),
                    "sizeStr": utils.pretty_size(size),
                    "timestamp": timestamp,
                }
            )

        pipe.close()
Exemplo n.º 5
0
    def do_list_media(pipe):
        import mimetypes
        parent_pipe.close()

        mf = _list_media_files(target_dir, exts=exts, prefix=prefix)
        for (p, st) in mf:
            path = p[len(target_dir):]
            if not path.startswith('/'):
                path = '/' + path

            timestamp = st.st_mtime
            size = st.st_size

            pipe.send({
                'path': path,
                'mimeType': mimetypes.guess_type(path)[0] if mimetypes.guess_type(path)[0] is not None else 'video/mpeg',
                'momentStr': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp)),
                'momentStrShort': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp), short=True),
                'sizeStr': utils.pretty_size(size),
                'timestamp': timestamp
            })

        pipe.close()