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

Some bug or error in YTM #639

Closed
2 tasks
naruko-hstk opened this issue Apr 12, 2021 · 9 comments
Closed
2 tasks

Some bug or error in YTM #639

naruko-hstk opened this issue Apr 12, 2021 · 9 comments
Labels
🏝 external The issue isn't with oh-my-posh

Comments

@naruko-hstk
Copy link

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

[Description of the bug or feature]

Environment

  • Oh my Posh version: 3.129.0
  • Theme: my-theme
  • Operating System: windows 10 pro
  • Shell: powershell
  • Terminal: windows terminal

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 set http://my-ip:9863 can use it and need to refresh again and again.

Expected behavior: [What you expected to happen]
image
Actual behavior: [What actually happened]

@JanDeDobbeleer
Copy link
Owner

@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 JanDeDobbeleer added the 🤔 info needed Further information is requested label Apr 12, 2021
@kimblesa
Copy link

kimblesa commented Apr 12, 2021

@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.

Environment

  • Oh my Posh version: 3.133.1
  • Theme: theme I wrote myself, but can repro issue with any theme and boilerplate YTM segment
  • Operating System: windows 10 pro
  • Shell: powershell 7
  • Terminal: windows terminal
{
  "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"
  }
}

2021-04-12 14_24_08-Postman

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
    }
}

@JanDeDobbeleer
Copy link
Owner

@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.

@kimblesa
Copy link

kimblesa commented Apr 12, 2021

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.

@JanDeDobbeleer
Copy link
Owner

@kimblesa for reference, this is on my machine (macOS, but also validated on Windows)

image

@JanDeDobbeleer JanDeDobbeleer added 🏝 external The issue isn't with oh-my-posh and removed 🤔 info needed Further information is requested labels Apr 14, 2021
@tenicio
Copy link

tenicio commented Apr 19, 2021

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?

@kimblesa
Copy link

kimblesa commented Apr 19, 2021

@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.

@JanDeDobbeleer
Copy link
Owner

I'll make sure to add the local ip by default.

JanDeDobbeleer added a commit that referenced this issue Apr 20, 2021
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🏝 external The issue isn't with oh-my-posh
Projects
None yet
Development

No branches or pull requests

4 participants