Subversion Repositories mdb

Rev

Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 29
Line 39... Line 39...
39
	strcpy(fname, configs.home);
39
	strcpy(fname, configs.home);
40
	strcat(fname, NOWPLAY);
40
	strcat(fname, NOWPLAY);
41
	strcpy(tmpname, configs.home);
41
	strcpy(tmpname, configs.home);
42
	strcat(tmpname, "/newqueue");
42
	strcat(tmpname, "/newqueue");
43
 
43
 
44
	/* If the id is less than 0, we delete the whole queue. If soe ausio is
44
	/* If the id is less than 0, we delete the whole queue. If the audio is
45
	 * playing, it is stopped before. */
45
	 * playing, it is stopped before. */
46
	if (id < 0)
46
	if (id < 0)
47
	{
47
	{
48
		if (playerActive)
48
		if (playerActive)
49
			nextCommand = PLAY_STOP_NOW;
49
			nextCommand = PLAY_STOP_NOW;
50
 
50
 
51
		unlink(fname);
51
		unlink(fname);
-
 
52
		freeQueue();
52
		return TRUE;
53
		return TRUE;
53
	}
54
	}
54
 
55
 
55
	if ((fd = open(fname, O_RDWR)) <= 0)
56
	if ((fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP)) <= 0)
56
	{
57
	{
57
		syslog(LOG_WARNING, "Error opening file %s: %s", fname, strerror(errno));
58
		syslog(LOG_WARNING, "Error opening file %s: %s", fname, strerror(errno));
58
		sprintf(hv0, "ERROR:DELETE:Error opening queue");
59
		sprintf(hv0, "ERROR:DELETE:Error opening queue");
59
		write(s1, hv0, strlen(hv0));
60
		write(s1, hv0, strlen(hv0));
60
		return FALSE;
61
		return FALSE;
Line 122... Line 123...
122
	}
123
	}
123
	
124
	
124
	close (fd);
125
	close (fd);
125
	unlink(fname);
126
	unlink(fname);
126
	rename(tmpname, fname);
127
	rename(tmpname, fname);
-
 
128
	readQueue();
127
	return TRUE;
129
	return TRUE;
128
}
130
}
129
 
131
 
130
/*
132
/*
131
 * This function deletes a whole playlist from a user. The id is the id of the
133
 * This function deletes a whole playlist from a user. The id is the id of the
Line 163... Line 165...
163
		sqlite3_free(zErrMsg);
165
		sqlite3_free(zErrMsg);
164
		sqlite3_close(db);
166
		sqlite3_close(db);
165
		return FALSE;
167
		return FALSE;
166
	}
168
	}
167
 
169
 
-
 
170
	sqlite3_close(db);
-
 
171
	scanUser(s1, userchain->uname);
168
	return TRUE;
172
	return TRUE;
169
}
173
}
170
 
174
 
171
int deletePlaylistEntry(int s1, int id)
175
int deletePlaylistEntry(int s1, int id)
172
{
176
{
Line 200... Line 204...
200
		sqlite3_free(zErrMsg);
204
		sqlite3_free(zErrMsg);
201
		sqlite3_close(db);
205
		sqlite3_close(db);
202
		return FALSE;
206
		return FALSE;
203
	}
207
	}
204
 
208
 
-
 
209
	sqlite3_close(db);
205
	return TRUE;
210
	return TRUE;
206
}
211
}