mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-10 05:39:35 +01:00
Added forceSearch, forceProcess, getVersion, checkGithub, shutdown, restart, update commands. Also modified config.html a bit to make all the clutter look a little less cluttered
This commit is contained in:
19
apireference
19
apireference
@@ -1,10 +1,15 @@
|
||||
The API is still pretty new and needs some serious cleaning up on the backend but should be
|
||||
reasonably functional. There are no error codes yet,
|
||||
|
||||
|
||||
General structure:
|
||||
http://localhost:8181 + HTTP_ROOT + /api?apikey=$apikey&cmd=$command
|
||||
|
||||
Data returned in json format
|
||||
|
||||
Commands:
|
||||
$commands¶meters[&optionalparameters]:
|
||||
|
||||
|
||||
getIndex (fetch data from index page. Returns: ArtistName, ArtistSortName, ArtistID, Status, DateAdded,
|
||||
[LatestAlbum, ReleaseDate, AlbumID], HaveTracks, TotalTracks,
|
||||
IncludeExtras)
|
||||
@@ -17,7 +22,7 @@ getUpcoming (Returns: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, Rele
|
||||
|
||||
getWanted (Returns: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, ReleaseDate, AlbumID, ArtistID, Type)
|
||||
|
||||
getSimilar (Returns similar artists with a higher "Count" being more likely to be similar. Returns: Count, ArtistName, ArtistID)
|
||||
getSimilar (Returns similar artists - with a higher "Count" being more likely to be similar. Returns: Count, ArtistName, ArtistID)
|
||||
|
||||
getHistory (Returns: Status, DateAdded, Title, URL (nzb), FolderName, AlbumID, Size (bytes))
|
||||
|
||||
@@ -38,3 +43,13 @@ refreshArtist&id=$artistid (refresh info for artist in db from musicbrainz)
|
||||
|
||||
queueAlbum&id=$albumid[&new=True&lossless=True] (Mark an album as wanted and start the searcher. Optional paramters: 'new' looks for new versions, 'lossless' looks only for lossless versions)
|
||||
unqueueAlbum&id=$albumid (Unmark album as wanted / i.e. mark as skipped)
|
||||
|
||||
forceSearch (force search for wanted albums - not launched in a separate thread so it may take a bit to complete)
|
||||
forceProcess (force post process albums in download directory - also not launched in a separate thread)
|
||||
|
||||
getVersion (Returns some version information: git_path, install_type, current_version, installed_version, commits_behind
|
||||
checkGithub (updates the version information above and returns getVersion data)
|
||||
|
||||
shutdown (shut down headphones)
|
||||
restart (restart headphones)
|
||||
update (update headphones - you may want to check the install type in get version and not allow this if type==exe)
|
||||
@@ -60,20 +60,20 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>NZB Search Interval (mins):</h3>
|
||||
<input type="text" name="nzb_search_interval" value="${config['nzb_search_interval']}" size="5" maxlength="40">
|
||||
<h3>NZB Search Interval:</h3>
|
||||
<input type="text" name="nzb_search_interval" value="${config['nzb_search_interval']}" size="4" maxlength="10">mins
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Download Folder Scan Interval (mins):</h3>
|
||||
<input type="text" name="download_scan_interval" value="${config['download_scan_interval']}" size="5" maxlength="40">
|
||||
<h3>Download Scan Interval:</h3>
|
||||
<input type="text" name="download_scan_interval" value="${config['download_scan_interval']}" size="4" maxlength="10">mins
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Library Scan Interval (mins):</h3>
|
||||
<input type="text" name="libraryscan_interval" value="${config['libraryscan_interval']}" size="5" maxlength="40">
|
||||
<h3>Library Scan Interval:</h3>
|
||||
<input type="text" name="libraryscan_interval" value="${config['libraryscan_interval']}" size="4" maxlength="10">mins
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import headphones
|
||||
|
||||
from headphones import db, mb, importer, searcher, logger
|
||||
from headphones import db, mb, importer, searcher, postprocessor, versioncheck, logger
|
||||
|
||||
import lib.simplejson as simplejson
|
||||
from xml.dom.minidom import Document
|
||||
import copy
|
||||
|
||||
cmd_list = [ 'getIndex', 'getArtist', 'getAlbum', 'getUpcoming', 'getWanted', 'getSimilar', 'getHistory', 'getLogs',
|
||||
'findArtist', 'findAlbum', 'addArtist', 'delArtist', 'pauseArtist', 'resumeArtist', 'refreshArtist']
|
||||
'findArtist', 'findAlbum', 'addArtist', 'delArtist', 'pauseArtist', 'resumeArtist', 'refreshArtist',
|
||||
'queueAlbum', 'unqueueAlbum', 'forceSearch', 'forceProcess', 'getVersion', 'checkGithub',
|
||||
'shutdown', 'restart', 'update', ]
|
||||
|
||||
class Api(object):
|
||||
|
||||
@@ -262,4 +264,32 @@ class Api(object):
|
||||
myDB = db.DBConnection()
|
||||
controlValueDict = {'AlbumID': self.id}
|
||||
newValueDict = {'Status': 'Skipped'}
|
||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||
|
||||
def _forceSearch(self):
|
||||
searcher.searchforalbum()
|
||||
|
||||
def _forceProcess(self):
|
||||
postprocessor.forcePostProcess()
|
||||
|
||||
def _getVersion(self):
|
||||
self.data = {
|
||||
'git_path' : headphones.GIT_PATH,
|
||||
'install_type' : headphones.INSTALL_TYPE,
|
||||
'current_version' : headphones.CURRENT_VERSION,
|
||||
'latest_version' : headphonesLATEST_VERSION,
|
||||
'commits_behind' : headphones.COMMITS_BEHIND,
|
||||
}
|
||||
|
||||
def _checkGithub(self):
|
||||
versioncheck.checkGithub()
|
||||
self._getVersion()
|
||||
|
||||
def _shutdown(self):
|
||||
headphones.SIGNAL = 'shutdown'
|
||||
|
||||
def _restart(self):
|
||||
headphones.SIGNAL = 'restart'
|
||||
|
||||
def _update(self):
|
||||
headphones.SIGNAL = 'update'
|
||||
Reference in New Issue
Block a user