gm-mediaplayer icon indicating copy to clipboard operation
gm-mediaplayer copied to clipboard

sh_metadata.lua - util.TableToJSON(media._metadata.extra) returns nil (table expected)

Open Physics-Dude opened this issue 2 years ago • 1 comments

Recent external issues now show an error when requesting any content from YouTube. Videos subsequently fail add/play:

[Media Player] lua/mediaplayer/sh_metadata.lua:149: bad argument #1 to 'TableToJSON' (table expected, got nil)
1. TableToJSON - [C]:-1
2. Save - lua/mediaplayer/sh_metadata.lua:149
3. onReceive - lua/mediaplayer/services/youtube/init.lua:104
4. unknown - lua/mediaplayer/services/base/init.lua:57 

Line refers to: string.format( "%s,", sql.SQLStr( util.TableToJSON(media._metadata.extra) ) ) .. media._metadata.extra is nil and not a table when requesting YouTube (or most other) content.

In my observation in a presently-running server's sv.db, with over 80k unique media requests logged by media player, has historically been a moot or empty entry except for the very rare SoundCloud requests. image

Physics-Dude avatar Jun 27 '23 02:06 Physics-Dude

This pull request populates this database entry with nil or "" to maintain parity with existing database sets. "util.TableToJSON(media._metadata.extra)" will no longer be called. Tested and seems to return YouTube functionality.

Request further testing with other media sources. I have a feeling SoundCloud has not and will not continue to work, though this might be a trivial problem.

https://github.com/samuelmaddock/gm-mediaplayer/pull/57

Physics-Dude avatar Jun 27 '23 02:06 Physics-Dude