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] No audio playing #56

Open
A-wels opened this issue Jan 13, 2025 · 12 comments
Open

[BUG] No audio playing #56

A-wels opened this issue Jan 13, 2025 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@A-wels
Copy link

A-wels commented Jan 13, 2025

First of all: Thanks for creating this! I really love the idea ❤️

Describe the bug
The bot joins my audio channel after entering the play command. However, no audio is played. Log seems good.
The progress is synced with my audiobookshelf server.

I first played via https; then changed to direct http connection via ip in tailscale network. I also tried hosting the bot on the same server as audiobookshelf with local ip. All lead to the same issue.

To Reproduce

  1. Install via docker compose
  2. Add bot to Server (with Admin permissions)
  3. Play an audiobook

Expected behavior
The audiobook can be listened to

Logs

alex@Edoras:~/docker/audiobookshelfbot$ docker compose logs -f
bookshelf-traveller  | Bot is Starting Up! | Startup Time: 2025-01-13 18:27:25.872973+01:00
bookshelf-traveller  | Bot Invite Link: https://discord.com/oauth2/authorize?client_id=XXXXXXXXXXXXXX&permissions=277062405120&integration_type=0&scope=bot
bookshelf-traveller  |
bookshelf-traveller  |     =============================================================
bookshelf-traveller  |     |                                                           |
bookshelf-traveller  |     |        WELCOME TO BOOKSHELF-TRAVELLER                     |
bookshelf-traveller  |     |-----------------------------------------------------------|
bookshelf-traveller  |     |        Discover your next literary adventure!             |
bookshelf-traveller  |     |                                                           |
bookshelf-traveller  |     |        Version: V1.3.1                                   |
bookshelf-traveller  |     |        Author: DonKevlar                                  |
bookshelf-traveller  |     |-----------------------------------------------------------|
bookshelf-traveller  |     =============================================================
bookshelf-traveller  |
bookshelf-traveller  |
bookshelf-traveller  | INFO  - 17:27:25 : Starting up bookshelf traveller V1.3.1
bookshelf-traveller  | WARNING - 17:27:25 : Please wait for this process to finish prior to use, you have been warned!
bookshelf-traveller  | INFO  - 17:27:25 : Current config to follow!
bookshelf-traveller  | INFO  - 17:27:25 : Initialization MSGs Enabled: True
bookshelf-traveller  | INFO  - 17:27:25 : VERSION: V1.3.1
bookshelf-traveller  | INFO  - 17:27:25 : SERVER_URL: http://100.64.28.13:13378
bookshelf-traveller  | INFO  - 17:27:25 : OPT_IMAGE_URL: https://audiobookshelf.mydomain.com
bookshelf-traveller  | INFO  - 17:27:25 : TIMEZONE: Europe/Berlin
bookshelf-traveller  | INFO  - 17:27:25 : PLAYBACK_ROLE: 0
bookshelf-traveller  | INFO  - 17:27:25 : OWNER_ONLY: False
bookshelf-traveller  | INFO  - 17:27:25 : TASK_FREQUENCY: 5
bookshelf-traveller  | INFO  - 17:27:25 : AUDIO_ENABLED: True
bookshelf-traveller  | INFO  - 17:27:25 : MULTI_USER: True
bookshelf-traveller  | INFO  - 17:27:25 : Testing Server Connection
bookshelf-traveller  | INFO  - 17:27:25 : Connection Established!
bookshelf-traveller  | INFO  - 17:27:25 : Current Server Status = 200, Good to go!
bookshelf-traveller  | INFO  - 17:27:25 : Providing Auth Token to Server
bookshelf-traveller  | INFO  - 17:27:26 : Cleaning up, authentication
bookshelf-traveller  | INFO  - 17:27:26 : Logging user in and verifying role.
bookshelf-traveller  | INFO  - 17:27:26 : ABS user logged in as ADMIN with type: admin
bookshelf-traveller  | INFO  - 17:27:26 : Default Commands loaded!
bookshelf-traveller  | INFO  - 17:27:26 : Context Menus module loaded!
bookshelf-traveller  | INFO  - 17:27:26 : Subscribable Task module loaded!
bookshelf-traveller  | INFO  - 17:27:26 : Initializing wishlist table
bookshelf-traveller  | INFO  - 17:27:26 : Initializing tasks table
bookshelf-traveller  | INFO  - 17:27:26 : Wishlist module loaded!
bookshelf-traveller  | INFO  - 17:27:26 : Audio module loaded!
bookshelf-traveller  | INFO  - 17:27:26 : MULTI_USER module loaded!
bookshelf-traveller  | INFO  - 17:27:26 : Initializing Sqlite DB
bookshelf-traveller  | INFO  - 17:27:26 : Shard ID 0 | Starting Shard
bookshelf-traveller  | INFO  - 17:27:26 : Shard ID 0 | Shard is attempting to connect to gateway...
bookshelf-traveller  | INFO  - 17:27:27 : Shard ID 0 | Gateway connection established
bookshelf-traveller  | WARNING - 17:27:27 : Initialized subscription task module, verifying if any tasks are enabled...
bookshelf-traveller  | INFO  - 17:27:27 : Inserted: Alex with token and discord_id
bookshelf-traveller  | INFO  - 17:27:27 : Registered initial user Alex successfully
bookshelf-traveller  | INFO  - 17:27:28 : Bot has finished loading, it is now safe to use! :)
bookshelf-traveller  | INFO  - 17:27:32 : [{'name': 'Weit über der smaragdgrünen See | Brandon Sanderson', 'value': '1233325f-d8bf-4239-af38-93cc4eccd2d1'}, {'name': 'Shadows of Self - A Mistborn Novel - Mistborn - 5 | Brandon Sanderson', 'value': 'c4eecfe4-125f-4484-9260-92eefe5a3d6a'}]
bookshelf-traveller  | INFO  - 17:27:32 : Autocomplete Called: $play with event.ctx.focussed_option = SlashCommandOption() | event.ctx.kwargs = {'book': ''}
bookshelf-traveller  | INFO  - 17:27:35 : executing command /play
bookshelf-traveller  | INFO  - 17:27:36 : Media Type:  book, Current Time: 707.731 Seconds
bookshelf-traveller  | INFO  - 17:27:36 : attempting to play: http://100.64.28.13:13378/api/items/1233325f-d8bf-4239-af38-93cc4eccd2d1/file/648799826712189612
bookshelf-traveller  | INFO  - 17:27:36 : Providing Auth Token to Server
bookshelf-traveller  | INFO  - 17:27:36 : Cleaning up, authentication
bookshelf-traveller  | INFO  - 17:27:36 : Voice connection established; using xsalsa20_poly1305_lite
bookshelf-traveller  | INFO  - 17:27:37 : Beginning audio stream
bookshelf-traveller  | INFO  - 17:27:41 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 17:27:41 : Duration: 48211.56571700002, Current Time: 707.731, Updated Time: 712.731
bookshelf-traveller  | INFO  - 17:27:41 : session sync successful. 712.731
bookshelf-traveller  | INFO  - 17:27:41 : Successfully synced session to updated time: 712.731 | Current Playback Time: 5 Seconds | session ID: e7b664bc-9a32-4126-be9f-0db607e5e568
bookshelf-traveller  | INFO  - 17:27:42 : Current Chapter Sync: Kapitel 4
bookshelf-traveller  | INFO  - 17:27:46 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 17:27:46 : Duration: 48211.56571700002, Current Time: 712.731, Updated Time: 717.731
bookshelf-traveller  | INFO  - 17:27:46 : session sync successful. 717.731
bookshelf-traveller  | INFO  - 17:27:46 : Successfully synced session to updated time: 717.731 | Current Playback Time: 10 Seconds | session ID: e7b664bc-9a32-4126-be9f-0db607e5e568
bookshelf-traveller  | INFO  - 17:27:47 : Current Chapter Sync: Kapitel 4

Docker compose file

services:
  bookshelf-traveller:
    image: donkevlar/bookshelf-traveller:latest
    container_name: bookshelf-traveller
    environment:
      - DISCORD_TOKEN=XXXXXX
      - bookshelfToken=XXXXXXX
      - bookshelfURL=http://100.64.28.13:13378
      - TIMEZONE=Europe/Berlin
      - MULTI_USER=True
      - AUDIO_ENABLED=True
      - OPT_IMAGE_URL=https://audiobookshelf.mydomain.com
      - CLIENT_ID=XXXXXXXXXXXX
      - OWNER_ONLY=False
    restart: always  # Optional: ensures the container restarts on failure or system reboot

Do you need any more information?

Edit:
I have these Intents set:
grafik

I also invited the bot via the generated invite link and accepted all permissions, this did not work either.
Running in a python venv does also not work.

@A-wels A-wels added the bug Something isn't working label Jan 13, 2025
@donkevlar
Copy link
Owner

Hey, thank you! I created it for the lack of audiobook bots and Im happy you found some use out of it. From what Im seeing at a glance everything you have is correctly setup. Depending on your setup I have noticed that on windows (Docker) sometimes doesn't play right away or has an issue streaming even if the server is accessible. Ill do some testing and let you know if I can help :)

@donkevlar
Copy link
Owner

Still looking into this. What could help also, is if you could turn on DEBUG_MODE=True in your env variables and take a screenshot of that.

@A-wels
Copy link
Author

A-wels commented Jan 14, 2025

Thanks for your answer! I started building a bot myself last year and quicly quit due to the requried effort... So hats off to you!

I can't access my server right now, so the screenshot will follow.

The issue occured for me on the following setups

  • Ubuntu server with docker
  • WSL with python
  • WSL witch docker
  • Unraid with docker
    I tried playing the audiobook for ~3 Minutes.

When debugging, I found the used url for streaming, which worked when loading it manually via my browser.

@A-wels
Copy link
Author

A-wels commented Jan 14, 2025

Here are some logs. I'm not sure what the issue is. If you need access to my audiobookshelf instance/discord bot I'd be glad to provide it. (Always a great idea ;) )

bookshelf-traveller  | Bot is Starting Up! | Startup Time: 2025-01-14 11:10:32.991103+01:00
bookshelf-traveller  | Bot Invite Link: https://discord.com/oauth2/authorize?client_id=XXXXXXXXX&permissions=277062405120&integration_type=0&scope=bot
bookshelf-traveller  |
bookshelf-traveller  |     =============================================================
bookshelf-traveller  |     |                                                           |
bookshelf-traveller  |     |        WELCOME TO BOOKSHELF-TRAVELLER                     |
bookshelf-traveller  |     |-----------------------------------------------------------|
bookshelf-traveller  |     |        Discover your next literary adventure!             |
bookshelf-traveller  |     |                                                           |
bookshelf-traveller  |     |        Version: V1.3.1                                   |
bookshelf-traveller  |     |        Author: DonKevlar                                  |
bookshelf-traveller  |     |-----------------------------------------------------------|
bookshelf-traveller  |     =============================================================
bookshelf-traveller  |
bookshelf-traveller  |
bookshelf-traveller  | INFO  - 10:10:32 : Starting up bookshelf traveller V1.3.1
bookshelf-traveller  | WARNING - 10:10:32 : Please wait for this process to finish prior to use, you have been warned!
bookshelf-traveller  | INFO  - 10:10:32 : Current config to follow!
bookshelf-traveller  | INFO  - 10:10:32 : Initialization MSGs Enabled: True
bookshelf-traveller  | INFO  - 10:10:32 : VERSION: V1.3.1
bookshelf-traveller  | INFO  - 10:10:32 : SERVER_URL: http://100.64.28.13:13378
bookshelf-traveller  | INFO  - 10:10:32 : OPT_IMAGE_URL: https://XXXXX.XXXXXXX.de
bookshelf-traveller  | INFO  - 10:10:32 : TIMEZONE: Europe/Berlin
bookshelf-traveller  | INFO  - 10:10:32 : PLAYBACK_ROLE: 0
bookshelf-traveller  | INFO  - 10:10:32 : OWNER_ONLY: False
bookshelf-traveller  | INFO  - 10:10:32 : TASK_FREQUENCY: 5
bookshelf-traveller  | INFO  - 10:10:32 : AUDIO_ENABLED: True
bookshelf-traveller  | INFO  - 10:10:32 : MULTI_USER: True
bookshelf-traveller  | INFO  - 10:10:32 : Testing Server Connection
bookshelf-traveller  | INFO  - 10:10:33 : Connection Established!
bookshelf-traveller  | INFO  - 10:10:33 : Current Server Status = 200, Good to go!
bookshelf-traveller  | DEBUG - 10:10:33 : Running client sanity checks...
bookshelf-traveller  | INFO  - 10:10:33 : Providing Auth Token to Server
bookshelf-traveller  | INFO  - 10:10:33 : Cleaning up, authentication
bookshelf-traveller  | INFO  - 10:10:33 : Logging user in and verifying role.
bookshelf-traveller  | INFO  - 10:10:33 : ABS user logged in as ADMIN with type: admin
bookshelf-traveller  | INFO  - 10:10:33 : Default Commands loaded!
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in default_commands
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class PrimaryCommands in default_commands: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.all_library_items
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.ping
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.search_book
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.search_media_progress
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.setup_default_commands
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.show_all_libraries
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.show_recent_sessions
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: PrimaryCommands.totalTime
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: default_commands
bookshelf-traveller  | INFO  - 10:10:33 : Context Menus module loaded!
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in context-menus
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class ContextMenus in context-menus: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: ContextMenus.repeat
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: context-menus
bookshelf-traveller  | INFO  - 10:10:33 : Subscribable Task module loaded!
bookshelf-traveller  | INFO  - 10:10:33 : Initializing wishlist table
bookshelf-traveller  | INFO  - 10:10:33 : Initializing tasks table
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in subscription_task
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class SubscriptionTask in subscription_task: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: SubscriptionTask.active_tasks_command
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: SubscriptionTask.newBookCheck
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: SubscriptionTask.remove_task_command
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: SubscriptionTask.task_setup
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: subscription_task
bookshelf-traveller  | INFO  - 10:10:33 : Wishlist module loaded!
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in wishlist
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class WishList in wishlist: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.add_book_command
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.cancel_button_callback
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.on_search_menu_select
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.remove_book_command
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.request_button_callback
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.view_all_wishlists
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: WishList.view_wishlist
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: wishlist
bookshelf-traveller  | INFO  - 10:10:33 : Audio module loaded!
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in audio
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class AudioPlayBack in audio: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_forward_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_next_chapter_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_pause_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_play_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_previous_chapter_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_rewind_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_stop_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_volume_down_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.callback_volume_up_button
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.change_chapter
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.close_active_sessions
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.pause_audio
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.play_audio
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.refresh_play_card
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.resume_audio
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.stop_audio
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: AudioPlayBack.volume_adjuster
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: audio
bookshelf-traveller  | INFO  - 10:10:33 : MULTI_USER module loaded!
bookshelf-traveller  | INFO  - 10:10:33 : Initializing Sqlite DB
bookshelf-traveller  | DEBUG - 10:10:33 : No setup function found in multi_user
bookshelf-traveller  | DEBUG - 10:10:33 : Found extension class MultiUser in multi_user: Attempting to load
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: MultiUser.remove_db_user
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: MultiUser.user_check
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: MultiUser.user_login
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: MultiUser.user_select_db
bookshelf-traveller  | DEBUG - 10:10:33 : Loaded Extension: multi_user
bookshelf-traveller  | DEBUG - 10:10:33 : Altering default database columns
bookshelf-traveller  | DEBUG - 10:10:33 : Error occured while attempting to alter original databases
bookshelf-traveller  | DEBUG - 10:10:33 : duplicate column name: downloaded
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_startup
bookshelf-traveller  | DEBUG - 10:10:33 : 1 callbacks have been loaded from __main__.
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: _disconnect
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: _on_websocket_ready
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_autocomplete_completion
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_autocomplete_error
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_command_completion
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_command_error
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_component_completion
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_component_error
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_error
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_modal_completion
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_modal_error
bookshelf-traveller  | DEBUG - 10:10:33 : Added callback: on_resume
bookshelf-traveller  | DEBUG - 10:10:33 : 12 callbacks have been loaded from Client.
bookshelf-traveller  | DEBUG - 10:10:33 : Attempting to login
bookshelf-traveller  | DEBUG - 10:10:33 : Caching ingested rate limit data for: 78bb8553d9352a5a2f89f9def401287a
bookshelf-traveller  | DEBUG - 10:10:33 : GET /users/@me Received 200 :: [999/1000 calls remaining]
bookshelf-traveller  | DEBUG - 10:10:33 : Caching ingested rate limit data for: d28a133af187e91d71d96a223467ce49
bookshelf-traveller  | DEBUG - 10:10:33 : GET /oauth2/applications/@me Received 200 :: [999/1000 calls remaining]
bookshelf-traveller  | DEBUG - 10:10:33 : GET /gateway Received 200 :: [1/1 calls remaining]
bookshelf-traveller  | INFO  - 10:10:33 : Shard ID 0 | Starting Shard
bookshelf-traveller  | INFO  - 10:10:33 : Shard ID 0 | Shard is attempting to connect to gateway...
bookshelf-traveller  | DEBUG - 10:10:33 : Shard ID 0 | Identification payload sent to gateway, requesting intents: 53706493
bookshelf-traveller  | INFO  - 10:10:34 : Shard ID 0 | Gateway connection established
bookshelf-traveller  | DEBUG - 10:10:34 : Shard ID 0 | Session ID: 622d5427cb9b630c14dd824842971ce2 Trace: ['["gateway-prd-us-east1-d-n28j",{"micros":163476,"calls":["id_created",{"micros":856,"calls":[]},"session_lookup_time",{"micros":244,"calls":[]},"session_lookup_finished",{"micros":13,"calls":[]},"discord-sessions-prd-1-285",{"micros":162093,"calls":["start_session",{"micros":85394,"calls":["discord-api-rpc-659f97d6b5-7hszv",{"micros":82280,"calls":["get_user",{"micros":4733},"get_guilds",{"micros":26713},"send_scheduled_deletion_message",{"micros":4},"guild_join_requests",{"micros":0},"authorized_ip_coro",{"micros":1}]}]},"starting_guild_connect",{"micros":81,"calls":[]},"presence_started",{"micros":41975,"calls":[]},"guilds_started",{"micros":89,"calls":[]},"lobbies_started",{"micros":1,"calls":[]},"guilds_connect",{"micros":1,"calls":[]},"presence_connect",{"micros":34506,"calls":[]},"connect_finished",{"micros":34511,"calls":[]},"build_ready",{"micros":38,"calls":[]},"clean_ready",{"micros":1,"calls":[]},"optimize_ready",{"micros":1,"calls":[]},"split_ready",{"micros":0,"calls":[]}]}]}]']
bookshelf-traveller  | DEBUG - 10:10:34 : Dispatching Event: websocket_ready
bookshelf-traveller  | DEBUG - 10:10:34 : Caching ingested rate limit data for: dd84d9818020c27975c0d5ab4a794d44
bookshelf-traveller  | DEBUG - 10:10:34 : GET /applications/{application_id}/commands Received 200 :: [999/1000 calls remaining]
bookshelf-traveller  | DEBUG - 10:10:34 : Caching ingested rate limit data for: dd84d9818020c27975c0d5ab4a794d44
bookshelf-traveller  | DEBUG - 10:10:34 : GET /applications/{application_id}/commands Received 200 :: [999/1000 calls remaining]
bookshelf-traveller  | DEBUG - 10:10:34 : 0 is already up-to-date with 29 commands.
bookshelf-traveller  | DEBUG - 10:10:34 : Sync of 1 scopes took 0.4483552468009293 seconds
bookshelf-traveller  | DEBUG - 10:10:34 : Dispatching Event: startup
bookshelf-traveller  | WARNING - 10:10:34 : Initialized subscription task module, verifying if any tasks are enabled...
bookshelf-traveller  | WARNING - 10:10:34 : Failed to insert: Alex. User or token already exists.
bookshelf-traveller  | INFO  - 10:10:34 : Registered initial user Alex successfully
bookshelf-traveller  | INFO  - 10:10:34 : Bot has finished loading, it is now safe to use! :)
bookshelf-traveller  | DEBUG - 10:10:48 : Sending heartbeat every 41.25 seconds
bookshelf-traveller  | DEBUG - 10:10:48 : Sending data to websocket: {"op": 1, "d": 2}
bookshelf-traveller  | DEBUG - 10:10:48 : Shard ID 0 | ❤ Gateway is sending a Heartbeat
bookshelf-traveller  | DEBUG - 10:10:48 : Shard ID 0 | ❤ Received heartbeat acknowledgement from gateway
bookshelf-traveller  | DEBUG - 10:10:49 : 1328410953427062798::play should be called
bookshelf-traveller  | DEBUG - 10:10:50 : Caching ingested rate limit data for: 432f6223265d156004ac81366c5a948f
bookshelf-traveller  | DEBUG - 10:10:50 : POST /interactions/{interaction_id}/aW50ZXJhY3Rpb246MTMyODY2NzYzNDcwMjYxODYzNDoyWTFmZHZSSTR1eTRUQXc3Ukh3eDF6S2NwbDNFOGc4azM0REJIM2pOd25ZU1hHNW5JdnBtR3J5ZHBldXFtSkhBR3dvNGF2eDNwOXZxZjJUSDJKcHlFdVhtRXRzVlREbzNmQ2lhejZUWG5Mb0Vob2dwSlFoVVV3N2xnMzN1dTFKSA/callback Received 204 :: [4/5 calls remaining]
bookshelf-traveller  | INFO  - 10:10:50 : [{'name': 'Shadows of Self - A Mistborn Novel - Mistborn - 5 | Brandon Sanderson', 'value': 'c4eecfe4-125f-4484-9260-92eefe5a3d6a'}, {'name': 'Weit über der smaragdgrünen See | Brandon Sanderson', 'value': '1233325f-d8bf-4239-af38-93cc4eccd2d1'}, {'name': 'Drehbuch der Täuschung | André Minninger, Hendrik Buchna', 'value': '111964b7-2b65-4bd8-8623-aa7c578f6515'}]
bookshelf-traveller  | DEBUG - 10:10:50 : Dispatching Event: autocomplete_completion
bookshelf-traveller  | INFO  - 10:10:50 : Autocomplete Called: $play with event.ctx.focussed_option = SlashCommandOption() | event.ctx.kwargs = {'book': ''}
bookshelf-traveller  | DEBUG - 10:10:54 : 1328410953427062798::play should be called
bookshelf-traveller  | INFO  - 10:10:54 : executing command /play
bookshelf-traveller  | INFO  - 10:10:54 : Media Type:  book, Current Time: 1834.976 Seconds
bookshelf-traveller  | INFO  - 10:10:54 : attempting to play: http://100.64.28.13:13378/api/items/1233325f-d8bf-4239-af38-93cc4eccd2d1/file/648799826712189612
bookshelf-traveller  | INFO  - 10:10:54 : Providing Auth Token to Server
bookshelf-traveller  | INFO  - 10:10:54 : Cleaning up, authentication
bookshelf-traveller  | DEBUG - 10:10:54 : Sending data to websocket: {"op": 4, "d": {"guild_id": 1328417768214630422, "channel_id": 1328417768705491040, "self_mute": false, "self_deaf": false}}
bookshelf-traveller  | DEBUG - 10:10:54 : Waiting for voice connection data...
bookshelf-traveller  | DEBUG - 10:10:54 : Attempting to initialise voice gateway...
bookshelf-traveller  | DEBUG - 10:10:55 : Voice Connection has identified itself to Voice Gateway
bookshelf-traveller  | DEBUG - 10:10:55 : Discord send VC Ready! Establishing a socket connection...
bookshelf-traveller  | DEBUG - 10:10:55 : IP Discovery in progress...
bookshelf-traveller  | DEBUG - 10:10:55 : Voice Initial Response Received: b'\x00\x02\x00F\x00\x0b\x18\x14XXXXXXXXXXXXXXXX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac='
bookshelf-traveller  | DEBUG - 10:10:55 : IP Discovered: XXXXXXXXXXXXXXXX #44093
bookshelf-traveller  | DEBUG - 10:10:55 : Sending data to websocket: {"op": 1, "d": {"protocol": "udp", "data": {"address": "XXXXXXXXXXXXXXXX", "port": 44093, "mode": "xsalsa20_poly1305_lite"}}}
bookshelf-traveller  | DEBUG - 10:10:55 : Starting UDP Keep Alive
bookshelf-traveller  | DEBUG - 10:10:55 : Unhandled OPCODE: 11 = data = {'user_ids': ['128102408848015360']}
bookshelf-traveller  | DEBUG - 10:10:55 : Unhandled OPCODE: 18 = data = {'user_id': '128102408848015360', 'flags': 2}
bookshelf-traveller  | DEBUG - 10:10:55 : Unhandled OPCODE: 20 = data = {'user_id': '128102408848015360', 'platform': 0}
bookshelf-traveller  | INFO  - 10:10:55 : Voice connection established; using xsalsa20_poly1305_lite
bookshelf-traveller  | DEBUG - 10:10:55 : Caching ingested rate limit data for: 432f6223265d156004ac81366c5a948f
bookshelf-traveller  | DEBUG - 10:10:55 : POST /interactions/{interaction_id}/aW50ZXJhY3Rpb246MTMyODY2NzY1Mzk3OTc3MDkwNDpCQ2RJS3ZEVDRrVXRpOFNWOHNzTTRXdXhZd0RyaWd0aUQ1TUYyYjRZUmZtVG55akJXSnhDVXdPZmFLUDZpR3VSQkRCWHIyMGREam93UUxsczB6WnNBSEQzUzJwQzg3MGVaYW5vaXByYVlEeURKWDZsaTh3Z1JsdktTQkdNY0twcQ/callback Received 204 :: [4/5 calls remaining]
bookshelf-traveller  | DEBUG - 10:10:55 : Caching ingested rate limit data for: 3d2712a9e4fe17cc9d3fed4a8e672e5f
bookshelf-traveller  | DEBUG - 10:10:55 : PATCH /webhooks/{application_id}/aW50ZXJhY3Rpb246MTMyODY2NzY1Mzk3OTc3MDkwNDpCQ2RJS3ZEVDRrVXRpOFNWOHNzTTRXdXhZd0RyaWd0aUQ1TUYyYjRZUmZtVG55akJXSnhDVXdPZmFLUDZpR3VSQkRCWHIyMGREam93UUxsczB6WnNBSEQzUzJwQzg3MGVaYW5vaXByYVlEeURKWDZsaTh3Z1JsdktTQkdNY0twcQ/messages/{message_id} Received 200 :: [4/5 calls remaining]
bookshelf-traveller  | INFO  - 10:10:55 : Beginning audio stream
bookshelf-traveller  | DEBUG - 10:10:55 : Sending data to websocket: {"op": 3, "d": {"since": 1736849455604, "activities": [{"name": "Weit \u00fcber der smaragdgr\u00fcnen See", "type": 2}], "status": "online", "afk": false}}
bookshelf-traveller  | DEBUG - 10:10:55 : Detected ffmpeg version: 5.1.6-0+deb12u1
bookshelf-traveller  | DEBUG - 10:10:55 : Now playing <AudioVolume: http://100.64.28.13:13378/api/items/1233325f-d8bf-4239-af38-93cc4eccd2d1/file/648799826712189612?token=XXXXX>
bookshelf-traveller  | INFO  - 10:11:00 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:00 : Duration: 48211.56571700002, Current Time: 1834.976, Updated Time: 1839.976
bookshelf-traveller  | INFO  - 10:11:00 : session sync successful. 1839.976
bookshelf-traveller  | INFO  - 10:11:00 : Successfully synced session to updated time: 1839.976 | Current Playback Time: 5 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:00 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | DEBUG - 10:11:01 : Sending heartbeat every 13.75 seconds
bookshelf-traveller  | DEBUG - 10:11:01 : Sending data to websocket: {"op": 3, "d": 18359002099684562482}
bookshelf-traveller  | DEBUG - 10:11:01 : ❤ Voice Connection is sending Heartbeat
bookshelf-traveller  | DEBUG - 10:11:01 : ❤ Heartbeat acknowledged after 0.01522 seconds
bookshelf-traveller  | INFO  - 10:11:05 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:05 : Duration: 48211.56571700002, Current Time: 1839.976, Updated Time: 1844.976
bookshelf-traveller  | INFO  - 10:11:05 : session sync successful. 1844.976
bookshelf-traveller  | INFO  - 10:11:05 : Successfully synced session to updated time: 1844.976 | Current Playback Time: 10 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:05 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:10 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:10 : Duration: 48211.56571700002, Current Time: 1844.976, Updated Time: 1849.976
bookshelf-traveller  | INFO  - 10:11:10 : session sync successful. 1849.976
bookshelf-traveller  | INFO  - 10:11:10 : Successfully synced session to updated time: 1849.976 | Current Playback Time: 15 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:10 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:15 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:15 : Duration: 48211.56571700002, Current Time: 1849.976, Updated Time: 1854.976
bookshelf-traveller  | INFO  - 10:11:15 : session sync successful. 1854.976
bookshelf-traveller  | INFO  - 10:11:15 : Successfully synced session to updated time: 1854.976 | Current Playback Time: 20 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | DEBUG - 10:11:15 : Sending data to websocket: {"op": 3, "d": 11688905947996772300}
bookshelf-traveller  | DEBUG - 10:11:15 : ❤ Voice Connection is sending Heartbeat
bookshelf-traveller  | DEBUG - 10:11:15 : ❤ Heartbeat acknowledged after 0.03707 seconds
bookshelf-traveller  | INFO  - 10:11:15 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:20 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:20 : Duration: 48211.56571700002, Current Time: 1854.976, Updated Time: 1859.976
bookshelf-traveller  | INFO  - 10:11:20 : session sync successful. 1859.976
bookshelf-traveller  | INFO  - 10:11:20 : Successfully synced session to updated time: 1859.976 | Current Playback Time: 25 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:20 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:25 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:25 : Duration: 48211.56571700002, Current Time: 1859.976, Updated Time: 1864.976
bookshelf-traveller  | INFO  - 10:11:25 : session sync successful. 1864.976
bookshelf-traveller  | INFO  - 10:11:25 : Successfully synced session to updated time: 1864.976 | Current Playback Time: 30 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:25 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | DEBUG - 10:11:29 : Sending data to websocket: {"op": 3, "d": 4378798007021005818}
bookshelf-traveller  | DEBUG - 10:11:29 : ❤ Voice Connection is sending Heartbeat
bookshelf-traveller  | DEBUG - 10:11:29 : ❤ Heartbeat acknowledged after 0.02973 seconds
bookshelf-traveller  | INFO  - 10:11:30 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | DEBUG - 10:11:30 : Sending data to websocket: {"op": 1, "d": 8}
bookshelf-traveller  | DEBUG - 10:11:30 : Shard ID 0 | ❤ Gateway is sending a Heartbeat
bookshelf-traveller  | DEBUG - 10:11:30 : Shard ID 0 | ❤ Received heartbeat acknowledgement from gateway
bookshelf-traveller  | INFO  - 10:11:30 : Duration: 48211.56571700002, Current Time: 1864.976, Updated Time: 1869.976
bookshelf-traveller  | INFO  - 10:11:30 : session sync successful. 1869.976
bookshelf-traveller  | INFO  - 10:11:30 : Successfully synced session to updated time: 1869.976 | Current Playback Time: 35 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:30 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:35 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:35 : Duration: 48211.56571700002, Current Time: 1869.976, Updated Time: 1874.976
bookshelf-traveller  | INFO  - 10:11:35 : session sync successful. 1874.976
bookshelf-traveller  | INFO  - 10:11:35 : Successfully synced session to updated time: 1874.976 | Current Playback Time: 40 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:35 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:40 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:40 : Duration: 48211.56571700002, Current Time: 1874.976, Updated Time: 1879.976
bookshelf-traveller  | INFO  - 10:11:40 : session sync successful. 1879.976
bookshelf-traveller  | INFO  - 10:11:40 : Successfully synced session to updated time: 1879.976 | Current Playback Time: 45 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:40 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | DEBUG - 10:11:42 : Sending data to websocket: {"op": 3, "d": 1732300639478718388}
bookshelf-traveller  | DEBUG - 10:11:42 : ❤ Voice Connection is sending Heartbeat
bookshelf-traveller  | DEBUG - 10:11:42 : ❤ Heartbeat acknowledged after 0.01758 seconds
bookshelf-traveller  | INFO  - 10:11:45 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:45 : Duration: 48211.56571700002, Current Time: 1879.976, Updated Time: 1884.976
bookshelf-traveller  | INFO  - 10:11:45 : session sync successful. 1884.976
bookshelf-traveller  | INFO  - 10:11:45 : Successfully synced session to updated time: 1884.976 | Current Playback Time: 50 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:45 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:50 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:50 : Duration: 48211.56571700002, Current Time: 1884.976, Updated Time: 1889.976
bookshelf-traveller  | INFO  - 10:11:50 : session sync successful. 1889.976
bookshelf-traveller  | INFO  - 10:11:50 : Successfully synced session to updated time: 1889.976 | Current Playback Time: 55 Seconds | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:50 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | INFO  - 10:11:55 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:11:55 : Duration: 48211.56571700002, Current Time: 1889.976, Updated Time: 1894.976
bookshelf-traveller  | INFO  - 10:11:55 : session sync successful. 1894.976
bookshelf-traveller  | INFO  - 10:11:55 : Successfully synced session to updated time: 1894.976 | Current Playback Time: 1.0 Minutes | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:11:55 : Current Chapter Sync: Kapitel 9
bookshelf-traveller  | DEBUG - 10:11:56 : Sending data to websocket: {"op": 3, "d": 16172622109677386414}
bookshelf-traveller  | DEBUG - 10:11:56 : ❤ Voice Connection is sending Heartbeat
bookshelf-traveller  | DEBUG - 10:11:56 : ❤ Heartbeat acknowledged after 0.01553 seconds
bookshelf-traveller  | INFO  - 10:12:00 : Initializing Session Sync, current refresh rate set to: 5 seconds
bookshelf-traveller  | INFO  - 10:12:00 : Duration: 48211.56571700002, Current Time: 1894.976, Updated Time: 1899.976
bookshelf-traveller  | INFO  - 10:12:00 : session sync successful. 1899.976
bookshelf-traveller  | INFO  - 10:12:00 : Successfully synced session to updated time: 1899.976 | Current Playback Time: 1.08 Minutes | session ID: 912c54c7-9abb-41c7-9e2d-80a3928acb02
bookshelf-traveller  | INFO  - 10:12:00 : Current Chapter Sync: Kapitel 9

@A-wels
Copy link
Author

A-wels commented Jan 14, 2025

I used a small bot that just plays a local mp3 file to check if I have correct permissions. The bot is able to play the mp3 file correctly!

@donkevlar
Copy link
Owner

Looking at your logs, everything is working correctly and you have no errors, also the fact that the web browser was playing from the URL is a great sign that your connection and token were both valid and everything (should have) worked. Do the other commands work as intended? One thing maybe to try, is change "OWNER_ONLY" to True. It may be affecting something that's related to an old module I disabled. The only other suggestion I have is try to restart discord while the bot and you are connected to discord by using ctrl and r.

@A-wels
Copy link
Author

A-wels commented Jan 16, 2025

I tried playing with the OWNER_ONLY and multiuser variables. However, these seem to not change anything.

However, I managed to play an audiobook! It seems, that the issue lies in the 'format' of audiobooks.
Single .m4b files seem to play just fine!
When trying to play Audiobooks stored as a single .mp3 file I get an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/interactions/client/client.py", line 2018, in __dispatch_interaction
    response = await callback
               ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/interactions/client/client.py", line 1886, in _run_slash_command
    return await command(ctx, **ctx.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/interactions/models/internal/command.py", line 132, in __call__
    await self.call_callback(self.callback, context)
  File "/usr/local/lib/python3.13/site-packages/interactions/models/internal/application_commands.py", line 875, in call_callback
    return await self.call_with_binding(callback, ctx, *new_args, **new_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/interactions/models/internal/callback.py", line 44, in call_with_binding
    return await callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ABSBOT/audio.py", line 418, in play_audio
    current_chapter, chapter_array, bookFinished, isPodcast = await c.bookshelf_get_current_chapter(item_id=book)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object

When trying to play an audiobook consisting of multiple .mp3 files, the indicated progress is correct, but a wrong audio file is played. The audiobooks I did my testing with earlier all have a silent part in the end, which seems to have played...

@donkevlar
Copy link
Owner

That would explain it! I believe my library is 99% m4b files. Although I have tested with some mp3 files in the beginning I may need to change some ffmpeg parameters.

@donkevlar
Copy link
Owner

Also, regarding your logs, the error that is being thrown is because there was no chapter data able to be pulled. This has given me lots of edge cases to think about! Lol

@A-wels
Copy link
Author

A-wels commented Jan 16, 2025

In bookshelfAPI.py, line 702-703

    for file in audiofiles:
        ino = file['ino']

The last mp3 file is selected for play. Thats why it always jumps to the end. Do you have time to look into this or should I try my hand? I'm currently pretty busy myself :/

Edit: I guess for now, I will simply use the Audiobookshelf tool to convert my audiobooks to m4b files.

@donkevlar
Copy link
Owner

In bookshelfAPI.py, line 702-703

for file in audiofiles:
    ino = file['ino']

The last mp3 file is selected for play. Thats why it always jumps to the end. Do you have time to look into this or should I try my hand? I'm currently pretty busy myself :/

Edit: I guess for now, I will simply use the Audiobookshelf tool to convert my audiobooks to m4b files.

I've been trying to crack at this but haven't had a chance to fix this fully. I need to revamp the whole chapter select system and audio tracking portion which is not a small task. I have made small improvements but not gonna push that just yet because I'd like it to fully incorporate a fix for this and a few other scenarios. :)

@A-wels
Copy link
Author

A-wels commented Jan 30, 2025

I've also had a look at this and came to a similar conclusion. Did not have the time to fix anything though :/

Take your time! I've converted everything to m4b and your bot is working great with those. Thanks a lot again :)

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

2 participants