Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions flashair.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ def get_files(self):
print('error', r.status_code)
sys.exit(1)

for line in r.text.split()[1:]:
for line in r.text.split("\r\n")[1:]:
# this code has to handle commas in file name and directory name. in data that's comma-delimited
if not len(line.strip()):
continue
first, size, attrib, date, time=line.rsplit(',', 4)
file=first[len(self.dir):]
file=first[len(self.dir):].strip(',') # to strip the comma on higher levels
self.files.append((file, int(size), int(attrib)))
5 changes: 1 addition & 4 deletions sdls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/python3
#!/usr/bin/env python3
# list files on Toshiba FlashAir SD card via wi-fi
# see https://www.flashair-developers.com/en/documents/api/

Expand Down Expand Up @@ -38,9 +38,6 @@ for file, size, attrib in card.files:
else:
# this is a file
# comma-formatted number
kb=size/1024
mb=size/1048576
gb=size/1073741824
output.append((size, file, '{:,}'.format(size), fmt(size)))
sum+=size

Expand Down
2 changes: 1 addition & 1 deletion sdput
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/python3
#!/usr/bin/env python3
# put files on Toshiba FlashAir SD card via wi-fi
# see https://www.flashair-developers.com/en/documents/api/

Expand Down
2 changes: 1 addition & 1 deletion sdrm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/python3
#!/usr/bin/env python3
# delete files from Toshiba FlashAir SD card via wi-fi
# see https://www.flashair-developers.com/en/documents/api/

Expand Down