fix static playlists

This commit is contained in:
Ron Pedde 2004-03-14 00:11:07 +00:00
parent b473f745a3
commit 922b9e2ae0

View File

@ -261,19 +261,19 @@ int scan_init(char *path) {
scan_mode_foreground=0; scan_mode_foreground=0;
if(db_is_empty()) { if(db_is_empty()) {
scan_mode_foreground=1; scan_mode_foreground=1;
if(db_start_initial_update())
return -1;
} }
if(db_start_initial_update())
return -1;
DPRINTF(ERR_DEBUG,"%s scanning for MP3s in %s\n", DPRINTF(ERR_DEBUG,"%s scanning for MP3s in %s\n",
scan_mode_foreground ? "Foreground" : "Background", scan_mode_foreground ? "Foreground" : "Background",
path); path);
err=scan_path(path); err=scan_path(path);
if(scan_mode_foreground) if(db_end_initial_update())
if(db_end_initial_update()) return -1;
return -1;
scan_mode_foreground=0; scan_mode_foreground=0;
@ -374,6 +374,7 @@ void scan_static_playlist(char *path, struct dirent *pde, struct stat *psb) {
fd=open(playlist_path,O_RDONLY); fd=open(playlist_path,O_RDONLY);
if(fd != -1) { if(fd != -1) {
db_add_playlist(playlistid,m3u_path,0); db_add_playlist(playlistid,m3u_path,0);
DPRINTF(ERR_DEBUG,"Added playlist as id %d\n",playlistid);
while(readline(fd,linebuffer,sizeof(linebuffer)) > 0) { while(readline(fd,linebuffer,sizeof(linebuffer)) > 0) {
while((linebuffer[strlen(linebuffer)-1] == '\n') || while((linebuffer[strlen(linebuffer)-1] == '\n') ||
@ -397,7 +398,7 @@ void scan_static_playlist(char *path, struct dirent *pde, struct stat *psb) {
/* might be valid, might not... */ /* might be valid, might not... */
if(!stat(m3u_path,&sb)) { if(!stat(m3u_path,&sb)) {
/* FIXME: check to see if valid inode! */ /* FIXME: check to see if valid inode! */
db_add_playlist_song(playlistid,psb->st_ino); db_add_playlist_song(playlistid,sb.st_ino);
} else { } else {
DPRINTF(ERR_WARN,"Playlist entry %s bad: %s\n", DPRINTF(ERR_WARN,"Playlist entry %s bad: %s\n",
m3u_path,strerror(errno)); m3u_path,strerror(errno));