Kodi Community Forum
[WIP] XBMC + Spotify = True (an XBMC implementation that uses Spotify's official API) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Kodi related discussions (https://forum.kodi.tv/forumdisplay.php?fid=6)
+--- Thread: [WIP] XBMC + Spotify = True (an XBMC implementation that uses Spotify's official API) (/showthread.php?tid=67012)



- momoski - 2010-11-14

It appeared that the patch was not correctly applied. After applying the patch I got the error regarding the api.h. Corrected this error as described and now I get another error:
Code:
xbmc/xbmc.a(spotinterface.o): In function `SpotifyInterface::disconnect()':
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:785: undefined reference to `sp_session_logout'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:788: undefined reference to `sp_error_message'
xbmc/xbmc.a(spotinterface.o): In function `SpotifyInterface::processEvents()':
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:91: undefined reference to `sp_session_process_events'
xbmc/xbmc.a(spotinterface.o): In function `SpotifyInterface::connect(bool)':
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:768: undefined reference to `sp_session_connectionstate'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:773: undefined reference to `sp_session_login'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:775: undefined reference to `sp_error_message'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:768: undefined reference to `sp_session_connectionstate'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:750: undefined reference to `sp_session_init'
/home/xbmc/Downloads/spotyxbmc/trunk/xbmc/spotinterface.cpp:755: undefined reference to `sp_error_message'

And it keeps on going with the list above. I am now going to try it again with version 0.3 of libspotify. I hope that one works.


- momoski - 2010-11-14

UPDATE: Uninstalled 0.06 and installed 0.0.3 still the same error.
What am I doing wrong?

Anyone?


- akezeke - 2010-11-14

Hm, seems something went wrong with the latest update, sorry for that, I will look into it tomorow!


- momoski - 2010-11-14

Thanks, looking forward to it. Great work by the way!


- Puffytroll - 2010-11-14

Yes, thank you for the great work Akezeke!


- momoski - 2010-11-14

Hi Azekeke,

Just to make sure I will do everything correct tomorrow. I had the following folder structure. I think I am making some mistakes in putting everything in the correct place:

1. I have a temp directory inside my home folder.
2. In the temp folder I have downloaded the source code for xbmc creating a folder temp/trunk/xbmc
3. In the temp folder I also downloaded libspotify. From the folder home/temp/libspotify* I run:
Code:
make install prefix=/usr/local
.
4. Created a folder in temp called Azekekesfiles. In that folder I downloaded azekeke's files.
5. Copied spotyxbmc.diff from home/temp/azekekesfiles to the home/temp/trunk folder, the xbmc/spot* files to trunk/xbmc/ and the core/paplayer files to the corresponding folder in trunk.xbmc.
6. After installing libspotify I have a file in /usr/local/include/spotify/api.h where i replaced byte by s_byte.
7. For applying the patch I ran the command from the trunk folder. Instead of ./spotyxbmc.diff I used spotifyxbmc.diff (without ./). I get a nice list of the files that are patched.

What I am worried about is that I have installed the libspotify in the wrong place. Is the above the correct way? Again thanks a lot.


- momoski - 2010-11-15

@akezeke.

First of all, my apologies for not writing the name Akezeke correctly.

I just saw your update readme file and the update .diff file. It is funny, I am still compiling after I made two alterations:

1. api.h could not be found during compiling, so I copied it over from the folder where it was installed and put it in the folder where it is expected during compiling. I guess that wont be necessary anymore with your instructions about api.h.

2. The member RemoveAlbum was not declared in MusicDatabase.h. I just saw in your new diff file that this was added. I have added it myself in the meantime.

So like I said, I am still compiling and keep my fingers crossed. Update in a few minutes I hope.


- momoski - 2010-11-15

@akezeke,

Still no luck. I get the following error from the log file.

Quote:14:32:57 T:3078584192 M:1419116544 NOTICE: Spotifylog: clean
14:32:57 T:3078584192 M:1418948608 DEBUG: Spotifylog: creating session
14:32:57 T:3078584192 M:1418821632 ERROR: Spotifylog: failed to create session: error: invalid library version

There is also another odd thing. When shutting xbmc down on my ASRock, only XBMC get restarted instead of the machine shutting down, what used to be the case before the update. But I guess that is an issue I should bring to the XBMC team.


- Puffytroll - 2010-11-15

It looks like you are using the wrong library version ? Try another..


- Puffytroll - 2010-11-15

Hi. I am getting an error message when im patching:

Code:
patch -p0 -i ./spotyxbmc.diff
patching file xbmc/XBApplicationEx.cpp
patching file xbmc/cores/paplayer/Makefile.in
patching file xbmc/cores/paplayer/CodecFactory.cpp
patching file xbmc/cores/paplayer/PAPlayer.cpp
patching file xbmc/Application.cpp
patching file xbmc/AdvancedSettings.cpp
patching file xbmc/MusicDatabase.h
patching file xbmc/FileSystem/Directory.cpp
patching file xbmc/FileSystem/MusicDatabaseDirectory.cpp
patching file xbmc/MusicDatabase.cpp
patching file xbmc/Makefile.in
patching file xbmc/GUIViewStateMusic.cpp
patching file xbmc/GUIDialogContextMenu.h
patching file xbmc/GUIWindowMusicNav.cpp
patching file xbmc/AdvancedSettings.h
patching file xbmc/Settings.cpp
patching file xbmc/GUIMediaWindow.cpp
patching file xbmc/utils/GUIInfoManager.cpp
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 4354 with fuzz 1.

Any one know how to fix that ? Smile

Edit:

And when i build this happends:
Code:
In file included from spotinterface.cpp:22:
spotinterface.h:71: error: ISO C++ forbids declaration of âsp_sessionâ with no type
spotinterface.h:71: error: expected â;â before â*â token
spotinterface.h:74: error: expected â;â before âstaticâ
spotinterface.h:74: error: âsp_sessionâ has not been declared
spotinterface.h:74: error: âsp_errorâ has not been declared
spotinterface.h:75: error: âsp_sessionâ has not been declared
spotinterface.h:75: error: âsp_errorâ has not been declared
spotinterface.h:76: error: âsp_sessionâ has not been declared
spotinterface.h:77: error: âsp_sessionâ has not been declared
spotinterface.h:78: error: âsp_searchâ has not been declared
spotinterface.h:79: error: âsp_albumbrowseâ has not been declared
spotinterface.h:80: error: âsp_toplistbrowseâ has not been declared
spotinterface.h:81: error: âsp_toplistbrowseâ has not been declared
spotinterface.h:82: error: âsp_toplistbrowseâ has not been declared
spotinterface.h:83: error: âsp_artistbrowseâ has not been declared
spotinterface.h:84: error: âsp_sessionâ has not been declared
spotinterface.h:84: error: ISO C++ forbids declaration of âsp_audioformatâ with no type
spotinterface.h:84: error: expected â,â or â...â before â*â token
In file included from spotinterface.cpp:22:
spotinterface.h:85: error: âsp_imageâ has not been declared
spotinterface.h:91: error: ISO C++ forbids declaration of âsp_sessionâ with no type
spotinterface.h:91: error: expected â;â before â*â token
spotinterface.h:93: error: âsp_session_configâ does not name a type
spotinterface.h:94: error: âsp_errorâ does not name a type
spotinterface.h:95: error: âsp_session_callbacksâ does not name a type
spotinterface.h:149: error: âsp_errorâ has not been declared
spotinterface.h:152: error: ISO C++ forbids declaration of âsp_searchâ with no type
spotinterface.h:152: error: expected â;â before â*â token
spotinterface.h:160: error: ISO C++ forbids declaration of âsp_albumbrowseâ with no type
spotinterface.h:160: error: expected â;â before â*â token
spotinterface.h:165: error: ISO C++ forbids declaration of âsp_artistbrowseâ with no type
spotinterface.h:165: error: expected â;â before â*â token
spotinterface.h:172: error: ISO C++ forbids declaration of âsp_toplistbrowseâ with no type
spotinterface.h:172: error: expected â;â before â*â token
spotinterface.h:173: error: ISO C++ forbids declaration of âsp_toplistbrowseâ with no type
spotinterface.h:173: error: expected â;â before â*â token
spotinterface.h:174: error: ISO C++ forbids declaration of âsp_toplistbrowseâ with no type
spotinterface.h:174: error: expected â;â before â*â token
spotinterface.h:183: error: âsp_artistâ has not been declared
spotinterface.h:184: error: âsp_albumâ has not been declared
spotinterface.h:185: error: âsp_trackâ has not been declared
spotinterface.h:188: error: âsp_imageâ was not declared in this scope
spotinterface.h:188: error: template argument 1 is invalid
In file included from spotinterface.cpp:43:
cores/paplayer/spotifyCodec.h:43: error: âsp_sessionâ has not been declared
cores/paplayer/spotifyCodec.h:43: error: ISO C++ forbids declaration of âsp_audioformatâ with no type
cores/paplayer/spotifyCodec.h:43: error: expected â,â or â...â before â*â token
In file included from spotinterface.cpp:43:
cores/paplayer/spotifyCodec.h:44: error: âsp_sessionâ has not been declared
cores/paplayer/spotifyCodec.h:50: error: ISO C++ forbids declaration of âsp_sessionâ with no type
cores/paplayer/spotifyCodec.h:50: error: expected â;â before â*â token
cores/paplayer/spotifyCodec.h:51: error: expected â;â before âboolâ
cores/paplayer/spotifyCodec.h:55: error: ISO C++ forbids declaration of âsp_trackâ with no type
cores/paplayer/spotifyCodec.h:55: error: expected â;â before â*â token
spotinterface.cpp: In member function âbool SpotifyInterface::processEvents()â:
spotinterface.cpp:89: error: âm_sessionâ was not declared in this scope
spotinterface.cpp:89: error: âsp_session_process_eventsâ was not declared in this scope
spotinterface.cpp: At global scope:
spotinterface.cpp:95: error: variable or field âcb_connectionErrorâ declared void
spotinterface.cpp:95: error: âsp_sessionâ was not declared in this scope
spotinterface.cpp:95: error: âsessionâ was not declared in this scope
spotinterface.cpp:95: error: âsp_errorâ was not declared in this scope
spotinterface.cpp:104: error: variable or field âcb_loggedInâ declared void
spotinterface.cpp:104: error: âsp_sessionâ was not declared in this scope
spotinterface.cpp:104: error: âsessionâ was not declared in this scope
spotinterface.cpp:104: error: âsp_errorâ was not declared in this scope
make[1]: *** [spotinterface.o] Error 1
make[1]: Leaving directory `/home/even/trunk/xbmc'
make: *** [xbmc/xbmc.a] Error 2



- akezeke - 2010-11-15

@momoski

Seems like a problem with the version as Puffytroll suggests, did you get the same result with the other versions. Allso I have noticed that libspotify sometimes gives you the wrong error code, make sure that you use correct username password and that you actualy has a premium account.

@Puffytroll
Ignore first error message, the patch applies fine anyway.

The second error is given because the compiler cant find the libspotify files, make sure you have installed libspotify in a place where the system knows about them, try for example with make install prefix=/usr/local or find out where the libs in your system are stored and install libspotify there.


- mylssi - 2010-11-15

The 0.0.3 libspotify seems to be segfaulting if there are local files in a playlist. I got it to compile with 0.0.6 API changes but ended up with a xbmc binary that crashes at the startup. I need to take a better look at the code when I have the time.


- momoski - 2010-11-15

Compiling went fine, but I can't start up xbmc.

After the first splash screen it stays black and flickers a bit. I can't find a log that is created at that time, so I have a hard time to find out what went wrong. I am thinking about reinstalling the whole live cd again. Unfortunately I lose the wifi and the remote support I had to configure afterwards.

Does anyone know where to find info about startup failures in log files. In the meantime I will start recompiling XBMC without libspotify to see if I can get XBMC to work again. Then at least I have a fallback.

@mylssi: What do you mean by segfaulting?


- mylssi - 2010-11-15

momoski Wrote:@mylssi: What do you mean by segfaulting?

Basically crashing. Accessing an invalid memory address to be exact.


- momoski - 2010-11-16

Finally YES!!

I got it working too. Thank you very much Akezeke, Puffytroll and mylssi. I guess I just had a mess on my machine. What I did was getting rid of all libspotify references. Then got the source code again for xbmc. Compiled it and installed it, knowing I could always go back to make install in that folder. XBMC compiled and got installed and working correctly. I then copied the trunk folder to a new folder, installed libspotify and applied all the patches as explained by akezeke on github. Make and then install.

Anyways, it is working now with libspotify 0.0.3. But I can't get Playlists to work. As soon as I hit that XBMC crashes and gets reinitialised. Top lists etc are working fine. I guess this has to do with what mylssi has written in the post above.

@mylssi: you said you would try it with 0.0.6. Could you and Akezeke please keep us updated with the progress on that. If I can test or do anything else, please let me know.

Is it sure that libspotify 0.0.3 is the cause of the crash with playlists or is it something in the Akezeke's files.

For now I am glad it's working and thanks again, compiling on asrock300 is no fun thing to do Rolleyes