Use insert_filler for add_channel.
This commit is contained in:
		
							parent
							
								
									718399806a
								
							
						
					
					
						commit
						11a147fbcd
					
				
					 1 changed files with 9 additions and 5 deletions
				
			
		|  | @ -124,14 +124,18 @@ class YCDLDB: | ||||||
|         if name is None: |         if name is None: | ||||||
|             name = self.youtube.get_user_name(channel_id) |             name = self.youtube.get_user_name(channel_id) | ||||||
| 
 | 
 | ||||||
|         data = [None] * len(SQL_CHANNEL) |  | ||||||
|         data[SQL_CHANNEL['id']] = channel_id |  | ||||||
|         data[SQL_CHANNEL['name']] = name |  | ||||||
|         if download_directory is not None: |         if download_directory is not None: | ||||||
|             assert_is_abspath(download_directory) |             assert_is_abspath(download_directory) | ||||||
|         data[SQL_CHANNEL['directory']] = download_directory |  | ||||||
| 
 | 
 | ||||||
|         self.cur.execute('INSERT INTO channels VALUES(?, ?, ?, ?)', data) |         data = { | ||||||
|  |             'id': channel_id, | ||||||
|  |             'name': name, | ||||||
|  |             'directory': download_directory, | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         (qmarks, bindings) = sqlhelpers.insert_filler(SQL_CHANNEL, data) | ||||||
|  |         query = f'INSERT INTO channels VALUES({qmarks})' | ||||||
|  |         self.cur.execute(query) | ||||||
| 
 | 
 | ||||||
|         if get_videos: |         if get_videos: | ||||||
|             self.refresh_channel(channel_id, commit=False) |             self.refresh_channel(channel_id, commit=False) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue