Skip to content

Commit

Permalink
Remove spaces from file names when copying images
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Marston <[email protected]>
  • Loading branch information
richardmarston committed Dec 6, 2021
1 parent 80663be commit 77fe6af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions process_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
INPUT_DIR=$1
OUTPUT_DIR=$2

set -x

find $INPUT_DIR -type f -not -name '*.xlsx' -exec sh -c '
FILE="$0"
OUTPUT_DIR="$1"
cp "$FILE" "$OUTPUT_DIR/"
FILE_NO_SPACES=$(basename "${FILE}" | tr '[:blank:]' '_')
cp "$FILE" "$OUTPUT_DIR/$FILE_NO_SPACES"
' {} ${OUTPUT_DIR} ';'
8 changes: 3 additions & 5 deletions xlsx2xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def switch_uriType(argument):
name = cell_str(sheet_ranges, 38, 3+index)
drawingType = cell_str(sheet_ranges, 39, 3+index)
uriType = cell_str(sheet_ranges, 40, 3+index)
uri = cell_str(sheet_ranges, 41, 3+index)
uri = cell_str(sheet_ranges, 41, 3+index).strip().replace(' ', '_')
if name != 'None' and uri!='None' :
drawing = IEC62559.Drawing()
resourcestr = IEC62559.Resource_String(uri)
Expand Down Expand Up @@ -332,8 +332,6 @@ def extract_usecase(sheet_ranges):
usecase.nature = cell(sheet_ranges, 33, column)
usecase.keywords = cell(sheet_ranges, 34, column)
usecase.Version.append(extract_version(sheet_ranges))
#drawing = extract_drawings(sheet_ranges)
#if drawing != None:
for drawing in extract_drawings(sheet_ranges):
usecase.Drawing.append(drawing)
for kpi in extract_kpis(sheet_ranges):
Expand All @@ -359,12 +357,12 @@ def main():
if len(sys.argv) > 1:
filename = str(sys.argv[1])
else:
print("No arguments introduced")
print("No arguments introduced", file=sys.stderr)

try:
wb = load_workbook(filename)
except:
print("File does not exist!")
print("File does not exist!", file=sys.stderr)
pass

sheet_list = wb.sheetnames
Expand Down

0 comments on commit 77fe6af

Please sign in to comment.