Skip to content

Commit

Permalink
Merge pull request #18 from gnehs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
gnehs authored Aug 13, 2018
2 parents 75a1543 + 52f4313 commit 8fb73f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const git = require('simple-git/promise')(__dirname);
git
.raw(['symbolic-ref', '--short', 'HEAD'])
.then(branch => {
branch = branch.slice(0,-1) // 結果會多一個換行符
branch = branch.slice(0, -1) // 結果會多一個換行符
if (branch != (config.PokaPlayer.debug ? 'dev' : 'master')) {
git
.fetch(["--all"])
Expand All @@ -38,7 +38,7 @@ git
console.error('failed: ', err)
socket.emit('err', err.toString())
process.exit()
})
})
}
})

Expand Down Expand Up @@ -170,7 +170,7 @@ app.get('/info', (req, res) => {
})

app.get('/debug', async(req, res) => {
res.send(config.PokaPlayer.debug ? (await git.raw(['rev-parse', '--short', 'HEAD'])).slice(0,-1) : 'false')
res.send(config.PokaPlayer.debug ? (await git.raw(['rev-parse', '--short', 'HEAD'])).slice(0, -1) : 'false')
})

// get song
Expand Down Expand Up @@ -228,6 +228,7 @@ app.get('/cover/:type/:info', async(req, res) => {
//專輯
var info = pp_decode(req.params.info)
url += info
console.log(info)
break;
}
rProxy(req, res, url)
Expand Down
22 changes: 11 additions & 11 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ router
}
})

ap.on("play", async () => {
ap.on("play", async() => {
//沒歌就隨機播放
if (ap.list.audios.length == 0) playRandom().then(() => {
router.navigate('now');
showNow()
})
updateMediaSession()
})
ap.on("loadedmetadata", async () => {
ap.on("loadedmetadata", async() => {
lrc.load(`[00:00.000]歌詞讀取中`)
$("div[data-lrc=\"inner\"]").html(`<p class="loading">歌詞讀取中</p>`)
let nowPlaying = ap.list.audios[ap.list.index],
Expand Down Expand Up @@ -622,7 +622,7 @@ async function showNow() {
ap.on("pause", () => {
$('[data-player] button.play[onclick="ap.toggle()"] i').text("play_arrow")
})
ap.on("play", async () => {
ap.on("play", async() => {
//卷軸轉轉
if ($(window).width() > 850 && $(window).height() > 560) {
$('.mdui-list.songs').animate({ scrollTop: 72 * ap.list.index - 100 }, 400);
Expand Down Expand Up @@ -958,13 +958,13 @@ async function showSettings() {

// PokaPlayer 詳細資料
let getInfo = await axios.get('/info/');
let debug = await axios.get('/debug/')
let debug = await axios.get('/debug/')
let checkUpdate = await axios.get(`https://api.github.com/repos/gnehs/PokaPlayer/releases`);
let update = getInfo.data.version != checkUpdate.data[0].tag_name
? `新版本 <a href="${checkUpdate.data[0].html_url}" target="_blank">${checkUpdate.data[0].tag_name}</a> 已發佈,請立即更新 <a href="javascript:void(0)" data-upgrade>更新</a>`
: debug.data == false
? `您的 PokaPlayer 已是最新版本`
: `<a href="javascript:void(0)" data-upgrade>與開發分支同步</a>`
let update = getInfo.data.version != checkUpdate.data[0].tag_name ?
`新版本 <a href="${checkUpdate.data[0].html_url}" target="_blank">${checkUpdate.data[0].tag_name}</a> 已發佈,請立即更新 <a href="javascript:void(0)" data-upgrade>更新</a>` :
debug.data == false ?
`您的 PokaPlayer 已是最新版本` :
`<a href="javascript:void(0)" data-upgrade>與開發分支同步</a>`
let version = debug.data == false ? getInfo.data.version : debug.data
about = `PokaPlayer 是 Synology Audio Ststion 的新朋友! <a href="https://github.com/gnehs/PokaPlayer" target="_blank">GitHub</a>
<p><strong>版本</strong> ${version} / <strong>開發者</strong> ${getInfo.data.author} / ${update}</p>`
Expand Down Expand Up @@ -1038,7 +1038,7 @@ function playSongs(songlist, song = false, clear = true) {
let name = nowsong.title
let artist = nowsong.additional.song_tag.artist
let album = nowsong.additional.song_tag.album
let albumArtist = nowsong.additional.song_tag.albumArtist
let albumArtist = nowsong.additional.song_tag.album_artist
let poster = getCover("album", album, artist, albumArtist)
playlist.push({
url: src,
Expand Down Expand Up @@ -1069,7 +1069,7 @@ function addSong(songlist, songID = 0) {
let name = nowsong.title
let artist = nowsong.additional.song_tag.artist
let album = nowsong.additional.song_tag.album
let albumArtist = nowsong.additional.song_tag.albumArtist
let albumArtist = nowsong.additional.song_tag.album_artist
let poster = getCover("album", album, artist, albumArtist)
playlist.push({
url: src,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pokaplayer",
"version": "0.6.7",
"version": "0.6.8",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -33,4 +33,4 @@
"simple-git": "^1.96.0",
"socket.io": "^2.1.1"
}
}
}

0 comments on commit 8fb73f8

Please sign in to comment.