diff --git a/config.py b/config.py
index 39480787..6030ffc5 100644
--- a/config.py
+++ b/config.py
@@ -1,7 +1,8 @@
import os
from configobj import ConfigObj
+from headphones import config_file
-config = ConfigObj(os.path.join(os.path.dirname(__file__), 'config.ini'))
+config = ConfigObj(config_file)
General = config['General']
http_host = General['http_host']
@@ -11,9 +12,11 @@ http_password = General['http_password']
launch_browser = General['launch_browser']
usenet_retention = General['usenet_retention']
include_lossless = General['include_lossless']
+flac_to_mp3 = General['flac_to_mp3']
move_to_itunes = General['move_to_itunes']
path_to_itunes = General['path_to_itunes']
rename_mp3s = General['rename_mp3s']
+cleanup = General['cleanup']
add_album_art = General['add_album_art']
music_download_dir = General['music_download_dir']
NZBMatrix = config['NZBMatrix']
@@ -74,18 +77,20 @@ form = '''
'''
diff --git a/webServer.py b/webServer.py
index f6eddc17..cb6edeb2 100644
--- a/webServer.py
+++ b/webServer.py
@@ -1,7 +1,6 @@
import templates
import config
import cherrypy
-import search
import musicbrainz2.webservice as ws
import musicbrainz2.model as m
import musicbrainz2.utils as u
@@ -11,10 +10,9 @@ import time
import sqlite3
import sys
import configobj
+from headphones import FULL_PATH, config_file
-
-
-database = os.path.join(os.path.dirname(__file__), 'headphones.db')
+database = os.path.join(FULL_PATH, 'headphones.db')
class Headphones:
@@ -32,7 +30,7 @@ class Headphones:
i = 0
page.append('''
- | Artist Name |
+ Artist Name |
Status |
Upcoming Albums |
|
@@ -41,7 +39,7 @@ class Headphones:
c.execute('''SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumID from albums WHERE ArtistName="%s" order by ReleaseDate DESC''' % results[i][0])
latestalbum = c.fetchall()
if latestalbum[0][1] > latestalbum[0][2]:
- newalbumName = '%s' % (latestalbum[0][3], latestalbum[0][0])
+ newalbumName = '%s' % (latestalbum[0][3], latestalbum[0][0])
releaseDate = '(%s)' % latestalbum[0][1]
else:
newalbumName = 'None'
@@ -50,10 +48,10 @@ class Headphones:
newStatus = '''%s(resume)''' % (results[i][2], results[i][1])
else:
newStatus = '''%s(pause)''' % (results[i][2], results[i][1])
- page.append('''| %s
+ page.append(''' |
| %s
(link) [delete] |
%s |
- %s %s |
''' % (results[i][1], results[i][0], results[i][1], results[i][1], newStatus, newalbumName, releaseDate))
+ %s %s |
''' % (results[i][1], results[i][0], results[i][1], results[i][1], newStatus, newalbumName, releaseDate))
i = i+1
page.append('''
''')
else:
@@ -89,6 +87,8 @@ class Headphones:
newStatus = '''
%s[
skip]''' % (results[i][3], results[i][2], ArtistID)
elif results[i][3] == 'Downloaded':
newStatus = '''
%s[
retry]''' % (results[i][3], results[i][2], ArtistID)
+ elif results[i][3] == 'Snatched':
+ newStatus = '''
%s[
retry]''' % (results[i][3], results[i][2], ArtistID)
else:
newStatus = '%s' % (results[i][3])
page.append('''
 |
@@ -257,7 +257,10 @@ class Headphones:
c.execute('UPDATE albums SET status = "Wanted" WHERE AlbumID="%s"' % AlbumID)
conn.commit()
c.close()
+ import searcher
+ searcher.searchNZB(AlbumID)
raise cherrypy.HTTPRedirect("/artistPage?ArtistID=%s" % ArtistID)
+
queueAlbum.exposed = True
@@ -271,9 +274,6 @@ class Headphones:
unqueueAlbum.exposed = True
-
-
-
def upcoming(self):
page = [templates._header]
page.append(templates._logobar)
@@ -308,15 +308,16 @@ class Headphones:
config.exposed = True
- def configUpdate(self, http_host='localhost', http_username=None, http_port=8181, http_password=None, launch_browser=0,
+
+ def configUpdate(self, http_host='127.0.0.1', http_username=None, http_port=8181, http_password=None, launch_browser=0,
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, music_download_dir=None,
usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, include_lossless=0,
- move_to_itunes=0, path_to_itunes=None, rename_mp3s=0, add_album_art=0):
+ flac_to_mp3=0, move_to_itunes=0, path_to_itunes=None, rename_mp3s=0, cleanup=0, add_album_art=0):
- configs = configobj.ConfigObj(os.path.join(os.path.dirname(__file__), 'config.ini'))
+ configs = configobj.ConfigObj(config_file)
SABnzbd = configs['SABnzbd']
General = configs['General']
- NZBMatrix = configs['NZBMatrix']
+ NZBMatrix = configs['NZBMatrix']
General['http_host'] = http_host
General['http_port'] = http_port
General['http_username'] = http_username
@@ -333,12 +334,15 @@ class Headphones:
NZBMatrix['nzbmatrix_username'] = nzbmatrix_username
NZBMatrix['nzbmatrix_apikey'] = nzbmatrix_apikey
General['include_lossless'] = include_lossless
+ General['flac_to_mp3'] = flac_to_mp3
General['move_to_itunes'] = move_to_itunes
General['path_to_itunes'] = path_to_itunes
General['rename_mp3s'] = rename_mp3s
+ General['cleanup'] = cleanup
General['add_album_art'] = add_album_art
configs.write()
+
reload(config)
raise cherrypy.HTTPRedirect("/config")
@@ -346,5 +350,6 @@ class Headphones:
configUpdate.exposed = True
def shutdown(self):
- sys.exit('Headphones is shutting down')
- shutdown.exposed = True
\ No newline at end of file
+ sys.exit()
+
+ shutdown.exposed = True