owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.1k stars 237 forks source link

IOS remote: play next next fails after server restart #837

Open whatdoineed2do opened 5 years ago

whatdoineed2do commented 5 years ago

When the server is restarted (and in STOPPED state),play next on albums or playlists does not add to Q to play. add next does adds items to the Q

Current master and log via -Ddacp,daac,db

[DEBUG]     dacp: DACP request: '/ctrl-int/1/playqueue-edit?command=add&query='daap.songalbumid:1722214560191693504'&mode=3&session-id=2030899506'
[DEBUG]     daap: Trying DAAP query -'daap.songalbumid:1722214560191693504'-
[DEBUG]     daap: DAAP SQL query: -(f.songalbumid = 1722214560191693504)-
[DEBUG]       db: Running query 'SELECT COUNT(*) FROM files f WHERE f.disabled = 0 AND (f.songalbumid = 1722214560191693504);'
[DEBUG]       db: Starting query 'SELECT f.* FROM files f WHERE f.disabled = 0 AND (f.songalbumid = 1722214560191693504)   LIMIT 1;'
[DEBUG]     dacp: Found index song (id 36)
[DEBUG]     daap: Trying DAAP query -'daap.songalbumid:1722214560191693504'-
[DEBUG]     daap: DAAP SQL query: -(f.songalbumid = 1722214560191693504)-
[DEBUG]       db: Running query 'SELECT pos FROM queue WHERE id = 0;'
[ INFO]       db: No matching row found for query: SELECT pos FROM queue WHERE id = 0;
[  LOG]     dacp: Could not build song queue
whatdoineed2do commented 5 years ago

It seems like this fix works in Dacp_queueitem_add

  player_get_status(&status);
db_queue_get_count(&count);  // this
  if (mode == 3 && count > 0)
    ret = db_queue_add_by_queryafteritemid(&qp, status.item_id);
  else
    ret = db_queue_add_by_query(&qp, status.shuffle, status.item_id, -1, NULL, NULL);
whatdoineed2do commented 5 years ago

Fixed in https://github.com/ejurgensen/forked-daapd/pull/840