You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
Issue by psinnott Thursday Oct 20, 2011 at 01:16 GMT Originally opened as sole#6
I came across 2 problems with the parsing.
The first is that my device produces a slightly different format.
e.g. :
---xrwxr-x 1 system sdcard_r 0 Aug 4 01:50 cineworld.trace
I'm not sure if this is due to the rom (miui) or something else.
The second is that the format of the date depends on the age of the file. I think this is quite normal for ls. Relatively new files have no year but older files include a year.
I have replaced the parse_device_list as below. Obviously the date handling isn't really much of an improvement but accurate display of the date is a far second to displaying the files (for me anyway :)
def parse_device_list(self, lines):
entries = {}
pattern = re.compile(r"^(?P<permissions>[drwx\-]+) (?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}) (?P<name>.+)$")
pattern = re.compile(r"^(?P<permissions>[drwx\-]+)\s+\d+\s+(?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\w{3}[ :0-9]+) (?P<name>.+)$")
for line in lines:
line = line.rstrip()
match = pattern.match(line)
if match:
permissions = match.group('permissions')
owner = match.group('owner')
group = match.group('group')
fsize = match.group('size')
if fsize is None:
fsize = 0
filename = match.group('name')
try:
timestamp = time.mktime((time.strptime("2011 " + match.group('datetime'), "%Y %b %d %H:%M")))
except:
timestamp = 0
is_directory = permissions.startswith('d')
entries[filename] = {
'is_directory': is_directory,
'size': fsize,
'timestamp': timestamp,
'permissions': permissions,
'owner': owner,
'group': group
}
else:
print line, "wasn't matched, please report to the developer!"
return entries
The text was updated successfully, but these errors were encountered:
Issue by psinnott
Thursday Oct 20, 2011 at 01:16 GMT
Originally opened as sole#6
I came across 2 problems with the parsing.
The first is that my device produces a slightly different format.
e.g. :
---xrwxr-x 1 system sdcard_r 0 Aug 4 01:50 cineworld.trace
I'm not sure if this is due to the rom (miui) or something else.
The second is that the format of the date depends on the age of the file. I think this is quite normal for ls. Relatively new files have no year but older files include a year.
I have replaced the parse_device_list as below. Obviously the date handling isn't really much of an improvement but accurate display of the date is a far second to displaying the files (for me anyway :)
The text was updated successfully, but these errors were encountered: