xuancong84 / pikaraoke

The World's best open-source Home Karaoke system (support searching/downloading from Youtube and DNN-AI-based vocal/nonvocal sound separation), multilingual and cross-platform
GNU General Public License v3.0
50 stars 6 forks source link

Adding any songs (local/ download), karaoke.py KeyError: 'window' #17

Closed reverdead closed 1 year ago

reverdead commented 1 year ago

Problem:

Getting KeyError: 'window' trace error message and no playback occurs.

Snippet Trace:

Getting the following trace error when trying to add any songs. It appears error occurs when pikaraoke is trying to queue load and auto play the song (affecting both local songs and downloaded songs)

Playing video in VLC: /mnt/USB/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.mp4 Traceback (most recent call last): File "/home/admin/apps/pikaraoke/app.py", line 965, in K.run() File "/home/admin/apps/pikaraoke/karaoke.py", line 1201, in run self.play_file(head['file']) File "/home/admin/apps/pikaraoke/karaoke.py", line 675, in play_file hex(pygame.display.get_wm_info()['window'])] KeyError: 'window'

Full Console Logging:

admin@koopa:~/apps/pikaraoke $ sudo python3 /home/admin/apps/pikaraoke/app.py -hq -nv -d /mnt/USB -l 50 pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html VLC command base: /usr/bin/cvlc --fullscreen --play-and-exit --extraintf http --http-port 5002 --http-password SMIwXjNJxq5XIhXaYepCZRginFVCM4So --no-embedded-video --no-keyboard-events --no-mouse-events --video-on-top --volume-save --no-video-title --no-loop --no-repeat --mouse-hide-timeout 0 --intf dummy [12/Aug/2023:15:12:12] ENGINE Bus STARTING [12/Aug/2023:15:12:12] ENGINE Bus STARTING [12/Aug/2023:15:12:12] ENGINE Started monitor thread '_TimeoutMonitor'. [12/Aug/2023:15:12:12] ENGINE Started monitor thread '_TimeoutMonitor'. [12/Aug/2023:15:12:12] ENGINE Serving on http://0.0.0.0:5000 [12/Aug/2023:15:12:12] ENGINE Serving on http://0.0.0.0:5000 [12/Aug/2023:15:12:12] ENGINE Bus STARTED [12/Aug/2023:15:12:12] ENGINE Bus STARTED Starting PiKaraoke! Downloading video: https://www.youtube.com/watch?v=7wtfhZwyrcc&pp=ygUPaW1hZ2luZSBkcmFnb25z Youtube-dl command: --fixup force --socket-timeout 3 -R infinite --remux-video mp4 -f bestvideo[height<=1080]+bestaudio[abr<=160] -o /mnt/USB/tmp/%(title)s---%(id)s.%(ext)s https://www.youtube.com/watch?v=7wtfhZwyrcc&pp=ygUPaW1hZ2luZSBkcmFnb25z [youtube] Extracting URL: https://www.youtube.com/watch?v=7wtfhZwyrcc&pp=ygUPaW1hZ2luZSBkcmFnb25z [youtube] 7wtfhZwyrcc: Downloading webpage [youtube] 7wtfhZwyrcc: Downloading ios player API JSON [youtube] 7wtfhZwyrcc: Downloading android player API JSON [youtube] 7wtfhZwyrcc: Downloading m3u8 information [info] 7wtfhZwyrcc: Downloading 1 format(s): 616+251 [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 43 [download] Destination: /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.f616.mp4 [download] 100% of 70.93MiB in 00:00:12 at 5.81MiB/s [download] Destination: /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.f251.webm [download] 100% of 3.36MiB in 00:00:00 at 10.53MiB/s [Merger] Merging formats into "/mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.webm" Deleting original file /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.f616.mp4 (pass -k to keep) Deleting original file /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.f251.webm (pass -k to keep) [VideoRemuxer] Remuxing video from webm to mp4; Destination: /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.mp4 Deleting original file /mnt/USB/tmp/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.webm (pass -k to keep) Fetching available songs in: /mnt/USB/ 'Ivan' is adding song to queue: /mnt/USB/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.mp4 Playing video in VLC: /mnt/USB/Imagine Dragons - Believer (Official Music Video)---7wtfhZwyrcc.mp4 Traceback (most recent call last): File "/home/admin/apps/pikaraoke/app.py", line 965, in K.run() File "/home/admin/apps/pikaraoke/karaoke.py", line 1201, in run self.play_file(head['file']) File "/home/admin/apps/pikaraoke/karaoke.py", line 675, in play_file hex(pygame.display.get_wm_info()['window'])] KeyError: 'window'

Screenshots of Behaviour/ Reproduce:

Home Screen at first launch (this is before loading any songs for playback):

image

If I happen to have the Home page loaded in a browser tab already, then I add a song (local or downloaded), it will correctly identify the Next Song:

image

But if I reload an existing page and or load any subsequent URL calls to the Home page will have no controls/ text:

image

If I reload the Home screen (F5), there's a brief period when the html control box and notification bar at the bottom will appear, before it vanishes and returns to the same screen with no controls/ text:

image

reverdead commented 1 year ago

Fixed. I removed the get_wm_info() call and application now runs along with the control box.

Before:

if self.platform != 'osx': extra_params1 += ['--drawable-hwnd' if self.platform == 'windows' else '--drawable-xid'], hex(pygame.display.get_wm_info()['window'])]

After:

if self.platform != 'osx': extra_params1 += ['--drawable-hwnd' if self.platform == 'windows' else '--drawable-xid']

I haven't noticed any issues to functionality with the removal.