Merge pull request #133 from Gunzinger/urlitem-keyword
For URLItems: clone title into keywords, allows searching
This commit is contained in:
		@@ -42,11 +42,12 @@ class URLItem(BaseItem):
 | 
				
			|||||||
        if from_dict is None:
 | 
					        if from_dict is None:
 | 
				
			||||||
            super().__init__()
 | 
					            super().__init__()
 | 
				
			||||||
            self.url = url if url[-1] != "/" else url[:-1]
 | 
					            self.url = url if url[-1] != "/" else url[:-1]
 | 
				
			||||||
            self.title = ''
 | 
					            self.title = ""
 | 
				
			||||||
            self.duration = 0
 | 
					            self.duration = 0
 | 
				
			||||||
            self.id = hashlib.md5(url.encode()).hexdigest()
 | 
					            self.id = hashlib.md5(url.encode()).hexdigest()
 | 
				
			||||||
            self.path = var.tmp_folder + self.id + ".mp3"
 | 
					            self.path = var.tmp_folder + self.id + ".mp3"
 | 
				
			||||||
            self.thumbnail = ''
 | 
					            self.thumbnail = ""
 | 
				
			||||||
 | 
					            self.keywords = ""
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            super().__init__(from_dict)
 | 
					            super().__init__(from_dict)
 | 
				
			||||||
            self.url = from_dict['url']
 | 
					            self.url = from_dict['url']
 | 
				
			||||||
@@ -126,6 +127,7 @@ class URLItem(BaseItem):
 | 
				
			|||||||
                    info = ydl.extract_info(self.url, download=False)
 | 
					                    info = ydl.extract_info(self.url, download=False)
 | 
				
			||||||
                    self.duration = info['duration'] / 60
 | 
					                    self.duration = info['duration'] / 60
 | 
				
			||||||
                    self.title = info['title']
 | 
					                    self.title = info['title']
 | 
				
			||||||
 | 
					                    self.keywords = info['title']
 | 
				
			||||||
                    succeed = True
 | 
					                    succeed = True
 | 
				
			||||||
                    return True
 | 
					                    return True
 | 
				
			||||||
                except youtube_dl.utils.DownloadError:
 | 
					                except youtube_dl.utils.DownloadError:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user