Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpd Last.fm 上報錯誤 #151

Closed
1 task done
fuyu0425 opened this issue Jul 12, 2023 · 14 comments
Closed
1 task done

mpd Last.fm 上報錯誤 #151

fuyu0425 opened this issue Jul 12, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@fuyu0425
Copy link
Contributor

Check for existing issues

检查是否已存在相同issue

  • Completed/已检查

Describe the bug and provide steps to reproduce it

描述遇到的bug并提供相应的复现方法

lastfm.Report(p.model.lastfm, lastfm.ReportPhaseComplete, p.curSong, p.PassedTime())

我在這

case ReportPhaseComplete:

加了 logger

utils.Logger().Printf("[LASTFM] Report: report phase complete d:%f p:%f",duration,passedSeconds)

log裡,passedSeconds都是 0.

似乎上報前 timer 就被 reset了

p.timer = utils.NewTimer(utils.Options{

Environment / 运行环境

musicfox master
macOS 10.15.7

If applicable, list the error messages you see

如果有错误输出请一并填入

No response

If applicable, attach your ${MUSICFOX_ROOT}/musicfox.log file to this issue.

如果${MUSICFOX_ROOT}/musicfox.log里有错误日志,请一并上传

No response

@fuyu0425 fuyu0425 added the bug Something isn't working label Jul 12, 2023
@fuyu0425
Copy link
Contributor Author

是不是應該是 p.playedTime 🤔

@fuyu0425
Copy link
Contributor Author

// 200ms 为刷新间隔,刷新间隔修改时此处需要保持同步
p.playedTime += time.Millisecond * 200

TickerInternal: 500 * time.Millisecond,

這裡是 500,是不是忘了改?

@kylezb
Copy link
Member

kylezb commented Jul 13, 2023

具体报错/错误是啥

@fuyu0425
Copy link
Contributor Author

沒報錯 p.PassedTime()lastfm.Report時是 0 導致
if duration <= passedSeconds || passedSeconds >= duration/2 永遠是 false,所以不會上報

@kylezb
Copy link
Member

kylezb commented Jul 13, 2023

沒報錯 p.PassedTime()lastfm.Report時是 0 導致 if duration <= passedSeconds || passedSeconds >= duration/2 永遠是 false,所以不會上報

window目前没发现有问题,我这没有mac环境,你自己测试下是不是mac计时器周期导致的,上报前打印一下 p.PassedTime()

@fuyu0425
Copy link
Contributor Author

就是打印出來是 0 (我先改成 p.playedTime了)

	// 状态监听
	go func() {
		defer utils.Recover(false)
		for {
			select {
			case <-ctx.Done():
				return
			case s := <-p.Player.StateChan():
				p.stateHandler.SetPlayingInfo(p.PlayingInfo())
				if s != player.Stopped {
					p.model.Rerender(false)
					break
				}
				utils.Logger().Printf("[LASTFM] StateChan: report complete %f", p.PassedTime().Seconds())
				// 上报lastfm
				lastfm.Report(p.model.lastfm, lastfm.ReportPhaseComplete, p.curSong, p.playedTime)
				// 自动切歌且播放时间不少于(实际歌曲时间-20)秒时,才上报至网易云
				if p.CurMusic().Duration.Seconds()-p.playedTime.Seconds() < 20 {
					utils.ReportSongEnd(p.curSong.Id, p.PlayingInfo().TrackID, p.playedTime)
				}
				p.NextSong(false)
			}
		}
	}()
2023/07/12 21:42:51 [LASTFM] StateChan: report complete 0.00000

@fuyu0425
Copy link
Contributor Author

你是用 mpd嗎?

@kylezb
Copy link
Member

kylezb commented Jul 13, 2023

我用的默认的的beep

@fuyu0425
Copy link
Contributor Author

Beep 沒問題,但播完居然 panic 了. 來測看看 osx

[LASTFM] Report: report phase complete d:219.893000 p:219.800000
圖片

@fuyu0425
Copy link
Contributor Author

2023/07/12 22:00:21 [LASTFM] Report: report phase complete d:332.733000 p:337.000000
osx 也沒問題 所以只有mpd有問題。

@fuyu0425 fuyu0425 changed the title Last.fm 上報錯誤 mpd Last.fm 上報錯誤 Jul 13, 2023
@kylezb
Copy link
Member

kylezb commented Jul 13, 2023

不应该啊,返回的都是Timer里的passed,这个和播放引擎应该是无关的,奇了怪了

@fuyu0425
Copy link
Contributor Author

mpd 裡邏輯不太一樣有個 SyncMpdStatus,channel 太多,不太確定順序。

@kylezb
Copy link
Member

kylezb commented Jul 13, 2023

召唤大佬 @anhoder

@anhoder
Copy link
Member

anhoder commented Jul 13, 2023

我晚上看下

imxyy1soope1 pushed a commit to imxyy1soope1/go-musicfox that referenced this issue Jul 14, 2023
imxyy1soope1 pushed a commit to imxyy1soope1/go-musicfox that referenced this issue Jul 14, 2023
imxyy1soope1 pushed a commit to imxyy1soope1/go-musicfox that referenced this issue Jul 14, 2023
anhoder added a commit that referenced this issue Jun 13, 2024
anhoder added a commit that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants