Use worms select_one_value.

master
voussoir 2022-06-03 19:54:35 -07:00
parent 738e7ab235
commit b3390940a5
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 4 additions and 4 deletions

View File

@ -149,10 +149,10 @@ class Channel(ObjectBase):
''' '''
query = 'SELECT id FROM videos WHERE author_id == ? ORDER BY published DESC LIMIT 1' query = 'SELECT id FROM videos WHERE author_id == ? ORDER BY published DESC LIMIT 1'
bindings = [self.id] bindings = [self.id]
row = self.ycdldb.select_one(query, bindings) video_id = self.ycdldb.select_one_value(query, bindings)
if row is None: if video_id is None:
raise exceptions.NoVideos(self) raise exceptions.NoVideos(self)
return row[0] return video_id
def has_pending(self) -> bool: def has_pending(self) -> bool:
''' '''
@ -162,7 +162,7 @@ class Channel(ObjectBase):
''' '''
query = 'SELECT 1 FROM videos WHERE author_id == ? AND state == "pending" LIMIT 1' query = 'SELECT 1 FROM videos WHERE author_id == ? AND state == "pending" LIMIT 1'
bindings = [self.id] bindings = [self.id]
return self.ycdldb.select_one(query, bindings) is not None return self.ycdldb.select_one_value(query, bindings) is not None
def jsonify(self): def jsonify(self):
j = { j = {