Closed naruko-hstk closed 3 years ago
@james10949 what do you mean with need to refresh again and again
? Localhost can be an issue depending on the platform/setup I suppose.
@JanDeDobbeleer I can confirm this is an issue for me as well, but my issue is it simply doesn't work at all -- I saw no need to refresh again and again
. Following the docs, I verified that I could hit the YTM endpoint myself with postman, and got back sensible JSON output that matches the structure in the segment.
Is there a way to get some logs out to figure out why the segment choked? I saw nothing apparent in the code short of running it locally, but I figured I'd ask.
{
"type": "ytm",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#FF0000",
"properties": {
"prefix": "\uF16A ",
"playing_icon": "\uE602 ",
"paused_icon": "\uF8E3 ",
"stopped_icon": "\uF04D ",
"track_separator" : " - ",
"api_url": "http://localhost:9863"
}
}
sample JSON output from endpoint:
{
"player": {
"hasSong": true,
"isPaused": false,
"volumePercent": 95,
"seekbarCurrentPosition": 4,
"seekbarCurrentPositionHuman": "0:04",
"statePercent": 0.011764705882352941,
"likeStatus": "INDIFFERENT",
"repeatType": "NONE"
},
"track": {
"author": "Future Islands",
"title": "The Fountain",
"album": "",
"cover": "https://lh3.googleusercontent.com/LhFwTM-OuArSvdc_Js33BlNkY6RYPMXibAkxjBm41XSrDLoKOqzhY_cfXvKITg7kKgK8k8ivTw5VD1pA=w544-h544-l90-rj",
"duration": 340,
"durationHuman": "5:40",
"url": "https://www.youtube.com/watch?list=RDAMPLOLAK5uy_k_1BYTjiI3oyaTWHkp8pfeyba2U5IlFYQ&v=BCShc8d-8Js",
"id": "BCShc8d-8Js",
"isVideo": false,
"isAdvertisement": false,
"inLibrary": false
}
}
@kimblesa it's too slow. If you look at the request timing it's 512ms. We stop at 20ms because the impact is too high. This was never an issue in the past so maybe something changed at YTDM.
After mocking the result with my own web app, can confirm it works fine when returning sub-20ms. I ran YTDM on two different machines, and the call never got anywhere near a 20ms response time. I will consider filing an issue with YTDM, and will write a simple app to cache the result from YTDM myself for now :) thanks for the prompt response.
@kimblesa for reference, this is on my machine (macOS, but also validated on Windows)
I was able to workaround the issue by specifying the loopback address: "api_url": "http://127.0.0.1:9863"
.
So perhaps a name resolution issue?
@tenicio that did the trick! It does appear that some part of my networking stack adds significant amount of latency, that I was able to avoid when hitting a simple caching app I was running on localhost. Thanks so much for the feedback.
I'll make sure to add the local ip by default.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
[Description of the bug or feature]
Environment
Steps to Reproduce
When I using YTM and api_url set
http://localhost:9863
it can't show status in YouTube Music Desktop App Only I sethttp://my-ip:9863
can use it and need to refresh again and again.Expected behavior: [What you expected to happen] Actual behavior: [What actually happened]