Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made db commit after each video and removed unecessary code

without the commit, interrupting the script would not mark videos
as downloaded even if they were fully downloaded before the script 
was stopped.
  • Loading branch information...
commit 2a2974692a6872cabed75d35cfbc07dfd97a7eeb 1 parent ed0e6b0
@RobinRamael authored
Showing with 1 addition and 8 deletions.
  1. +1 −8 youtube.py
View
9 youtube.py
@@ -92,6 +92,7 @@ def download_no_check(self, connection):
date_as_str = str(self.publishdate)
else: date_as_str = ""
c.execute("INSERT INTO videos values (?, ?);", (self.id, date_as_str))
+ connection.commit()
else: print 'download of', self.id, 'failed'
@@ -103,13 +104,6 @@ def download_all_in_feed():
c = db.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS videos(id text, pubdate text)''')
- c.execute('''SELECT count(*) FROM videos''')
- if c.fetchone()[0] > 0:
- c.execute("SELECT max(pubdate) FROM videos where pubdate not like ''")
- last_download_date = c.fetchone()[0]
- #print last_download_date
- else: last_download_date = None
-
videos_in_feed = [YTVideo(item) for item in feed['items']]
os.chdir(VIDEODIR)
@@ -117,7 +111,6 @@ def download_all_in_feed():
for video in videos_in_feed:
video.download(db)
-
db.commit()
db.close()
Please sign in to comment.
Something went wrong with that request. Please try again.