Example #1
0
def Execute_Search( form ):
	files = []

	downloader = PDF_Downloader()

	downloader.gen_tournament_link( form['Tournament'], datetime.strptime( str(form['date']), '%Y-%m-%d').date() )

	downloader.filePath = '/home/justin/Documents/Order-Finder/Orders/'

	downloader.get_PDF_links()

	files = downloader.download_orders()

	global search_results

	for order in files:
		# for name in get_items( RiderVar.get() ):
		# for order in files:
		Order = Order_Parser( order )
		Order.Parse_PDF()
		Order.Order_Content()
		riders = ''
		horses = ''
		# if not form['riders'] == '':
			#  for name in form['riders'].split(', '):
	            
	       #      text = ''
	       #      try:
	       #          text = Order.get_order_by_rider( name )
	       #      except IndexError:
	       #          print 'Possible error searching ' + order + ' for ' + name
	       #      # if not text == "":
	       		  # 	riders += text
	       #      #     print Order.info.get('Class')
	       #      #     print Order.info.get('Date_Time')
	       #      #     print Order.info.get('Ring_Table')
	       #      #     print riders

		if not form['horses'] == '':
			for name in form['horses'].split(', '):
				# print 'searching for: ' + name
				
				text = ''
				try:
					text = Order.get_order_by_horse( name )
				except IndexError:
					print 'Possible error searching ' + order + ' for ' + name
				if not text == "":
					horses += text
				#     print Order.info.get('Class')
				#     print Order.info.get('Date_Time')
				#     print Order.info.get('Ring_Table')
				#     print horses

		if (not horses == ''):# or (not riders == ''):
			#print search_results
			search_results += Order.info.get('Class')
			search_results += Order.info.get('Date_Time')
			search_results += Order.info.get('Ring_Table')
			search_results += horses
def Execute_Search():
    files = []

    downloader = PDF_Downloader()

    downloader.gen_tournament_link( Tournaments.get(Tournament.get()), datetime.strptime( str(year.get() + month.get() 
        + day.get()), '%Y%B%d').date() )

    downloader.filePath = FP_Label['text']+'/'

    downloader.get_PDF_links()
    try:
        files = downloader.download_orders()
    except IOError:
        print 'Enter a valid file path'
        return
    for order in files:
    # for name in get_items( RiderVar.get() ):
        # for order in files:
        Order = Order_Parser( order )
        Order.Parse_PDF()
        Order.Order_Content()
        for name in get_items( RiderVar.get() ):
            # print 'searching for: ' + name
            text = ''
            try:
                text = Order.get_order_by_rider( name )
            except IndexError:
                print 'Possible error searching ' + order + ' for ' + name
            if not text == "":
                print Order.info.get('Class')
                print Order.info.get('Date_Time')
                print Order.info.get('Ring_Table')
                print text

        for name in get_items( HorseVar.get() ):
            # print 'searching for: ' + name
            text = ''
            try:
                text = Order.get_order_by_horse( name )
            except IndexError:
                print 'Possible error searching ' + order + ' for ' + name
            if not text == "":
                print Order.info.get('Class')
                print Order.info.get('Date_Time')
                print Order.info.get('Ring_Table')
                print text
import sys
import datetime

print 'Enter Tournament ID: '

ID = raw_input()

print 'Enter Date: ( YYYY MM DD ) '

date = datetime.datetime.strptime( raw_input(), '%Y %m %d' )

print 'Enter Rider Name: '

name = raw_input()

downloader = PDF_Downloader()

downloader.gen_tournament_link( int(ID), date )

downloader.get_PDF_links()

files = downloader.download_orders()

for order in files:
	text = ''
	Order = Order_Parser( order )
	Order.Parse_PDF()
	Order.Order_Content()
	text = Order.get_order_by_rider( name )
	if not text == "":
		print True