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

[BUG] Simple Play example doesn't quit after playing finishes #200

Open
digfish opened this issue Jun 3, 2023 · 3 comments
Open

[BUG] Simple Play example doesn't quit after playing finishes #200

digfish opened this issue Jun 3, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@digfish
Copy link

digfish commented Jun 3, 2023

Describe the bug
Hi, I tried your library using a simple example

To Reproduce
Steps to reproduce the behavior:
On VS Code 1.78.2 i run The following snippet:

    zeroconf = ZeroconfServer.Builder().create()
    session = Session.Builder() \
        .user_pass("myusername", "mypassword") \
        .create()
    access_token = session.tokens().get("playlist-read")
    track_id = TrackId.from_uri("spotify:track:6UCFZ9ZOFRxK8oak7MdPZu")
    stream = session.content_feeder().load(track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, None)

    ffplay = subprocess.Popen(
        ["ffplay", "-autoexit", "-"],
        stdin=subprocess.PIPE,
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
    )

    ended = False
    while ended !=True:
        if ended : print("ended")
        bytes = stream.input_stream.stream().read(256)
        sent = ffplay.stdin.write(bytes)
        if sent == 0:
            logging.info("0 bytes sent!")
            ended = True

Expected behavior
FFplay pops out and starts playing the track until the end after that exits cleanly but the program is stuck. I'm only able to stop pressing the trash button to kill terminal pane on vscode or killing it manually in the task manager. Doesn't respond to Ctrl+C

Screenshots
Last lines of output:

DEBUG:Librespot:Session:Chunk 8/8 completed, cached: False, stream: file_id: 6dba450723dfdf967aa3740beeca4d73adde7bca
INFO:root:0 bytes sent!

Client Information (please complete the following information):

  • OS: Windows 10 22H2
  • Python Version miniconda v 3.10.4
  • Library Version 0.0.9

Additional context
Add any other context about the problem here.

@digfish digfish added the bug Something isn't working label Jun 3, 2023
@kokarare1212
Copy link
Owner

kokarare1212 commented Jun 3, 2023

I can't confirm such a phenomenon with Python 3.10.10 on Windows, though, I think it will end correctly if session.close() is executed at the end.

@digfish
Copy link
Author

digfish commented Jun 3, 2023 via email

@benearnthof
Copy link

Hi, I am currently facing the same problem on a windows machine when trying to stream audio from a list of URIs. Even after adding session.close() it leads to the error message. This does not impair my usage at this time since I'm only using the audiostream to extract a transcription but adds a lot of clutter to the console output & a bit of confusion on my part.

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