getplaylist fails with iTunes v9 |
getplaylist fails with iTunes v9 |
jdh |
Feb 20 2010, 01:50 AM
Post
#1
|
Newbie Group: Members Posts: 7 Joined: 20-February 10 Member No.: 842 |
Hi,
I'm using AMIP SDK v1.4, but am unable to get a playlist when using iTunes v9. Even the supplied getplaylist example fails in: int code = ac_get_pl(); LeaveCriticalSection(&cs_list); if (code != AC_ERR_NOERROR) { printf("Failed to get playlist: %d\n", code); It reports: Failed to get playlist: 3 When using WinAmp or foobar2000 then getplaylist works just fine! Just wondering if I'm doing something wrong or if it simply does not work with iTunes v9. Thanks, Jdh |
Serge |
Mar 22 2010, 08:21 AM
Post
#2
|
AMIP Developer Group: Root Admin Posts: 935 Joined: 12-March 06 Member No.: 1 |
Does it work on small playlists?
|
jdh |
Mar 23 2010, 12:14 AM
Post
#3
|
Newbie Group: Members Posts: 7 Joined: 20-February 10 Member No.: 842 |
Does it work on small playlists? Yes, smaller playlists do work! So I did some testing:
Also, I would have expected that if this is a timeout issue that with the increase of the timeout the getplaylist program would wait longer before returning the error 3. However I see no noticable wait delay when using a 1800000 second timeout and using 3700+ songs or when using only 115 songs and a 5000 timeout. Thanks for taking the time and responding Serge! |
Serge |
Mar 23 2010, 08:49 AM
Post
#4
|
AMIP Developer Group: Root Admin Posts: 935 Joined: 12-March 06 Member No.: 1 |
Yes, smaller playlists do work! So I did some testing:
Also, I would have expected that if this is a timeout issue that with the increase of the timeout the getplaylist program would wait longer before returning the error 3. However I see no noticable wait delay when using a 1800000 second timeout and using 3700+ songs or when using only 115 songs and a 5000 timeout. Thanks for taking the time and responding Serge! I guess you are setting timeouts in the wrong place, you should set the bigger timeout in the following function: CODE // Adds listener to AMIP, AMIP will notify host:port about the events specified by flags // until listener is removed or fail_count limit is reached. If notification fails // fail_count times, AMIP automatically removes listener for the specified host:port. // AMIP keeps listeners even between restarts (in plugin.ini file) int WINAPI ac_add_event_listener(const char *host, int port, int timeout, UINT flags, UINT fail_count=1); |
jdh |
Mar 23 2010, 03:44 PM
Post
#5
|
Newbie Group: Members Posts: 7 Joined: 20-February 10 Member No.: 842 |
I guess you are setting timeouts in the wrong place, you should set the bigger timeout in the following function: ..... Tried the following: getplaylist.cpp: CODE // Init client if (!ac_init_client(AMIP_HOST, AMIP_PORT, 5000, 5, 1)) { printf("Client cannot be initialized\n"); exit(1); } // Add event listener to be notified on playlist change and ready events if (AC_ERR_NOERROR != ac_add_event_listener(SERVER_HOST, SERVER_PORT, 1800000, AC_EVT_PLCHANGE | AC_EVT_PLREADY)) { printf("Failed to add listener, check that AMIP is running and Remote/API Server is enabled on specified port\n"); ac_uninit(); exit(1); } Using foobar2000 and 115 songs in the playlist, below is the output when running getplaylist: CODE $ make clean rm -f *.o *.exe ./Release/*.* rmdir Release $ make prepare mkdir -p Release cp ../Release/ac.lib ac.lib cp ../Release/ac.dll ./Release/ac.dll tools/reimp.exe ac.lib rm -f ac.lib ac.def mv libac.a ./Release/libac.a $ make getplaylist g++ -I"../" -mno-cygwin -fpermissive -fexpensive-optimizations -O3 -Os -fno-exce ptions -Wno-error -w -c -o getplaylist.o getplaylist.cpp g++.exe -I"../" -mno-cygwin -fpermissive -fexpensive-optimizations -O3 -Os -fno- exceptions -Wno-error -w -L./Release -s -Wl -mno-cygwin getplaylist.o -lac -o ./ Release/getplaylist.exe $ cd release $ date;time getplaylist;date Tue Mar 23 11:36:11 EDT 2010 Playlist cache is already in sync! Failed to get playlist: 3 real 0m0.516s user 0m0.015s sys 0m0.015s Tue Mar 23 11:36:11 EDT 2010 $ As you can see getplaylist did not wait for the timeout value. I have no idea what else to try. Thanks, Jdh |