title: How do I use C Library with Rails + Swig?
body: <p>I've programmed 2 rails apps so far that have definitely gotten me pretty comfortable with ruby + rails. I can't say the same about C though. I don't even know what I'm looking at to be honest any time I look at C. It looks like macaroni.</p>
  
  <p>I'm trying to build a spotify web app. The web API sucks, so I have to use this: <a href="https://developer.spotify.com/technologies/libspotify/" rel="nofollow">https://developer.spotify.com/technologies/libspotify/</a></p>
  
  <p>Documentation: <a href="https://developer.spotify.com/technologies/libspotify/docs/12.1.45/" rel="nofollow">https://developer.spotify.com/technologies/libspotify/docs/12.1.45/</a></p>
  
  <p>Someone told me I can look at SWIG as a wrapper to communicate with rails.</p>
  
  <p>The data I'm trying to get is 3 things: Number of subscribers, playlist thumbnail, number of tracks... given a playlist URL in the format of: <code>http://open.spotify.com/user/{{username}}/playlist/{{playlist_id}}</code></p>
  
  <p>To be honest, I have no idea where to even start. I can't find any swig tutorials online, and staring at this documentation isn't helping.</p>
  
  <p>Could someone maybe give me a very brief 1,2,3 step procedure that one might go through to do something like this? I don't really expect any code.. but.. this is very roughly what I understand so far.. perhaps someone could help me fill this in..</p>
  
  <ol>
  <li>save all C files you need to rails lib directory</li>
  <li>compile files with ... ?</li>
  <li>use swig somehow</li>
  <li>:|</li>
  </ol>
  
  <p>Any help would be super appreciated. I realize this is vague and 'subjective' but I don't even know how to ask this objectively. Just a quick 1-2-3-4-5 to get me started so I can do some googling would be fantastic.</p>
  
  <p>Edit: I did find this, but this seems to be much obsolete: <a href="https://github.com/sarnesjo/greenstripes" rel="nofollow">https://github.com/sarnesjo/greenstripes</a></p>