# Path: ranger/ext/spawn.py
# def spawn(*popenargs, **kwargs):
#     """Runs a program, waits for its termination and returns its stdout
# 
#     This function is similar to python 2.7's subprocess.check_output,
#     but is favored due to python 2.6 compatibility.
# 
#     The arguments may be:
# 
#         spawn(string)
#         spawn(command, arg1, arg2...)
#         spawn([command, arg1, arg2])
# 
#     Will be run through a shell if `popenargs` is a string, otherwise the command
#     is executed directly.
# 
#     The keyword argument `decode` determines if the output shall be decoded
#     with the encoding UTF-8.
# 
#     Further keyword arguments are passed to Popen.
#     """
#     if len(popenargs) == 1:
#         return check_output(popenargs[0], **kwargs)
#     return check_output(list(popenargs), **kwargs)


from abc import ABCMeta, abstractproperty, abstractmethod
from datetime import datetime
from ranger.ext.human_readable import human_readable, human_readable_time
from ranger.ext import spawn
            from subprocess import CalledProcessError

    def infostring(self, fobj, metadata):
        if metadata.authors:
            authorstring = metadata.authors
            if ',' in authorstring:
                authorstring = authorstring[0:authorstring.find(",")]
            return authorstring
        return ""


class PermissionsLinemode(LinemodeBase):
    name = "permissions"

    def filetitle(self, fobj, metadata):
        return "%s %s %s %s" % (
            fobj.get_permission_string(), fobj.user, fobj.group, fobj.relative_path)

    def infostring(self, fobj, metadata):
        return ""


class FileInfoLinemode(LinemodeBase):
    name = "fileinfo"

    def filetitle(self, fobj, metadata):
        return fobj.relative_path

    def infostring(self, fobj, metadata):
        if not fobj.is_directory:
            try:

# Path: ranger/ext/spawn.py
# def spawn(*popenargs, **kwargs):
#     """Runs a program, waits for its termination and returns its stdout
# 
#     This function is similar to python 2.7's subprocess.check_output,
#     but is favored due to python 2.6 compatibility.
# 
#     The arguments may be:
# 
#         spawn(string)
#         spawn(command, arg1, arg2...)
#         spawn([command, arg1, arg2])
# 
#     Will be run through a shell if `popenargs` is a string, otherwise the command
#     is executed directly.
# 
#     The keyword argument `decode` determines if the output shall be decoded
#     with the encoding UTF-8.
# 
#     Further keyword arguments are passed to Popen.
#     """
#     if len(popenargs) == 1:
#         return check_output(popenargs[0], **kwargs)
#     return check_output(list(popenargs), **kwargs)


# Path: ranger/core/linemode.py
from abc import ABCMeta, abstractproperty, abstractmethod
from datetime import datetime
from ranger.ext.human_readable import human_readable, human_readable_time
from ranger.ext import spawn
            from subprocess import CalledProcessError


    def infostring(self, fobj, metadata):
        if metadata.authors:
            authorstring = metadata.authors
            if ',' in authorstring:
                authorstring = authorstring[0:authorstring.find(",")]
            return authorstring
        return ""


class PermissionsLinemode(LinemodeBase):
    name = "permissions"

    def filetitle(self, fobj, metadata):
        return "%s %s %s %s" % (
            fobj.get_permission_string(), fobj.user, fobj.group, fobj.relative_path)

    def infostring(self, fobj, metadata):
        return ""


class FileInfoLinemode(LinemodeBase):
    name = "fileinfo"

    def filetitle(self, fobj, metadata):
        return fobj.relative_path

    def infostring(self, fobj, metadata):
        if not fobj.is_directory:
            try:

                fileinfo = spawn.check_output(["file", "-Lb", fobj.path]).strip()