コード例 #1
0
 def run(self):
     connection = DataBase().connection()
     cursor = connection.cursor()
     cursor.execute(DataBase().trunk_ticket_info)
     connection.commit()
     cursor.execute(DataBase().ssidcountquery)
     count = cursor.fetchall()
     count = count[0][0]
     print "data==", count
     limit = 1
     start = 0
     stop = 100
     loopCount = 100
     try:
         limit = count / loopCount
     except:
         limit = 15
         pass
     print "no of threads==", limit + 1
     for i in range(0, limit + 1):
         t = threading.Thread(target=self.bms_ssid_count,
                              args=("thread_name_" + str(i), start, stop))
         t.start()
         start = start + 100
         stop = 100
     try:
         connection.close()
         print "Initial Connection Closed"
     except:
         print "Initial connection Not closed"
コード例 #2
0
 def run(self):
     connection = DataBase().connection()
     cursor = connection.cursor()
     cursor.execute("truncate collections.bms_showtimes")
     connection.commit()
     print DataBase().showtimesCountQuery
     cursor.execute(DataBase().showtimesCountQuery)
     count = cursor.fetchall()
     count = count[0][0]
     limit = 1
     start = 1
     stop = 2000
     loopCount = 2000
     try:
         limit = count / loopCount
     except:
         limit = 15
         pass
     for i in range(0, limit + 1):
         t = threading.Thread(target=self.bms_showtime_count,
                              args=("thread_name_" + str(i), start, stop))
         t.start()
         start = stop + 1
         stop = start + loopCount - 1
     try:
         connection.close()
         print "Initial Connection Closed"
     except:
         print "Initial connection Not closed"
コード例 #3
0
 def run(self):
     connection = DataBase().connection()
     cursor = connection.cursor()
     # cursor.execute("truncate moviesfyi_stage.bk_movies")
     connection.commit()
     cursor.execute(DataBase().showtimesCountQuery)
     count = cursor.fetchall()
     count = count[0][0]
     print "data==", count
     limit = 1
     start = 1
     stop = 300
     loopCount = 300
     try:
         limit = count / loopCount
     except:
         limit = 15
         pass
     print "no of threads==", limit + 1
     for i in range(0, limit + 1):
         t = threading.Thread(target=self.bms_movie_count,
                              args=("thread_name_" + str(i), start, stop))
         t.start()
         start = stop + 1
         stop = start + loopCount - 1
     try:
         connection.close()
         print "Initial Connection Closed"
     except:
         print "Initial connection Not closed"
コード例 #4
0
 def getBmsShowTimes(self, starts, stops):
     connection = DataBase().connection()
     cursor = connection.cursor()
     sql = "SELECT id,theater_url from collections.bms_theaters where theater_url is not null and id between " + str(
         starts) + " and " + str(stops)
     cursor.execute(sql)
     results = cursor.fetchall()
     date = datetime.date.today()
     date = str(date)
     date = date.replace("-", "")
     movies_ins = ""
     count = 0
     for j in results:
         testurl = j[1]
         url = j[1]
         da = "https://in.bookmyshow.com"
         url = da + url
         r = requests.get(url)
         data = r.text
         soup = BeautifulSoup(data)
         query = ""
         list = ""
         for list in soup.find_all('a', href="javascript:;"):
             try:
                 list = list['onclick']
                 if ("blnVistaCine" in list):
                     list = list
                     list = list.split("callSeatLayout(")
                     teatinfo = list[1].split(")")
                     teatinfo = teatinfo[0].split(",")
                     theater_code = teatinfo[0]
                     sessionid = teatinfo[1]
                     movie_code = teatinfo[2]
                     showtime = teatinfo[3]
                     date = date
                     query = query + "(" + movie_code + ",''," + theater_code + ",''," + "'y','" + date + "'," + showtime + "," + "'y'," + sessionid + "),"
             except:
                 ""
         query = query[:-1]
         insquery = DataBase().show_time_ssid + query
         try:
             cursor.execute(insquery)
             connection.commit()
         except:
             ""
     connection.close()
コード例 #5
0
ファイル: Main.py プロジェクト: Qblack/HomeworkTracker
__author__ = 'Q'


from Database import DataBase



db = DataBase("summer2014courses.db")

print("-------------Assignments---------------------")
db.display_table_by_date("Assignments")

print("-------------Readings------------------------")
db.display_table_by_date("Readings")

print("-------------Tests------------------------")
db.display_table_by_date("Tests")

db.close()
コード例 #6
0
            est_occupancy = str(100)
            estimated_collection = totalseats * price
            print estimated_collection
            estimated_collection = str(estimated_collection)
            est_occupancy = str(est_occupancy)
        else:
            bmsoccupancy = (filledseats * 100) / totalseats
            print j[0]
            offocc = (availableseats - filledseats) * 100 / totalseats
            #print offocc
            est_occupancy = (bmsoccupancy + offocc) / 2
            #print est_occupancy
            #occupancy=est_occupancy/100
            estimated_collection = (totalseats * price * est_occupancy) / 100
            print estimated_collection
            estimated_collection = str(estimated_collection)
            est_occupancy = str(est_occupancy)
            print("===========")
        query = "UPDATE collections.bms_theatre_show_collections SET occupancy='" + est_occupancy + "'" + ",collection='" + estimated_collection + "'" + " WHERE id=" + str(
            j[0])
        print query
        try:
            cursor.execute(query)
            connection.commit()

        except connection.Error as error:
            print(error)
    except:
        ""
connection.close()