remove Tomahawk resolver

The resolver is now maintained in the central Tomahawk resolver repository at:
https://github.com/tomahawk-player/tomahawk-resolvers
This commit is contained in:
Adrian Sampson 2012-08-24 20:39:55 -07:00
parent 473fe04f91
commit 9b8c56a646
3 changed files with 0 additions and 193 deletions

View file

@ -1,15 +0,0 @@
beets Tomahawk resolver
=======================
This is a script resolver for [Tomahawk][tomahawk player] that hooks into
[beets][beets music manager]. It uses [beets' web plugin][] to access your
beets library remotely.
To use it, just start ``beet web`` on the machine with your music and load this
resolver on the machine running Tomahawk. Use the configuration button on the
resolver to set the hostname and port of the beets server (these default to
localhost:8337). You should be able to start playing music immediately.
[beets' web plugin]: http://beets.readthedocs.org/en/latest/plugins/web.html
[beets music manager]: http://beets.radbox.org/
[tomahawk player]: http://tomahawk-player.org/

View file

@ -1,102 +0,0 @@
var BeetsResolver = Tomahawk.extend(TomahawkResolver,
{
// Basic setup.
settings:
{
name: 'beets',
weight: 95,
timeout: 5
},
// Resolution.
resolve: function( qid, artist, album, title )
{
this.beetsQuery(qid,
['artist:' + artist, 'album:' + album, 'title:' + title]
);
},
search: function( qid, searchString )
{
this.beetsQuery(qid, searchString.split(' '));
},
baseUrl: function() {
return 'http://' + this.host + ':' + this.port;
},
beetsQuery: function( qid, queryParts )
{
var baseUrl = this.baseUrl();
var url = baseUrl + '/item/query/';
for (var i = 0; i < queryParts.length; ++i) {
url += encodeURIComponent(queryParts[i]);
url += '/';
}
url = url.substring(0, url.length - 1); // Remove last /.
Tomahawk.asyncRequest(url, function(xhr) {
var resp = JSON.parse(xhr.responseText);
var items = resp['results'];
var searchResults = [];
for (var i = 0; i < items.length; ++i) {
item = items[i];
searchResults.push({
artist: item['artist'],
album: item['album'],
track: item['title'],
albumpos: item['track'],
source: "beets",
url: baseUrl + '/item/' + item['id'] + '/file',
bitrate: Math.floor(item['bitrate'] / 1024),
duration: Math.floor(item['length']),
size: 83375, //!
score: 1.0,
extension: "mp3", //!
mimetype: "audio/mpeg", //!
year: item['year']
});
}
Tomahawk.addTrackResults({
qid: qid,
results: searchResults
})
});
},
// Configuration.
getConfigUi: function () {
var uiData = Tomahawk.readBase64("config.ui");
return {
"widget": uiData,
"fields": [{
name: "host",
widget: "hostField",
property: "text"
}, {
name: "port",
widget: "portField",
property: "text"
}]
};
},
newConfigSaved: function () {
var userConfig = this.getUserConfig();
this.host = userConfig.host || 'localhost';
var port = userConfig.port;
port = parseInt(port);
if (isNaN(port) || !port) {
port = 8337;
}
userConfig.port = port;
this.port = port;
},
// Defaults.
host: 'localhost',
port: 8337
});
Tomahawk.resolver.instance = BeetsResolver;

View file

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>80</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>80</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>281</width>
<height>61</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostField">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>localhost</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="portField">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>8337</string>
</property>
</widget>
</item>
</layout>
</widget>
<zorder>layoutWidget</zorder>
<zorder>portField</zorder>
</widget>
<resources/>
<connections/>
</ui>