Commit 0b335aaa authored by Matthieu Haefele's avatar Matthieu Haefele
Browse files

Merge branch 'dev-haefele' into 'master'

Fix supports for event + online presentation in archive script + speaker display

See merge request !512
parents ec96e49d e0b205fa
Pipeline #6067 passed with stages
in 33 seconds
......@@ -69,7 +69,8 @@ Atelier Optimisation
:end: 15:30
:speaker: Matthieu Boileau
:support:
[support 1](attachments/evt/2019-05-atelier-optimisation/support00)
[support 1](https://groupe-calcul.pages.math.unistra.fr/collaboration_devlog_projet_2019/optimisation/intro/#/)
[support 2](attachments/evt/2019-05-atelier-optimisation/support09.pdf)
......@@ -85,7 +86,7 @@ Atelier Optimisation
:end: 17:30
:speaker: Hadrien Grasland
:support:
[support 1](attachments/evt/2019-05-atelier-optimisation/support01.html)
[support 1](https://groupe-calcul.pages.math.unistra.fr/collaboration_devlog_projet_2019/optimisation/langages/Langages.html#/)
[support 2](attachments/evt/2019-05-atelier-optimisation/support02.pdf)
......@@ -97,7 +98,8 @@ Atelier Optimisation
:end: 10:30
:speaker: Matthieu Haefele
:support:
[support 1](attachments/evt/2019-05-atelier-optimisation/support03)
[support 1](https://groupe-calcul.pages.math.unistra.fr/collaboration_devlog_projet_2019/optimisation/architecture_bottlenecks/computer_architectures.html#/)
[support 2](attachments/evt/2019-05-atelier-optimisation/support10.pdf)
......@@ -129,7 +131,8 @@ Atelier Optimisation
:end: 15:30
:speaker: Hadrien Grasland
:support:
[support 1](attachments/evt/2019-05-atelier-optimisation/support05)
[support 1](https://gitlab.com/acadiou/TP_Profiling)
[support 2](attachments/evt/2019-05-atelier-optimisation/support08.tgz)
......@@ -145,7 +148,7 @@ Atelier Optimisation
:end: 17:00
:speaker: Hadrien Grasland
:support:
[support 1](attachments/evt/2019-05-atelier-optimisation/support06)
[support 1](https://groupe-calcul.pages.math.unistra.fr/collaboration_devlog_projet_2019/optimisation/conclusion/conclusion.html#/)
[support 2](attachments/evt/2019-05-atelier-optimisation/support07.pdf)
......
......@@ -78,7 +78,7 @@ def get_indico_event_as_schedule(url, event):
for person in v['presenters']:
speakers.append(person['firstName'].capitalize() + ' ' + person['familyName'].capitalize())
else:
speakers.append("orateur à confirmer")
speakers.append("Orateur à confirmer")
resources = []
for m in v['material']:
......
......@@ -40,7 +40,7 @@
{% if node_type == 'speaker' %}
<p class="m-0 event-title">{{ node['title'] }}</p>
{% if node['speaker'] %}
<p class="speaker">par {{ node['speaker'] }}</p>
<p class="speaker">{{ node['speaker'] }}</p>
{% endif %}
{% elif node_type == 'break' %}
<p class="event-break">{{ node['break'] }}</p>
......
......@@ -118,18 +118,31 @@ def truncate(dest_dir):
return truncated
def online_pres(url_support):
# Considered as an online presentation if not an archive nor a pdf
ext = os.path.splitext(url_support)
not_online_ext = [".tgz", ".gz", ".bz2", ".pdf"]
res = True
for e in not_online_ext:
res = res and e != ext
return res
def treat_support(line_orig, url_support, dest_dir, support_id):
import urllib.request
response = urllib.request.urlopen(url_support)
content = response.read()
root, ext = os.path.splitext(url_support)
new_support = os.path.join(dest_dir, 'support%02d%s'%(support_id, ext))
f = open(new_support, "wb")
f.write(content)
f.close()
rst_support = os.path.join(truncate(dest_dir), 'support%02d%s'%(support_id, ext))
new_line = line_orig.split('(')[0] + '(' + rst_support + ')\n'
new_line = ""
new_support = None
if online_pres(url_support):
new_line = line_orig.split('(')[0] + '(' + url_support + ')\n'
else:
response = urllib.request.urlopen(url_support)
content = response.read()
root, ext = os.path.splitext(url_support)
new_support = os.path.join(dest_dir, 'support%02d%s'%(support_id, ext))
f = open(new_support, "wb")
f.write(content)
f.close()
rst_support = os.path.join(truncate(dest_dir), 'support%02d%s'%(support_id, ext))
new_line = line_orig.split('(')[0] + '(' + rst_support + ')\n'
return new_line, new_support
......@@ -150,8 +163,9 @@ def fetch_supports(content_with_prog, evt_orig):
print("Treating %s"%res.group(1))
new_line, new_support = treat_support(l, res.group(1), dest_dir, support_id)
content_with_prog[i] = new_line
git_helper_str += "%s \\\n"%new_support
support_id += 1
if new_support != None:
git_helper_str += "%s \\\n"%new_support
support_id += 1
return git_helper_str, content_with_prog
......@@ -180,6 +194,7 @@ python3 %s path/to/evt_to_archive.rst nb_participants"""%(sys.argv[0]))
evt_content = fetch_content(evt_to_treat)
content_with_prog = gen_rst_evt_with_program(evt_content, nb_participants)
user_msg, prog_to_insert = fetch_supports(content_with_prog, evt_to_treat)
#write_content(content_with_prog, "pok")
write_content(content_with_prog, evt_to_treat)
print("\nrst file modified and supports downloaded. Please add them to the repository.\n\n%s"%user_msg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment