We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 849b5824 authored by Jonas Haraldsson's avatar Jonas Haraldsson

Merge branch 'master' into clean-library

parents 5d04f5e9 3431e4aa
How to install phpdoc and generate api docs gnu-fm (on Debian Squeeze)
----------
---
1. Install dependencies and phpDocumentor-alpha:
---
# aptitude install php-pear php5-xsl
# pear channel-discover pear.phpdoc.org
# pear install phpdoc/phpDocumentor-alpha
for other ways to install, see http://www.phpdoc.org/docs/latest/for-users/installation.html
---
2. Create dir which will be holding the docs, and generate docs:
---
cd /path/to/gnu-fm/nixtape
mkdir docs
phpdoc -d 2.0/ -t docs/
The docs can now be found at http://mynixtapedomain.tld/docs/
Add something similar to this to your crontab to keep the docs up-to-date:
0 0 * * * phpdoc -q -d /path/to/gnu-fm/nixtape/2.0/ -t /path/to/gnu-fm/nixtape/docs
......@@ -895,10 +895,10 @@ function method_auth_getSession() {
* Remove a scrobble from user's library
*
* #Parameters
* **timestamp** (required) : Timestamp in Unix time.
* **artist** (required) : Artist name.
* **track** (required) : Track name.
* **sk** (required) : Session key.
* * **timestamp** (required) : Timestamp in Unix time.
* * **artist** (required) : Artist name.
* * **track** (required) : Track name.
* * **sk** (required) : Session key.
* * **format** (optional) : Format of response, **xml** or **json**. Default is xml.
*
* #Additional info
......
......@@ -97,8 +97,14 @@ if (!isset($_REQUEST['api_key']) || !(isset($_REQUEST['cb']) || isset($_REQUEST[
// Web app auth step 2.2
if(isset($_POST['cb'])) {
$redirect_url = $_POST['cb'];
header('Location:' . $redirect_url . '&token=' . $_POST['token']);
$callback_url = $_POST['cb'];
if (preg_match("/\?/", $callback_url)) {
$redirect_url = $callback_url . '&token=' . $_POST['token'];
} else {
$redirect_url = $callback_url . '?token=' . $_POST['token'];
}
header('Location:' . $redirect_url);
// Desktop app auth step 2.2
} else {
......
#!/usr/bin/env python
import xml.etree.cElementTree as ElementTree
import sys, gzip, time
import sys, gzip, time, httplib
import psycopg2 as ordbms
JAMENDO_MIRROR = "gigue.rrbone.net"
genremap = {
0 : "Blues",
1 : "Classic Rock",
......@@ -195,11 +197,11 @@ class JamendoImport:
for track in album["tracks"]:
if "http://creativecommons.org/licenses/by-sa" not in track["license"] and not "http://creativecommons.org/licenses/by/" in track["license"] and not "http://artlibre.org/licence.php/lal.html" in track["license"]:
streamable = 0
else:
if self.free_license(track["license"]) and self.is_in_mirror(track["id"]):
streamable = 1
any_streamable_tracks = 1
else:
streamable = 0
try:
duration = int(track["duration"])
......@@ -406,6 +408,20 @@ class JamendoImport:
except:
return False
def free_license(self, license):
return ("http://creativecommons.org/licenses/by-sa" in license or "http://creativecommons.org/licenses/by/" in license or "http://artlibre.org/licence.php/lal.html" in license)
def is_in_mirror(self, id):
try:
trackfile = "/" + str(id) + ".ogg2"
connection = httplib.HTTPConnection(JAMENDO_MIRROR)
connection.request("HEAD", trackfile)
response = connection.getresponse()
connection.close()
except:
return False
else:
return response.status == 200 and response.getheader('Content-Type') == 'audio/ogg'
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment