resolve-external.php 787 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. function resolve_external_url($url) {
  3. if (substr($url, 0, 10) == 'jamendo://') {
  4. return process_jamendo_url($url);
  5. }
  6. return $url;
  7. }
  8. function process_jamendo_url($url) {
  9. if (substr($url, 10, 13) == 'track/stream/') {
  10. $id = substr($url, 23);
  11. // return 'http://gigue.rrbone.net/' . $id . '.ogg2';
  12. return 'https://mp3l.jamendo.com/?trackid=' . $id . '&format=ogg2';
  13. }
  14. if (substr($url, 10, 15) == 'album/download/') {
  15. $id = substr($url, 25);
  16. return 'http://api.jamendo.com/get2/bittorrent/file/plain/?album_id=' . $id . '&type=archive&class=ogg3';
  17. }
  18. if (substr($url, 10, 10) == 'album/art/') {
  19. $id = substr($url, 20);
  20. return 'http://api.jamendo.com/get2/image/album/redirect/?id=' . $id . '&imagesize=200';
  21. }
  22. // We don't know what this is
  23. return $url;
  24. }