Skip duplicate downloads
This commit is contained in:
		@@ -67,16 +67,14 @@ ydl_opts = {
 | 
				
			|||||||
  'outtmpl': '{}/%(uploader)s-%(title)s-%(id)s.%(ext)s'.format(playlistDir)
 | 
					  'outtmpl': '{}/%(uploader)s-%(title)s-%(id)s.%(ext)s'.format(playlistDir)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
for v in filteredVideos:
 | 
					for v in filteredVideos:
 | 
				
			||||||
  print(getYear(v), getId(v))
 | 
					 | 
				
			||||||
  videoURL = 'https://www.youtube.com/watch?v='+getId(v)
 | 
					 | 
				
			||||||
  with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 | 
					 | 
				
			||||||
    ydl.download([videoURL])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Save metadata to file
 | 
					  # Save metadata to file
 | 
				
			||||||
    description = open('{}/{}-{}-{}.txt'.format(playlistDir,
 | 
					  descriptionFile = '{}/{}-{}-{}.txt'.format(playlistDir,
 | 
				
			||||||
                                              getChannel(v),
 | 
					                                              getChannel(v),
 | 
				
			||||||
                                              getTitle(v),
 | 
					                                              getTitle(v),
 | 
				
			||||||
                                                getId(v)), 'w')
 | 
					                                              getId(v))
 | 
				
			||||||
 | 
					  if not os.path.exists(descriptionFile):
 | 
				
			||||||
 | 
					    description = open(descriptionFile, 'w')
 | 
				
			||||||
    description.write('Title: ' + getTitle(v) + '\n')
 | 
					    description.write('Title: ' + getTitle(v) + '\n')
 | 
				
			||||||
    description.write('Uploaded: ' + getUploadTime(v) + '\n')
 | 
					    description.write('Uploaded: ' + getUploadTime(v) + '\n')
 | 
				
			||||||
    description.write('Channel: ' + getChannel(v) + '\n')
 | 
					    description.write('Channel: ' + getChannel(v) + '\n')
 | 
				
			||||||
@@ -85,3 +83,8 @@ for v in filteredVideos:
 | 
				
			|||||||
    description.write('Tags: ' + getTags(v) + '\n')
 | 
					    description.write('Tags: ' + getTags(v) + '\n')
 | 
				
			||||||
    description.write('Video ID: ' + getId(v) + '\n')
 | 
					    description.write('Video ID: ' + getId(v) + '\n')
 | 
				
			||||||
    description.close()
 | 
					    description.close()
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    videoURL = 'https://www.youtube.com/watch?v='+getId(v)
 | 
				
			||||||
 | 
					    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 | 
				
			||||||
 | 
					      ydl.download([videoURL])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user