Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mason-today-web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
mason-today-web
Commits
340a95e7
Commit
340a95e7
authored
Jan 27, 2018
by
Landon DeCoito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split time from day of the week and date. concatenated cleanup functions
parent
2bc0f147
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
9 deletions
+39
-9
pscripts/parscript.py
pscripts/parscript.py
+39
-9
No files found.
pscripts/parscript.py
View file @
340a95e7
#print "and we begin"
from
bs4
import
BeautifulSoup
from
datetime
import
date
,
time
import
requests
eventDict
=
{}
...
...
@@ -12,22 +13,34 @@ class Event:
self
.
__time
=
"timeplaceholder"
self
.
__date
=
"dateplaceholder"
self
.
__location
=
"locationplaceholder"
self
.
__timehour
=
"00"
self
.
__timemin
=
"00"
self
.
__day
=
"null day"
def
__str__
(
self
):
return
self
.
__name
+
": "
+
self
.
__description
+
"
\n\n
"
def
addDescript
(
description
):
def
setDescription
(
description
):
self
.
__description
=
description
def
add
Time
(
time
):
def
set
Time
(
time
):
self
.
__time
=
time
def
add
Date
(
date
):
def
set
Date
(
date
):
self
.
__date
=
date
def
add
Location
(
location
):
def
set
Location
(
location
):
self
.
__location
=
location
def
setTimehour
(
timehour
):
self
.
__timehour
=
timehour
def
setTimeminute
(
timemin
):
self
.
__timemin
=
timemin
def
setDay
(
day
):
self
.
__day
=
day
def
cleanup
(
str
):
str
=
str
.
replace
(
"&"
,
"&"
)
str
=
str
.
replace
(
" "
,
" "
)
...
...
@@ -35,6 +48,10 @@ def cleanup(str):
str
=
str
.
replace
(
"<"
,
"<"
)
str
=
str
.
replace
(
">"
,
">"
)
str
=
str
.
replace
(
"<br/>"
,
"
\n
"
)
str
=
str
.
replace
(
"Publish event on the Calendar?: TRUE
\n
"
,
""
)
str
=
str
.
replace
(
"Performing any medical procedures?: FALSE
\n
"
,
""
)
str
=
str
.
replace
(
"Parking Needed?: FALSE
\n
"
,
""
)
str
=
str
[
0
:
len
(
str
)
-
1
]
return
str
...
...
@@ -76,8 +93,7 @@ for entry in entries:
entry_content
=
entry_content
.
replace
(
"
\n\n
"
,
"
\n
"
)
#check clearcontent function
entry_content
=
cleancontent
(
entry_content
)
entry_content
=
cleanup
(
entry_content
)
#we might just get rid of this one
#each piece of content may is seperated by a newline, entry_detailes creates a list
entry_detailes
=
entry_content
.
split
(
"
\n
"
)
...
...
@@ -125,7 +141,7 @@ for entry in entries:
entry_detailes
[
0
][
0
:
7
]
==
"Ongoing"
):
#See (B)
if
len
(
entry_detailes
)
==
1
:
location
=
"no location"
entry
.
location
=
"no location"
date
=
entry_detailes
[
0
]
description
=
"no description"
#see (C)
...
...
@@ -164,7 +180,7 @@ for entry in entries:
description
=
entry_detailes
[
2
]
#This extra case was made because one entry had the description split into two by a
#newline so it registered as two descriptions making the length = 3
elif
len
(
entry_detailes
)
==
4
:
elif
len
(
entry_detailes
)
==
4
:
location
=
entry_detailes
[
0
]
date
=
entry_detailes
[
1
]
description
=
entry_detailes
[
2
]
+
" "
+
entry_detailes
[
3
]
...
...
@@ -175,9 +191,23 @@ for entry in entries:
else
:
print
"if this prints there is something wrong please don't show up"
date
=
date
.
split
(
","
)
day
=
date
[
0
]
time
=
date
[
3
][
1
:]
date
=
date
[
1
][
1
:]
+
","
+
date
[
2
]
date
=
date
.
split
(
" "
)
month
=
date
[
0
]
monthday
=
date
[
1
][:(
len
(
date
[
1
])
-
1
)]
year
=
date
[
2
]
print
"-----------------------------------------------------------------------------"
print
location
print
date
print
day
print
month
print
monthday
print
year
print
time
print
description
print
"----------------------------------------------------------------------------"
...
...
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