diff options
Diffstat (limited to 'libs/music')
-rwxr-xr-x | libs/music/player.d/cgi-bin/pcm.cgi | 5 | ||||
-rw-r--r-- | libs/music/player.d/main_static.js | 4 | ||||
-rw-r--r-- | libs/music/player.d/pcm.js | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/libs/music/player.d/cgi-bin/pcm.cgi b/libs/music/player.d/cgi-bin/pcm.cgi index e43262f..2d5eaca 100755 --- a/libs/music/player.d/cgi-bin/pcm.cgi +++ b/libs/music/player.d/cgi-bin/pcm.cgi @@ -7,6 +7,8 @@ print('Status: 200 OK',end='\r\n') print('Content-type: application/json',end='\r\n') print(end='\r\n') +fmt='ogg' if 'fmt' not in d else d['fmt'] + ro={'status':200,'message':'OK'} if 'folder' not in d or d['folder']=='': plp=os.environ['DOCUMENT_ROOT']+'/libs/music/player.d/playlists/playlists' @@ -25,7 +27,8 @@ else: for line in f: line=line.strip() if len(line)>0: - alblist.append({'fileName':quote(line),'fileSize':0,'modifiedTime':0}) +#hard code this for now, until pcm api stabilizes + alblist.append({'fileName':quote(line+'.ogg'),'fileSize':0,'modifiedTime':0}) rro={'type':'fileList','data':{'musicList':alblist[1:],'subFolderList':list()}} ro['result']=rro print(json.dumps(ro)) diff --git a/libs/music/player.d/main_static.js b/libs/music/player.d/main_static.js index 1a48297..0888d09 100644 --- a/libs/music/player.d/main_static.js +++ b/libs/music/player.d/main_static.js @@ -727,7 +727,9 @@ function init() .then(()=>{ sh.elem('overlaytext').innerHTML+="Done!<br>Click or tap anywhere to start." sh.elem('overlay').onclick=function(){ - NSAudio.audioInit();NSAudio.connect(); + try{ + NSAudio.audioInit();NSAudio.connect(); + }catch(e){return;} if(window.location.hash.length) { let p=window.location.hash.substr(1).split('/'); diff --git a/libs/music/player.d/pcm.js b/libs/music/player.d/pcm.js index 575b7f7..0efe849 100644 --- a/libs/music/player.d/pcm.js +++ b/libs/music/player.d/pcm.js @@ -100,7 +100,7 @@ const AUDIO_URL='//filestorage.chrisoft.org/music/ogg/'; // FIXME: trigger this when audio doesn't finished load will cause play promise error. this.audio.pause(); this.currentIndex = i; - this.audio.src = AUDIO_URL + this.data[i].fileName + '.ogg'; + this.audio.src = AUDIO_URL + this.data[i].fileName; this.audio.load(); this.audio.play(); window.history.replaceState("","Useless Title","#/"+this.path+this.data[i].fileName+"/"); // title seems be fucked. |