Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
latex-transcript
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julien Jerphanion
latex-transcript
Commits
a11d9b8f
Commit
a11d9b8f
authored
Jul 11, 2019
by
Mathis Chenuet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes
parent
cbaef3cd
Pipeline
#43203
failed with stage
in 44 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
10 deletions
+18
-10
.gitignore
.gitignore
+1
-1
build_pdf.py
build_pdf.py
+9
-6
scrap.py
scrap.py
+2
-0
src/driver_wrapper.py
src/driver_wrapper.py
+3
-0
src/scrapper.py
src/scrapper.py
+3
-3
No files found.
.gitignore
View file @
a11d9b8f
...
...
@@ -10,4 +10,4 @@ Pipfile.lock
__pycache__
.keys
main.pdf
.mypy_cache
\ No newline at end of file
.mypy_cache
build_pdf.py
View file @
a11d9b8f
...
...
@@ -5,14 +5,14 @@ from sqlalchemy import create_engine
from
sqlalchemy.orm
import
sessionmaker
from
src.latexer
import
LaTeXer
from
src.settings
import
PROJECT_FOLDER
from
src.settings
import
LANG
,
PROJECT_FOLDER
from
src.utils
import
get_db_string
,
get_student_details
if
__name__
==
"__main__"
:
# Specifying info
final_doc
=
os
.
path
.
join
(
PROJECT_FOLDER
,
"main.pdf"
)
latexer
=
LaTeXer
(
final_doc
=
final_doc
)
latexer
=
LaTeXer
(
lang
=
LANG
,
final_doc
=
final_doc
)
# Getting interface for data
engine
=
create_engine
(
get_db_string
())
...
...
@@ -22,7 +22,10 @@ if __name__ == "__main__":
student_details
=
get_student_details
()
# Cooking the transcript 👨🍳
latexer
.
generate_transcript
(
student_details
,
session
,
remove_temp_dir
=
False
,
add_sem_comment
=
False
,
break_page_on_semester
=
True
)
latexer
.
generate_transcript
(
student_details
,
session
,
remove_temp_dir
=
False
,
add_sem_comment
=
False
,
break_page_on_semester
=
True
,
)
scrap.py
View file @
a11d9b8f
#!/usr/bin/env python3
import
os
from
pathlib
import
Path
from
sqlalchemy
import
create_engine
from
sqlalchemy.orm
import
sessionmaker
...
...
@@ -13,6 +14,7 @@ if __name__ == "__main__":
scrapper
=
UTCScrapper
(
results_file
=
os
.
path
.
join
(
DATA_FOLDER
,
'results.html'
))
# Cleaning things
Path
(
__file__
)
.
with_name
(
'data'
)
.
mkdir
(
exist_ok
=
True
)
reset_db
()
db_string
=
get_db_string
()
...
...
src/driver_wrapper.py
View file @
a11d9b8f
...
...
@@ -112,3 +112,6 @@ class DriverWrapper:
def
find_elements_by_xpath
(
self
,
name
):
return
self
.
_d
.
find_elements_by_xpath
(
name
)
def
__getattr__
(
self
,
name
):
return
getattr
(
self
.
_d
,
name
)
src/scrapper.py
View file @
a11d9b8f
...
...
@@ -322,9 +322,9 @@ class UTCScrapper:
# Switching language
if
lang
==
"fr"
:
driver
.
find_element_by_
xpath
(
'//*[@id="mainForm:j_idt206"]/img
'
)
.
click
()
driver
.
find_element_by_
css_selector
(
'[src="img/france.png"]
'
)
.
click
()
else
:
driver
.
find_element_by_
xpath
(
'//*[@id="mainForm:j_idt212"]/img
'
)
.
click
()
driver
.
find_element_by_
css_selector
(
'[src="img/uk.png"]
'
)
.
click
()
time
.
sleep
(
2
)
diploma_option
=
"Ingénieur UTC - Branche"
if
lang
==
"fr"
\
...
...
@@ -498,7 +498,7 @@ class UTCScrapper:
courses_indices
=
dict
()
def
xpath_of_course_code
(
number
):
return
f
'//*[@id="mainForm"]/div/table/tbody/tr[{number+
1
}]/td[1]'
return
f
'//*[@id="mainForm"]/div/table/tbody/tr[{number+
2
}]/td[1]'
while
course_to_parse
:
elems
=
driver
.
find_elements_by_xpath
(
xpath_of_course_code
(
index
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment