Giter Site home page Giter Site logo

spotify-api-server's People

Contributors

feelepxyz avatar liesen avatar theodoor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spotify-api-server's Issues

Build fails on OS X

Hey,

I'm getting the following output after trying to make on OS X 10.6.x. I've installed the required packages using Homebrew. I have a feeling it's because the libspotify API has probably been updated and spotify-api-server hasn't. I've tried debugging, but got nowhere.

I tried installing on Ubuntu and failed as well, so I noticed you usually build on Mac so I gave it a shot.

Even if you don't have time for a solution, I'd appreciate a pointer like 'this is lots to fix' or 'the api was updated' or something of the like, because I'm about out of time!


cc -std=c99 -Wall -I/usr/include/subversion-1  -I/usr/include/apr-1     -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK diff.c json.c server.c main.c   -o server -lspotify -levent -levent_pthreads -ljansson -lsvn_diff-1 -lsvn_subr-1  -L/usr/lib -lapr-1 -lpthread
server.c:185: warning: initialization from incompatible pointer type
main.c: In function ‘main’:
main.c:113: warning: initialization from incompatible pointer type
main.c:115: warning: initialization from incompatible pointer type
main.c:125: warning: initialization from incompatible pointer type
main.c:127: warning: initialization from incompatible pointer type
main.c:129: warning: initialization from incompatible pointer type
ld: library not found for -lspotify
collect2: ld returned 1 exit status
make: *** [server] Error 1

Make errors - incompatible pointer type

Hi,

Finally got around to looking at this again. I have all the dependencies installed but now when I try make I get the following errors.

gcc -std=c99 -Wall `apr-1-config --includes --ldflags --link-ld --cflags --cppflags` -I/usr/include/subversion-1 -lspotify -lsvn_diff-1 -lsvn_subr-1 -ljansson -levent -levent_pthreads appkey.c account.c diff.c json.c server.c -o server
diff.c: In function ‘output_diff_modified’:
diff.c:191:56: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
/usr/local/include/libspotify/api.h:2654:24: note: expected ‘struct sp_track * const*’ but argument is of type ‘const struct sp_track **’
server.c:212:1: warning: initialization from incompatible pointer type
server.c: In function ‘put_playlist_add_tracks’:
server.c:490:3: warning: passing argument 2 of ‘json_to_tracks’ from incompatible pointer type
json.h:12:5: note: expected ‘struct sp_track **’ but argument is of type ‘const struct sp_track **’
server.c:505:54: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
/usr/local/include/libspotify/api.h:2654:24: note: expected ‘struct sp_track * const*’ but argument is of type ‘const struct sp_track **’
server.c: In function ‘put_playlist_patch’:
server.c:661:57: warning: passing argument 3 of ‘diff_playlist_tracks_apply’ from incompatible pointer type
diff.h:10:14: note: expected ‘struct sp_track **’ but argument is of type ‘const struct sp_track **’
server.c:665:3: warning: passing argument 4 of ‘diff_output_stdout’ from incompatible pointer type
diff.h:16:14: note: expected ‘struct sp_track **’ but argument is of type ‘const struct sp_track **’
server.c: In function ‘main’:
server.c:972:5: warning: initialization discards qualifiers from pointer target type
server.c:974:3: warning: initialization discards qualifiers from pointer target type

any ideas?

Cheers

Implementing sp_playlistcontainer_remove_playlist

Hello,

I'm trying to implement sp_playlistcontainer_remove_playlist in a fork because I need to delete playlists too.

This function takes the index of the playlist to be deleted but I cannot figure out how to get it. I guess I have to get it from the playlist container or from the playlist parameter.

The code I have at the moment is :

static void delete_playlist(sp_playlist *playlist,
                         struct evhttp_request *request,
                         void *userdata) {

  sp_session *session = userdata;
  sp_playlistcontainer *pc = sp_session_playlistcontainer(session);
  playlist = sp_playlistcontainer_remove_playlist(pc, index);

  register_playlist_callbacks(playlist, request, &get_playlist,
                                &playlist_state_changed_callbacks, NULL);
}

I hope I'll get to something, I don't know libspotify very well and I haven't done C for years ;-)

Thanks for any advice,

Aurels

building on os x

Hey! How do I go about building this on os x? Is it supported?
Got this and more.. : ld: warning: ignoring file /usr/local/lib/libspotify.so, file was built for unsupported file format which is not the architecture being linked (x86_64)
Used the x86_64 linux lib

Installation woes - "api.h: No such file or directory"

I tried to install as per your instructions but received the following error.

gcc -std=c99 -Wall apr-1-config --includes --ldflags --link-ld --cflags --cppflags -I/usr/include/subversion-1 -lspotify -lsvn_diff-1 -lsvn_subr-1 -ljansson -levent -levent_pthreads appkey.c account.c diff.c json.c server.c -o server diff.c:1:28: fatal error: libspotify/api.h: No such file or directory compilation terminated. json.c:3:28: fatal error: libspotify/api.h: No such file or directory compilation terminated. server.c:20:27: fatal error: event2/buffer.h: No such file or directory compilation terminated. make: *** [server] Error 1

Have I missed a step?

Regards,

Phil

Segfault when trying to patch more than one playlist

Nice work on spotify-api-server. I have a small issue though

I'm hitting it with the following python script:

import urllib2
import json
from time import sleep

for i in range(0, 5):
    response = urllib2.urlopen("http://localhost:1337/playlists", "{\"title\":\"Test playlist " + str(i) + "\"}").read()
    playlist = json.loads(response)
    print playlist["uri"]

    sleep(1)

    response = urllib2.urlopen("http://localhost:1337/playlists/" + playlist["uri"] + "/patch", "[\"spotify:track:4dltreEGGU7sRqNn8mn077\",\"spotify:track:1VuYtK1bj7zobQvVjVXLCM\",\"spotify:track:3MI0YDy3xsC7DMkYMGl8qn\",\"spotify:track:6oVF3nIEWCgHHUgsTNogJy\",\"spotify:track:0KiabThwmeijxTVsCbJoqB\",\"spotify:track:3GVO15Abzaia0MTx4KqnSN\",\"spotify:track:6dj5QpwSilhKjni4tY4q26\",\"spotify:track:2Bd30tORK6MALbPhkPBObr\",\"spotify:track:6ajn6NMyl4qxugyQI5aEjQ\",\"spotify:track:7iIA3j6dE497MxKVDnOgEr\"]").read()

    sleep(1)

On the second iteration of that loop, during the call to /patch spotify-api-server segfaults. I got this backtrace from gdb if that helps:
#0 0xb7cb4408 in svn_diff_output () from /usr/lib/libsvn_diff-1.so.1
#1 0xb7cb33cb in svn_diff_mem_string_output_unified ()

from /usr/lib/libsvn_diff-1.so.1
#2 0x0804acf9 in diff_output_stdout (stream_output=0xb7fd8740,

diff=0xb7748058, playlist=0x84fa5d0, tracks=0x850ade8, num_tracks=10, 
pool=0xb7fd7018) at diff.c:266

#3 0x0804c8d7 in put_playlist_patch (playlist=0x84fa5d0, request=0x850f0e0,

userdata=0x8051008) at server.c:673

#4 0x0804d174 in handle_request (request=0x850f0e0, userdata=0x8051008)

at server.c:900

#5 0xb7c3493f in ?? () from /usr/lib/libevent-2.0.so.5
#6 0xb7c323cf in ?? () from /usr/lib/libevent-2.0.so.5
#7 0xb7c3391c in ?? () from /usr/lib/libevent-2.0.so.5
#8 0xb7c33a63 in ?? () from /usr/lib/libevent-2.0.so.5
#9 0xb7c2120f in _bufferevent_run_readcb () from /usr/lib/libevent-2.0.so.5
#10 0xb7c2268d in ?? () from /usr/lib/libevent-2.0.so.5
#11 0xb7c160c9 in event_base_loop () from /usr/lib/libevent-2.0.so.5
#12 0xb7c172d3 in event_base_dispatch () from /usr/lib/libevent-2.0.so.5
#13 0x0804d773 in main (argc=1, argv=0xbffff384) at server.c:1059

I also had to add -lapr-1 to the server target in the Makefile to get it to build (on Ubuntu 11.10). I don't imagine this is related though.

Restarting (or stopping) the server

Can I simply run the command to start the server to restart it?

I've updated to fix issues with truncated URI's but that issue persists. Unfortunately our servers are a black box (we have to submit installs to sys admin), and I can't tell if the server has not restarted (i.e. the older version is still running) OR less likely, if the new version is running but truncating issue persists.

Is there a response to say that the server has started / restarted / stopped?

A command to stop the server?

It might be helpful to have a stop command, and / or some clarity in the readme.

Thanks, apologies that I am somewhat of a noob here!

[1]+ segmentation fault ./server -A ...

Hi there, i played around with the spotify-api-server and i get a segmentation fault while the server is running in idle. Could you fix this please? Im running on debian linux Linux tvh 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64 GNU/Linux Thanks! Best regards....

Playlist subscriber count always 0

Is there anyway you can implement the callback for the subscriber count so that it loads properly, at the moment it appears to always return 0.

nothing happens when launching ./server

hi there,

I do have an error after compiling the server.
everything seems to be fine (unless few warnings) but when I try to launch it (the same way I used to with the old version) nothing happens
/spotify-api-server$ ls
account.c appkey.c constants.h COPYING diff.c diff.h json.c json.h Makefile README.md server server.c
spotify-api-server$ ./server
spotify-api-server$

it seems that the process exits right away after its launch.

I'm using the latest build of libspotify 9.1.32, jansson 2.1, libevent on a 10.10 ubuntu
is there a way to log what could be the error ?

by the way, your project rocks!

many thanks

Reorder existing tracks in patch.

In addition to adds and removes, it would be great if patch reordered tracks that are already in the playlist. So if I have ABC and patch this to DCB, I'd like this to turn into: add D at index 0, move C to index 1, move B to index 2, remove A. This way the added-dates on the songs would be preserved. At the moment the diff-based approach ends up adding and removing some of the existing songs, which resets their added dates.

Can't open libevent when running ./server

Have installed all dependencies (libevent installed in /usr/local/lib/) but receiving the following error when running ./server

"error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory"

Should I be making an adjustment somewhere? Thanks

URIs get trimmed

In constants.h, the track URI is set to a fixed length with:

static const int kTrackLinkLength = sizeof("spotify:track:58PipbkYEkKFzOowRPHF3m");

However, local URIs can be longer, like so:

spotify:local:The+Beatles:1:The+Long+and+Winding+Road:219

Currently, this URI gets trimmed to:

spotify:local:The+Beatles:1:The+Long

Which renders it useless. Some applications will want to keep track of the "artist:album:title" information in local URIs, for features like scanning a user's playlists to figure out their taste.

We should remove the fixed length, or handle local URIs differently, so that their metadata isn't lost.

Cheers!

Dynamic Login

Is there a way to handle dynamic login?

The idea behind this, is that we can send the username and password dynamically via a PHP Form, which will cause the server to run. The problem we're having is that the server requires root privileges to run, which we can't control from PHP.

Is there a way that we can initialise the server, then provide login details afterwards.
I'll be able to code a PHP login method that'll send and authenticate with this method whilst the server is running.

Separating the Login and the Server Start is important as it will allow dynamic login details
(i.e. from a webform, for instance).

Without root privileges, we're getting a 'Segmentation fault'.

Playlist patch buffer length segmentation fault

HI,

I have been adding tracks to playlists successfully for playlists with a small number of tracks. Using 'patch' action with lists of tracks of lengths 23, 20 , 25 and 18 all work but attempts with lengths 35, 53 , 55, 494 all fail with segmentation fault.

--- playlist
+++ tracks
Segmentation fault

Any ideas?

Regards,

Phil

Successful Patch tracks (23 tracks)

["spotify:track:2KrIVRYbzxFhrtIs6iDZpn", "spotify:track:7HWt3O3mY9Ejgqa5WLiwG7", "spotify:track:6agCYmY7mHdd2HtzkKR0uU", "spotify:track:5HUTivNx4jI5BEnGFStysY", "spotify:track:6LUfuyLgvgqrykiTE6sJHY", "spotify:track:2M7bnQgK7begKIAA2trHgF", "spotify:track:5HEsvn21MLJnSsVcbvaRO5", "spotify:track:4iRtNSRhxnCGJY96M4t4vE", "spotify:track:62qbqwdfzMZH0YnZnK7qbD", "spotify:track:3kklih5zwsKOTwIjXlEoQ6", "spotify:track:6LNAN26lCw265b7uufPqwi", "spotify:track:20GWXZBlWPXnsAi7LpovGm", "spotify:track:4ibG9Mhq9j0qIUJnQNlY3l", "spotify:track:7cNYwo8GJnPVBPwFtfGdbl", "spotify:track:64zjna5dIuO7s9FCDXQMmI", "spotify:track:5pJquZGyj54uXIsurC58RW", "spotify:track:2fQHhKoE0ybE5BlBtgXCof", "spotify:track:3lbDs10i7vOtycc0GC4MwY", "spotify:track:1Gl1kBdoYAPFdUGLjKPYPP", "spotify:track:0MFhG8lKHJuY8dVWZfrvPS", "spotify:track:0j0LZsSkn7EkWBHYvbVUA4", "spotify:track:7kWNVaDYz9BzewpF2wMmEb", "spotify:track:58S1FxhHdmTMUIO9IwYSsP"]

Patch resulting in segmentation fault (35 tracks)

["spotify:track:0j0LZsSkn7EkWBHYvbVUA4", "spotify:track:7rXq4ysIfow15aniE7Wa48", "spotify:track:4yjdBF4YbxRBu5YrcyZSiY", "spotify:track:4wn9vEOoTtjy4sA8KrxsCM", "spotify:track:1CcS1yrulOFPXYk7NVKAm2", "spotify:track:3lbDs10i7vOtycc0GC4MwY", "spotify:track:1mr3616BzLdhXfJmLmRsO8", "spotify:track:14sce2fWlDwaQ1waDJgFQw", "spotify:track:0zJEpaxLeRr0weGNFmo4ew", "spotify:track:41PgZhcmzIZma6EKXnGh1f", "spotify:track:1pJ0PJ6IDxxuxbvBy2cXNp", "spotify:track:70lRBuPpI89zSrhuLipYKu", "spotify:track:2TWqeDDnvUwsOMtMKKlTKy", "spotify:track:5cbIzAc5iaJFHBYNAjn0Pc", "spotify:track:4yjdBF4YbxRBu5YrcyZSiY", "spotify:track:5Jy41goqkvo11UvQMjVh0m", "spotify:track:3D88TC7XpqeT5TvfwxIHaw", "spotify:track:0CrSNnrgXfFSaMMuDu9d9M", "spotify:track:4HEopLmkmkM0SAEQQpHpC4", "spotify:track:6LUfuyLgvgqrykiTE6sJHY", "spotify:track:7cNYwo8GJnPVBPwFtfGdbl", "spotify:track:07UxLndErtWMqjIqf9qyAj", "spotify:track:2KrIVRYbzxFhrtIs6iDZpn", "spotify:track:7E2hkRRn2wbj5Zwx1sm0vm", "spotify:track:5XlaNk8zD5YtFwoNdQDC4k", "spotify:track:5vv5GItERpw2WNXFIp0JYm", "spotify:track:4Yk5c0hVUYQtfmsu4XbEC3", "spotify:track:7JZQLYViGdWdZsBw5jD7Wa", "spotify:track:1IpeK8SXhaolegz992pl1s", "spotify:track:0ttBGfaHcAVDpyMMRkQ9RP", "spotify:track:20jbVobhjypgFXmZZrz7ti", "spotify:track:2lVssYs6ZYGFBaEosIZCuj", "spotify:track:2FQDno7lfDiYHUeV8GKc3q", "spotify:track:0mBkoM8r7KAQzZij5swTUL", "spotify:track:4ZIm2UpFU9vP3LURrjOMwL"]

public playlist?

hi, how can i create a playlist as public? it seems that when i create it from the server it is "secret" and i don't see a way to change that.

Turn off notifications?

I've this line in my /var/log/syslog log file.

Oct  2 07:52:01 shine spotify-api-server[16461]: notify_main_thread
Oct  2 07:52:32 shine last message repeated 1404 times

It looks like a notification of some sort and not an error/warning.
Is it possible to turn it off?

Note that I make about 1k requests a minute to my server.

No reply from spotify-api-server

The spotify-api-server does not respond to a request to get a users playlist. Im using chrome to just enter the URL http://10.0.0.114:1337/user/myusername/playlists. This should give me some kind of result right? If not im missunderstanding the README.md file.

The compile gives the following warnings:

nikls@dev:~/src/spotify-api-server$ make
gcc -std=c99 -Wall apr-1-config --includes --ldflags --link-ld --cflags --cppflags -I/usr/include/subversion-1 -lspotify -lsvn_diff-1 -lsvn_subr-1 -ljansson -levent -levent_pthreads appkey.c account.c diff.c json.c server.c -o server
diff.c: In function ‘output_diff_modified’:
diff.c:191:56: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
/usr/local/include/libspotify/api.h:2654:24: note: expected ‘struct sp_track * const_’ but argument is of type ‘const struct sp_track *
server.c:212:1: warning: initialization from incompatible pointer type
server.c: In function ‘put_playlist_add_tracks’:
server.c:490:3: warning: passing argument 2 of ‘json_to_tracks’ from incompatible pointer type
json.h:12:5: note: expected ‘struct sp_track *
’ but argument is of type ‘const struct sp_track *
server.c:505:54: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
/usr/local/include/libspotify/api.h:2654:24: note: expected ‘struct sp_track * const
’ but argument is of type ‘const struct sp_track *
server.c: In function ‘put_playlist_patch’:
server.c:661:57: warning: passing argument 3 of ‘diff_playlist_tracks_apply’ from incompatible pointer type
diff.h:10:14: note: expected ‘struct sp_track *
’ but argument is of type ‘const struct sp_track *
server.c:665:3: warning: passing argument 4 of ‘diff_output_stdout’ from incompatible pointer type
diff.h:16:14: note: expected ‘struct sp_track *
’ but argument is of type ‘const struct sp_track *_’
server.c: In function ‘main’:
server.c:972:5: warning: initialization discards qualifiers from pointer target type
server.c:974:3: warning: initialization discards qualifiers from pointer target type

My test system is a fresh install of Ubuntu 11.04 running in virtualbox. Latest sources from github and libspotify 9.1.32 x86_64.

Building on OSX 10.9.2

Hi,

I cannot build the project on OSX anymore, because of the dependency to libsvn. I think I had it installed via Homebrew.

diff.c:3:10: fatal error: 'svn_diff.h' file not found
#include <svn_diff.h>

Maybe someone is working on a Mac and remembers how they installed the SVN dev files ?

Makefile does not link apr library

When trying to install this on an Ubuntu 11.10 64-bit server, I needed to modify the Makefile slightly to link in the apr (Apache Portable Runtime) library. I would expect this to be automated, as the other libraries are linked in correctly.

Renaming a playlist

Hello,

Looking at the code, I don't find a way to rename a playlist. Not yet possible, right ?

If I implement it, where do you think it should be done ?

In a URL like this one :
/playlist/{id}/rename <- {title : <string>} -> <playlist>

What do you think ?

Thanks.

Installation issues: too few arguments to function ‘sp_session_login’

Running make gives me the following output:

gcc -std=c99 -Wall apr-1-config --includes --ldflags --link-ld --cflags --cppflags -I/usr/include/subversion-1 -lspotify -lsvn_diff-1 -lsvn_subr-1 -ljansson -levent -levent_pthreads appkey.c account.c diff.c json.c server.c -o server
diff.c: In function ‘output_diff_modified’:
diff.c:191: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
server.c:176: warning: initialization from incompatible pointer type
server.c: In function ‘put_playlist_add_tracks’:
server.c:429: warning: passing argument 2 of ‘json_to_tracks’ from incompatible pointer type
server.c:444: warning: passing argument 2 of ‘sp_playlist_add_tracks’ from incompatible pointer type
server.c: In function ‘put_playlist_patch’:
server.c:600: warning: passing argument 3 of ‘diff_playlist_tracks_apply’ from incompatible pointer type
server.c:604: warning: passing argument 4 of ‘diff_output_stdout’ from incompatible pointer type
server.c: In function ‘main’:
server.c:878: warning: initialization discards qualifiers from pointer target type
server.c:880: warning: initialization discards qualifiers from pointer target type
server.c:929: error: too few arguments to function ‘sp_session_login’
make: *** [server] Error 1

I'm on libspotify 9.1.32

Any clues?

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.