pybikes icon indicating copy to clipboard operation
pybikes copied to clipboard

Add Hourbike (Reading, Liverpool, Liconln, Sheffield) #148

Open edumucelli opened this issue 8 years ago • 3 comments

In response to #148. It is important to know, though, that the Hourbike system uses the same BikeU system for two cities: Oxford (Oxonbikes) and Northampton (Cycle Connect):

As the systems (Hourbike and BikeU) are managed by different entities, I think the correct approach here is to replicate the code from BikeU inside Hourbike (using a second class, e.g., HourbikeAlternative). That would be better than the obvious merging of Hourbike cities into BikeU and replicating this code here inside BikeU. I suggest that because if one of those companies change the system, we are screwed and will have to split the code again.

@eskerda, WDYT?

edumucelli avatar Jun 28 '16 22:06 edumucelli

So the only thing different between bikeu and this is the regex to get stations?

I would say proposed solution would screw us more than unifying it with bikeu. Worst case we add more regexes. I can build that up parting from this PR, or if you want to work on it that's fine also.

Easiest, we would define a dict with different regexes like:

regexes = {
    'bikeu': r'<bikeu regex>',
    'hourbike': r'<hourbike regex>',
}

And then setting that key on the data file. We can even default it to bikeu.

As for defining the company, it can be set on the data file. It sucks to write it for each, but it's what we have right now.

As per naming, we do not really know what operates what, most probably bikeu and hourbike are using the same tech.

Other option would be moving the regex as a class attribute, and then creating another class subclassing bikeu. The data file would move to being one of these multiclass data files.

eskerda avatar Jun 30 '16 18:06 eskerda

@eskerda, no, BikeU takes the data from an iframe, all the code related to id("MapData")/@src does not exist on the Hourbike. It is not that the whole code is the same but the regex, it is that they do not share some of the fields, e.g., 'TKBike', 'TKStation'. On the other hand, the two cities I've mentioned share the tech with BikeU.

edumucelli avatar Jul 01 '16 08:07 edumucelli

Only one of the bikeu systems uses the iframe. The others do not use that code either

eskerda avatar Jul 01 '16 09:07 eskerda

Both systems no longer exist.

futuretap avatar Jul 04 '23 15:07 futuretap