mirror of
				https://github.com/owntone/owntone-server.git
				synced 2025-10-30 00:05:05 -04:00 
			
		
		
		
	Handle IN_DELETE, IN_MOVED_FROM and IN_MOVED_TO for files
This commit is contained in:
		
							parent
							
								
									d63da9f08f
								
							
						
					
					
						commit
						467b177c17
					
				| @ -694,6 +694,29 @@ process_inotify_file(struct watch_info *wi, char *path, struct inotify_event *ie | |||||||
| 
 | 
 | ||||||
|   DPRINTF(E_DBG, L_SCAN, "File event: 0x%x, cookie 0x%x, wd %d\n", ie->mask, ie->cookie, wi->wd); |   DPRINTF(E_DBG, L_SCAN, "File event: 0x%x, cookie 0x%x, wd %d\n", ie->mask, ie->cookie, wi->wd); | ||||||
| 
 | 
 | ||||||
|  |   if (ie->mask & IN_DELETE) | ||||||
|  |     { | ||||||
|  |       db_file_delete_bypath(path); | ||||||
|  |       db_pl_delete_bypath(path); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |   if (ie->mask & IN_MOVED_FROM) | ||||||
|  |     { | ||||||
|  |       db_file_disable_bypath(path, wi->path, ie->cookie); | ||||||
|  |       db_pl_disable_bypath(path, wi->path, ie->cookie); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |   if (ie->mask & IN_MOVED_TO) | ||||||
|  |     { | ||||||
|  |       ret = db_file_enable_bycookie(ie->cookie, wi->path); | ||||||
|  | 
 | ||||||
|  |       if (ret <= 0) | ||||||
|  | 	ret = db_pl_enable_bycookie(ie->cookie, wi->path); | ||||||
|  | 
 | ||||||
|  |       if (ret <= 0) | ||||||
|  | 	ie->mask |= IN_CREATE; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|   if (ie->mask & (IN_MODIFY | IN_CREATE)) |   if (ie->mask & (IN_MODIFY | IN_CREATE)) | ||||||
|     { |     { | ||||||
|       ret = lstat(path, &sb); |       ret = lstat(path, &sb); | ||||||
| @ -733,9 +756,6 @@ process_inotify_file(struct watch_info *wi, char *path, struct inotify_event *ie | |||||||
|       if (deref) |       if (deref) | ||||||
| 	free(deref); | 	free(deref); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|   /* TODO: other cases need more support from the DB */ |  | ||||||
|   /* IN_DELETE, IN_MOVE_FROM / IN_MOVE_TO */ |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Thread: scan */ | /* Thread: scan */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user