Skip to content

Commit

Permalink
Màj scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Binnette committed Feb 5, 2024
1 parent ad100a1 commit b3b63f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Scrapping/Scrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ resultCommands = resultCommands.concat(commands);
resultCommands.push(`num_files=$(ls . | wc -l)`)
resultCommands.push(`cd ..`)
resultCommands.push(`if [ $num_files -ne '${nbPhotos}' ]; then`);
resultCommands.push(` echo "🔴 Incorrect number of pictures ${nbPhotos}"`);
resultCommands.push(` echo "🔴 Incorrect number of pictures $num_files / ${nbPhotos}"`);
resultCommands.push(`else`);
resultCommands.push(` echo "🟢 Correct number of pictures ${nbPhotos}"`);
resultCommands.push(`fi\n`);
resultCommands.push(` echo "🟢 Correct number of pictures $num_files / ${nbPhotos}"`);
resultCommands.push(`fi`);
resultCommands.push(`# Script end\n`);
resultCommands.join("\n");
```

Expand Down
6 changes: 4 additions & 2 deletions Scrapping/eventsJsonToCsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def remove_emoji(string):
return emoji_pattern.sub(r'', string)

# Define a function to replace letters with accent by letters without accent
def remove_accents(string):
def replace_char(string):
# Use a dictionary to map the letters with accent to the letters without accent
accent_map = {
" ": "-",
":": "",
"á": "a",
"é": "e",
"í": "i",
Expand Down Expand Up @@ -169,7 +171,7 @@ def map_event_to_csv_row(event):
csv_row["Trail2"] = ''

# Map the album using the format_date function, the title and the remove_accents function
csv_row["Album"] = format_date(event["dateTime"]) + "-" + remove_accents(event["title"].strip()).replace(" ", "-") + ".html"
csv_row["Album"] = format_date(event["dateTime"]) + "-" + replace_char(event["title"].strip()) + ".html"

# Return the csv row
return csv_row
Expand Down

0 comments on commit b3b63f8

Please sign in to comment.