Lines Matching defs:path
58 char *path; /* watched path */
73 return w->path;
81 add_watch(int fd, const char * path)
86 wd = inotify_add_watch(fd, path, IN_CREATE|IN_CLOSE_WRITE|IN_DELETE|IN_MOVE);
89 DPRINTF(E_ERROR, L_INOTIFY, "inotify_add_watch(%s) [%s]\n", path, strerror(errno));
101 nw->path = strdup(path);
118 remove_watch(int fd, const char * path)
124 if( strcmp(path, w->path) == 0 )
153 DPRINTF(E_DEBUG, L_INOTIFY, "Add watch to %s\n", media_path->path);
154 add_watch(fd, media_path->path);
219 if( w->path )
220 free(w->path);
229 int add_dir_watch(int fd, char * path, char * filename)
240 snprintf(buf, sizeof(buf), "%s/%s", path, filename);
244 dir = path;
280 inotify_insert_file(char * name, const char * path)
296 if( is_image(path) )
297 update_if_album_art(path);
298 else if( ends_with(path, ".srt") )
299 check_for_captions(path, 0);
304 if( strncmp(path, media_path->path, strlen(media_path->path)) == 0 )
314 if( !is_image(path) &&
315 !is_audio(path) &&
316 !is_video(path) &&
317 !is_playlist(path) )
321 if( !is_audio(path) &&
322 !is_playlist(path) )
326 if( !is_video(path) )
330 if( !is_image(path) )
339 if( stat(path, &st) != 0 )
342 ts = sql_get_int_field(db, "SELECT TIMESTAMP from DETAILS where PATH = '%q'", path);
343 if( !ts && is_playlist(path) && (sql_get_int_field(db, "SELECT ID from PLAYLISTS where PATH = '%q'", path) > 0) )
345 DPRINTF(E_DEBUG, L_INOTIFY, "Re-reading modified playlist.\n", path);
346 inotify_remove_file(path);
352 DPRINTF(E_DEBUG, L_INOTIFY, "%s is newer than the last db entry.\n", path);
353 inotify_remove_file(path);
357 len = strlen(path)+1;
366 strcpy(path_buf, path);
398 strcpy(path_buf, path);
407 insert_file(name, path, id+2, get_next_available_id("OBJECTS", id));
409 if( (is_audio(path) || is_playlist(path)) && next_pl_fill != 1 )
419 inotify_insert_directory(int fd, char *name, const char * path)
431 if( access(path, R_OK|X_OK) != 0 )
433 DPRINTF(E_WARN, L_INOTIFY, "Could not access %s [%s]\n", path, strerror(errno));
436 if( sql_get_int_field(db, "SELECT ID from DETAILS where PATH = '%q'", path) > 0 )
438 DPRINTF(E_DEBUG, L_INOTIFY, "%s already exists\n", path);
442 parent_buf = strdup(path);
447 insert_directory(name, path, BROWSEDIR_ID, id+2, get_next_available_id("OBJECTS", id));
451 wd = add_watch(fd, path);
458 DPRINTF(E_INFO, L_INOTIFY, "Added watch to %s [%d]\n", path, wd);
464 if( strncmp(path, media_path->path, strlen(media_path->path)) == 0 )
472 ds = opendir(path);
483 snprintf(path_buf, sizeof(path_buf), "%s/%s", path, e->d_name);
513 inotify_remove_file(const char * path)
523 if( ends_with(path, ".srt") )
525 rows = sql_exec(db, "DELETE from CAPTIONS where PATH = '%q'", path);
530 playlist = is_playlist(path);
531 id = sql_get_text_field(db, "SELECT ID from %s where PATH = '%q'", playlist?"PLAYLISTS":"DETAILS", path);
587 snprintf(art_cache, sizeof(art_cache), "%s/art_cache%s", db_path, path);
594 inotify_remove_directory(int fd, const char * path)
603 remove_watch(fd, path);
605 " UNION ALL SELECT ID from DETAILS where PATH = '%q'", path, path);
622 sql_exec(db, "DELETE from ALBUM_ART where PATH glob '%q/*'", path);