Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunvenkatraman committed Sep 27, 2011
1 parent 1a5e7b1 commit 968702b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libs/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def getPostsInChannel(self, channelNum):
posts = self.c.fetchall()
posts = [i[0] for i in posts]
return posts
def getPostUser(self, channelNum,post):
self.c.execute("SELECT user FROM lb_postings WHERE station = %s and id=%s;",(str(channelNum),str(post),))
posts = self.c.fetchall()
posts = [i[0] for i in posts]
return posts[0]
def getPostDetails(self, channelNum,post):
self.c.execute("SELECT * FROM lb_postings WHERE station = %s and id=%s;",(str(channelNum),str(post),))
posts = self.c.fetchall()
Expand Down Expand Up @@ -79,6 +84,9 @@ def publishPost(self, postID):
(str(postID),))
self.db.commit()

def updateAuthor(self, auth,postID):
self.c.execute("UPDATE lb_postings SET author_id = %s WHERE id = %s;",(str(auth),str(postID),))
self.db.commit()
def updatePostLength(self, length,postID):
self.c.execute("UPDATE lb_postings SET audio_length = %s WHERE id = %s;",(str(length),str(postID),))
self.db.commit()
Expand Down Expand Up @@ -145,8 +153,9 @@ def getAllCommentIDs(self):

def addCommentToChannel(self, phoneNum,auth, channel):
#self.c.execute("INSERT INTO lb_postings (user, station) VALUES (%s, %s);",(phoneNum, str(channel),))
#Arjun changed to autopublish
self.c.execute("INSERT INTO lb_postings (user, station, status,author_id,sticky) VALUES (%s, %s, 3, %s, 0);",(phoneNum, str(channel), str(auth),))
#Arjun changed to turn off autopublish
#self.c.execute("INSERT INTO lb_postings (user, station, status,author_id,sticky) VALUES (%s, %s, 3, %s, 0);",(phoneNum, str(channel), str(auth),))
self.c.execute("INSERT INTO lb_postings (user, station, status,author_id,sticky) VALUES (%s, %s, 1, %s, 0);",(phoneNum, str(channel), str(auth),))
self.db.commit()
ids = str(self.c.lastrowid)
extension = '.mp3'
Expand Down

0 comments on commit 968702b

Please sign in to comment.