Page 1 of 21

Headphones : Music albums and artists auto download program

Posted: March 4th, 2011, 3:26 pm
by demolt
I'm totally in love with Sickbeard and I was thinking that it would be awesome if such a tool was available for music.  I figured it should be pretty easy to convert such a system te work with music as well.

Now the only programming I'm able to do is a little HTML and PHP, so I won't be able to do such a thing unfortunately. But I was hoping to find someone with the same interest in a program like that to convert sickbeard or create a simillar program to organize music with the help of an online database.
It would be great to be able to add artists like you add TV series in Sickbeard, the seasons would be the albums.

Is this possible and easy or am I crazy?

Re: Sickbeard for Music albums and artists

Posted: March 7th, 2011, 10:21 am
by nomar383
Do you know of any good online music databases with an API? I just saw that Yahoo has one.

This would be a nice way to track artists rather than just stumbling upon the fact that an artist you like just put out a new album.

Re: Sickbeard for Music albums and artists

Posted: March 11th, 2011, 12:54 pm
by demolt
Sorry for the late answer.

The standard DB other apps use is FreeDB, check www.freedb.org

Re: Sickbeard for Music albums and artists

Posted: March 11th, 2011, 1:01 pm
by nomar383
Hmmmm, there would have to be somewhere that you could scrape or query for a particular artist.

Let's say I want to track the Beastie Boys. This app would have to be able to reliably tell what the next album will be. FreeDB turned up 8265 results just for a search for artists named "Beastie Boys". I'm not sure how reliable that is.

Re: Sickbeard for Music albums and artists

Posted: March 11th, 2011, 1:45 pm
by demolt
That's where my lack of programming comes to play, I don't know which database is useful.
I found the next sites:
http://www.discogs.com/
http://www.shazam.com/
http://www.last.fm

Re: Sickbeard for Music albums and artists

Posted: March 11th, 2011, 1:46 pm
by nomar383
Oh! Last.fm has a great looking API. That might work for something like this...

EDIT: Python API for it too:
http://code.google.com/p/python-lastfm/

Re: Sickbeard for Music albums and artists

Posted: March 11th, 2011, 2:00 pm
by demolt
nomar383 wrote: Oh! Last.fm has a great looking API. That might work for something like this...

EDIT: Python API for it too:
http://code.google.com/p/python-lastfm/
Nice :)

I also opened a topic @ sickbeards forum, maybe there is someone who can help :)
http://sickbeard.com/forums/viewtopic.p ... 6239#p6239

Re: Sickbeard for Music albums and artists

Posted: March 13th, 2011, 12:04 pm
by nomar383
How do you envision this working? You add an artist and have it download anything it finds that matches Last.FM results?

Re: Sickbeard for Music albums and artists

Posted: March 13th, 2011, 2:27 pm
by demolt
I was hoping it to work exactly like sickbeard.

First you add the artists you like, then you let it search the folders to songs you already have.
After that you chose the albums in stead of a season you pick an album and click "Wanted" at all the songs of that album, as you would do in sickbeard.

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 2:04 am
by rembo10
http://github.com/rembo10/headphones

I just learned python so the code is pretty messy, but it's reasonably functional. It only works with SABnzbd & NZBMatrix for now (since that's what I've been using) and post-processing doesn't work (so just use SAB to configure your final download destination using the categories).

Either manually add artists or use the  iTunes auto-import to add artists to watch. New albums are auto-set to 'Wanted' and automatically downloaded when available. You can also download any old album within the app (although this is a little spotty due to NZBMatrix's RSS feed and retention parameters).

I'm totally rewriting the code to get rid of redundencies and what not, and to add logging & templates, but I wanted to get something working for myself.

To run it just download it from github, cd into the directory and run 'python headphones.py' [ -q and -d as optional arguments]

Default port is 8181

I built & tested it using Safari on a Mac so apologies if the css is a little wonky on other browsers

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 11:08 am
by al1937
Hi rembo10
I get the error below when I try to add an artist.
Win7-64 and firefox and python 2.7.1.

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "M:\Headphones\rembo10-headphones-064ef2e\cherrypy\_cprequest.py", line 645, in respond
    response.body = self.handler()
  File "M:\Headphones\rembo10-headphones-064ef2e\cherrypy\lib\encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "M:\Headphones\rembo10-headphones-064ef2e\cherrypy\_cpdispatch.py", line 29, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "M:\Headphones\rembo10-headphones-064ef2e\webServer.py", line 217, in addArtist
    c.execute('INSERT INTO tracks VALUES( ?, ?, ?, ?, ?, ?, ?, ?)', (artistid, results.artist.name, results.title, results.asin, u.extractUuid(results.id), track.title, track.duration, u.extractUuid(track.id)))
ProgrammingError: Cannot operate on a closed cursor.

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 12:16 pm
by rembo10
Ah, I tested it with python 2.6 on OSX so I'm sure there are issues cross-compatibility wise. Should be fixed now on github....

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 12:39 pm
by jcfp
Rembo, great to see you work on the missing link of sab addons ;D

Just tried headphones and got a (similar but not identical) traceback when trying to add an artist. Anyway, the traceback presists even after a restart of the application, and blocks the web interface from being used. Ubuntu 11.04, Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53), exact web browser is in the logging below.

Code: Select all

$ python headphones.py
[25/May/2011:19:22:38] ENGINE Listening for SIGHUP.
[25/May/2011:19:22:38] ENGINE Listening for SIGTERM.
[25/May/2011:19:22:38] ENGINE Listening for SIGUSR1.
[25/May/2011:19:22:38] ENGINE Bus STARTING
[25/May/2011:19:22:38] ENGINE Started monitor thread 'Autoreloader'.
[25/May/2011:19:22:38] ENGINE Serving on 127.0.0.1:8082
[25/May/2011:19:22:38] ENGINE Bus STARTED
127.0.0.1 - - [25/May/2011:19:22:54] "GET / HTTP/1.1" 200 1022 "" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1"
127.0.0.1 - - [25/May/2011:19:22:54] "GET /data/css/style.css HTTP/1.1" 200 1904 "" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1"
127.0.0.1 - - [25/May/2011:19:22:54] "GET /data/images/headphoneslogo.png HTTP/1.1" 200 8304 "" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1"
127.0.0.1 - - [25/May/2011:19:23:48] "GET /findArtist?name=rammstein HTTP/1.1" 303 200 "" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1"
127.0.0.1 - - [25/May/2011:19:24:34] "GET /addArtist?artistid=b2d122f9-eadb-4930-a196-8f221eeb0c66 HTTP/1.1" 303 90 "" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1"
[25/May/2011:19:24:34] HTTP Traceback (most recent call last):
  File "/home/jp/devel/headphones/headphones/cherrypy/_cprequest.py", line 645, in respond
    response.body = self.handler()
  File "/home/jp/devel/headphones/headphones/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/home/jp/devel/headphones/headphones/cherrypy/_cpdispatch.py", line 29, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/jp/devel/headphones/headphones/webServer.py", line 40, in index
    c.execute('''SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumID from albums WHERE ArtistName="%s" order by ReleaseDate DESC''' % results[i][0])
ProgrammingError: Cannot operate on a closed cursor.

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 1:41 pm
by nomar383
Glad you had some time to work on this since I never got around to it  :D

Re: Sickbeard for Music albums and artists

Posted: May 25th, 2011, 1:55 pm
by rembo10
Check out the latest - I also fixed the wonky search bar

there may be some other issues since I'm on 2.6 but I'll make it work

Any suggestions and what not definitely let me know. I'm going to rewrite the whole deal so I'd love to make it as awesome as possible