I'm using /proc/empeg_notify to insert tunes into the playlist programatically from Empire.
What I've found is that when inserting many songs at the same time , the player may crash (I guess it does, it just exits to the shell). Here is the end of the serial output when attempting to enqueue 66 songs:
<61 fids before this point>
#0000052F0-
#00000CBF0-
#00000CC00-
#00000CC10-
#00000CC20-
Restored terminal settings
Remounting first music partition read-only
Remounting second music partition read-only
Player exited normally: 1
Switching to shell-player loop
Starting bash.
empeg:/empeg/bin#Here is the relevant code I'm using to write to /proc/empeg_notify:
Code:
// uint8_t_body is the OBEX object, which is a string of 8 digit fids
// with no delimiter, I just copy the next 8 characters
// notify_fd is a file handle for /proc/empeg_notify
for(i = 0; i <= body_len - 8; i += 8) {
strcpy(fid, "#XXXXXXXX0-");
memcpy(fid + 1, (uint8_t_body + i), 8);
fid_command(fid, notify_fd);
}
void fid_command(const uint8_t *fid, int notify_fd) {
char *serial_cmd;
serial_cmd = malloc(strlen(fid) + 9);
snprintf(serial_cmd, strlen(fid) + 9, "SERIAL=%s\n", fid);
empeg_command(serial_cmd, notify_fd);
free(serial_cmd);
}
void empeg_command(char *serial_cmd, int notify_fd) {
write(notify_fd, serial_cmd, strlen(serial_cmd));
}
The enqueue action fails around 66 songs. I can enqueue 65 at once ok, but more than that it exits to the shell as above. I do not think this is a constant number though, because I seem to remember being able to enqueue more earlier. Any insight as to why this would happen would be greatly appreciated. Full source to my test version of empire is attached.