Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old 14th October 2020, 01:44 PM
chook chook is offline
Member
 
Join Date: Jan 2019
Posts: 14
Default

i hope this gets pasted properly
####### add row number
rowo = 0
for Venue in Venues:
Rtype = Venue["raceType"]
Mname = Venue["meetingName"]
Location = Venue["location"]
###### weather and track condition might not be there
if "weatherCondition" in Venue: Wcondition = Venue["weatherCondition"]
else: Wcondition = "BLEEK"
if "trackCondition" in Venue: Tcondition = Venue["trackCondition"]
else: Tcondition = "TkCoon"
states = ("VIC","NSW","QLD","SA","WA","TAS","ACT")
if Rtype == "R" and Location in states:
#Race Info
Mname_label = Label(Rinfo, text=Mname, font=("bold", 12), width=15, anchor=W, bg="Red")
Mname_label.grid(column=0, sticky=W,row=rowo)
Location_label = Label(Rinfo, text=Location, font=("bold", 12), width=5 ,anchor=W, bg="Pink")
Location_label.grid(column=2, sticky=W,row=rowo)
Tcondition_label = Label(Rinfo, text=Tcondition, font=("bold", 12), width=10 ,anchor=W, bg="Magenta")
Tcondition_label.grid(column=3, sticky=W,row=rowo)
Wcondition_label = Label(Rinfo, text=Wcondition, font=("bold", 12), width=10 ,anchor=W, bg="Lightblue")
Wcondition_label.grid(column=4, sticky=W,row=rowo)
##### increment row number
rowo += 1

# Date Selection Frame

#### end of paste

HTH
Reply With Quote
  #12  
Old 27th October 2020, 12:04 AM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,504
Default

I have almost finished this app, pretty happy with it, just have a small issue i can't resolve.

normally when returning data you will have key pairs to work with but the results are not exactly the same.

Code:
"results":[ [ 8 ], [ 4 ], [ 2 ], [ 9 ] ],


how can i return the number?
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #13  
Old 27th October 2020, 12:25 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,504
Default

Here is an almost finished project exe, it is missing a few things like race start time and results and maybe some instructions.

Just run it, select "Today" or "Tomorrow" highlight the "M-Code" for the meeting you want then put in a race number and press "Get Race"

It gives you some info in regards to ratings used on tab site, i also noted they show the same fixed prices for all the sites.

This is the first program i have written in like 30 years and the first in python, it may be a simple program to some but i am pretty pleased with my efforts as it gave me a better understanding of python i guess, the source code is not pretty and am sure it could be tidied up as there are a few errors.

the program is in my One Drive folder in my signature called "Tab_Prices" there is also a text doc with the python code in there.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #14  
Old 28th October 2020, 12:48 AM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,504
Default

I added a 30 second refresh, you can still switch races.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #15  
Old 7th November 2020, 08:15 AM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,504
Default

This program now collects the results if known and updates every 15 seconds, i would like to colour code the results 1st to 4th, i have tried a few ways but unsuccessful, i have updated the code script if anyone has ideas.

I noticed a bug, will update file when fixed
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________

Last edited by Shaun : 7th November 2020 at 08:19 AM.
Reply With Quote
  #16  
Old 7th November 2020, 04:21 PM
Playlife Playlife is offline
Member
 
Join Date: Nov 2014
Posts: 36
Default

Quote:
Originally Posted by Shaun
Here is an almost finished project exe, it is missing a few things like race start time and results and maybe some instructions.

Just run it, select "Today" or "Tomorrow" highlight the "M-Code" for the meeting you want then put in a race number and press "Get Race"

It gives you some info in regards to ratings used on tab site, i also noted they show the same fixed prices for all the sites.

This is the first program i have written in like 30 years and the first in python, it may be a simple program to some but i am pretty pleased with my efforts as it gave me a better understanding of python i guess, the source code is not pretty and am sure it could be tidied up as there are a few errors.

the program is in my One Drive folder in my signature called "Tab_Prices" there is also a text doc with the python code in there.



EDIT, I do apologise, this only seems to work for VIC.


Hi Shaun, great job.

Unfortunately the move to this new API killed my excel/VBA work as well. I'm new to python, slowly learning the ropes.

It is as clunky as hell, and is manually coded, but using your script I have added the start time. Programmers will wince at how bad this is (sorry!). There's easier ways to do timezone conversions so I have read but cannot wrap my head around it yet.


**** inserted into # race info ****
race_StartTime = race1["raceStartTime"]
****
d1 = datetime.datetime.strptime(race_StartTime,"%Y-%m-%dT%H:%M:%S.%fZ")
new_format = "%H:%M"
HourOnly = "%H"
MinuteOnly = "%M"
Hour = str(int(d1.strftime(HourOnly))+11) # This is for Victoria AEDT (+11 hrs GMT)
Minute = d1.strftime(MinuteOnly)
race_StartTime = "Jump:" + Hour + ":" + Minute

raceStartTime = Label(inputFrame, text=str(race_StartTime), width=25, bg="darkblue", fg="white", font=("bold", 11), anchor=W)
raceStartTime.grid(row=0, column=20)

****
__________________
1977-1982
Gli Anni Della Febbre
Gilles Villeneuve

Last edited by Playlife : 7th November 2020 at 04:24 PM.
Reply With Quote
  #17  
Old 7th November 2020, 11:31 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,504
Default

Quote:
Originally Posted by Playlife
EDIT, I do apologise, this only seems to work for VIC.


Hi Shaun, great job.

Unfortunately the move to this new API killed my excel/VBA work as well. I'm new to python, slowly learning the ropes.

It is as clunky as hell, and is manually coded, but using your script I have added the start time. Programmers will wince at how bad this is (sorry!). There's easier ways to do timezone conversions so I have read but cannot wrap my head around it yet.


**** inserted into # race info ****
race_StartTime = race1["raceStartTime"]
****
d1 = datetime.datetime.strptime(race_StartTime,"%Y-%m-%dT%H:%M:%S.%fZ")
new_format = "%H:%M"
HourOnly = "%H"
MinuteOnly = "%M"
Hour = str(int(d1.strftime(HourOnly))+11) # This is for Victoria AEDT (+11 hrs GMT)
Minute = d1.strftime(MinuteOnly)
race_StartTime = "Jump:" + Hour + ":" + Minute

raceStartTime = Label(inputFrame, text=str(race_StartTime), width=25, bg="darkblue", fg="white", font=("bold", 11), anchor=W)
raceStartTime.grid(row=0, column=20)

****


Cheers, this is the same reason i didn't add the time as yet because of time zones, but anyone could adjust this code to suit there own time zone, that issue i was having with the bug had to do with refreshing, the problem i had was when you change races it started another time refresh sequence, probably a simple fix when i work it out.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #18  
Old 10th November 2020, 07:21 AM
chook chook is offline
Member
 
Join Date: Jan 2019
Posts: 14
Talking cookbook

O'Reilley python cookbook 3 Beazley & Jones
advise using UTC for your time calcs and then moving to local timezone.

chapter 3.16, P 110 in third ed.

from datetime import datetime
#get your UTC date time
dt = datetime(2020,12,20,9,31,22)

from pytz import timezone
nsw = timezone( 'Australia/NSW' )
# = nsw.localize( your UTC date time )
ndt = nsw.localize( dt )

an alternative is to use Queensland time and check to see if you are in summer, by looking at your localtime.
i have done that before
or, move to Queensland
Reply With Quote
  #19  
Old 10th November 2020, 03:38 PM
gsdanger gsdanger is offline
Member
 
Join Date: Jan 1970
Posts: 29
Smile Tab_Prices - On your One Drive (Shaun)...

Hi Shaun,
Good to see you are progressing very well with the new python programming language.
You have made the python file available on your One Drive..That's great.!
My problem is that I cannot locate your One drive option here.(I had this problem a while ago, and you sent me a direct link to your drive, which allowed me to access the drive).
Can you please supply me with the link to your drive, so I can access the "TAB_Prices" file.

I am looking forward to using it and maybe assisting with enhancing it, although I am in the infancy of using the python language.

Please advise....Kind regards.

gsdanger
__________________
Garry D.
Reply With Quote
  #20  
Old 10th November 2020, 10:20 PM
gsdanger gsdanger is offline
Member
 
Join Date: Jan 1970
Posts: 29
Smile Tab_Prices - On your One Drive (Shaun)...

Hi Shaun,

Further to my last post...I managed to find a path to your One Drive...Hooray!

I assume the code needs to be downloaded and installed into the python area. (excuse my dumbness...).

Please advise.......Again please excuse my Dumbness....
Kind Regards....gsdanger
__________________
Garry D.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 06:23 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655