Skip to content

Commit 0c79d5a

Browse files
committed
update team name
1 parent b4ec251 commit 0c79d5a

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ volleystats --fed FED --match MATCH
104104
- Command: $ `volleystats --fed cbv --match 1623`
105105
- Output files:
106106
```
107-
data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv
107+
data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv
108108
data/cbv-1623-22-10-28-home-fluminense.csv
109109
```
110110
@@ -115,7 +115,7 @@ volleystats --fed FED --match MATCH
115115
- Command: $ `volleystats --fed lvf --match 2093`
116116
- Output files:
117117
```
118-
data/lvf-2093-2022-11-23-guest-jonavos-sc.csv
118+
data/lvf-2093-2022-11-23-guest-jonavossc.csv
119119
data/lvf-2093-2022-11-23-home-svaja-viktorija-lsu.csv
120120
```
121121
@@ -185,12 +185,12 @@ volleystats --fed FED --batch CSV_FILE_PATH
185185
- Command: $ `volleystats --fed cbv --batch data/cbv-18-2022-2023-competition-matches.csv`
186186
- Output files:
187187
```
188-
data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv
188+
data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv
189189
data/cbv-1623-22-10-28-home-fluminense.csv
190-
data/cbv-1618-2022-11-01-guest-energis-8-s-o-caetano.csv
191-
data/cbv-1618-2022-11-01-home-esporte-clube-pinheiros.csv
192-
data/cbv-1619-2022-11-01-guest-abel-moda-volei.csv
193-
data/cbv-1619-2022-11-01-home-gerdau-minas.csv
190+
data/cbv-1618-2022-11-01-guest-energis8sãocaetano.csv
191+
data/cbv-1618-2022-11-01-home-esporteclubepinheiros.csv
192+
data/cbv-1619-2022-11-01-guest-abelmodavolei.csv
193+
data/cbv-1619-2022-11-01-home-gerdauminas.csv
194194
...
195195
```
196196
@@ -221,7 +221,7 @@ ____________________|____-_ _|_______________,
221221
222222
volleystats: started
223223
volleystats: data/cbv-1623-22-10-28-home-fluminense.csv file was created
224-
volleystats: data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv file was created
224+
volleystats: data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv file was created
225225
volleystats: finished
226226
```
227227

volleystats/spiders/match.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self, fed_acronym='', match_id='', **kwargs):
1313
self.match_id = match_id
1414
match_date = ''
1515
home_team = ''
16+
home_team_file = ''
1617

1718
super().__init__(**kwargs)
1819

@@ -27,10 +28,10 @@ def parse(self, response):
2728
if enGB == 'EN':
2829
match_date = parse_engb_date(match_date_text)
2930

30-
home_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_HomeTeam']/text())").get().replace(' ', '-')
31-
home_team = re.sub('[^A-Za-z0-9]+', '-', home_team_string)
32-
if home_team:
33-
home_team = home_team.lower()
31+
home_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_HomeTeam']/text())").get()
32+
if home_team_string:
33+
home_team = home_team_string.lower()
34+
home_team_file = re.sub(' ', '', home_team)
3435

3536
coach = response.xpath("//span[@id='Content_Main_ctl17_RP_MatchStats_Coach_Home_0']/text()").get()
3637
if coach:
@@ -98,10 +99,11 @@ def parse(self, response):
9899

99100
self.match_date = match_date
100101
self.home_team = home_team
102+
self.home_team_file = home_team_file
101103

102104
def closed(spider, reason):
103105
src = f'data/{spider.fed_acronym}-{spider.match_id}-home_stats.csv'
104-
dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-home-{spider.home_team}.csv'
106+
dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-home-{spider.home_team_file}.csv'
105107

106108
try:
107109
os.rename(src, dst)
@@ -119,6 +121,7 @@ def __init__(self, fed_acronym='', match_id='', **kwargs):
119121
self.match_id = match_id
120122
match_date = ''
121123
guest_team = ''
124+
guest_team_file = ''
122125

123126
super().__init__(**kwargs)
124127

@@ -133,10 +136,10 @@ def parse(self, response):
133136
if enGB == 'EN':
134137
match_date = parse_engb_date(match_date_text)
135138

136-
guest_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_GuestTeam']/text())").get().replace(' ', '-')
137-
guest_team = re.sub('[^A-Za-z0-9]+', '-', guest_team_string)
138-
if guest_team:
139-
guest_team = guest_team.lower()
139+
guest_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_GuestTeam']/text())").get()
140+
if guest_team_string:
141+
guest_team = guest_team_string.lower()
142+
guest_team_file = re.sub(' ', '', guest_team)
140143

141144
coach = response.xpath("//span[@id='Content_Main_ctl17_RP_MatchStats_Coach_Guest_0']/text()").get()
142145
if coach:
@@ -204,10 +207,11 @@ def parse(self, response):
204207

205208
self.match_date = match_date
206209
self.guest_team = guest_team
210+
self.guest_team_file = guest_team_file
207211

208212
def closed(spider, reason):
209213
src = f'data/{spider.fed_acronym}-{spider.match_id}-guest_stats.csv'
210-
dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-guest-{spider.guest_team}.csv'
214+
dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-guest-{spider.guest_team_file}.csv'
211215

212216
try:
213217
os.rename(src, dst)

volleystats/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.8'
1+
__version__ = '0.8.1'

0 commit comments

Comments
 (0)