mynttt / UpdateTool

A tool to update the IMDB ratings for Plex libraries that contain movies/series and use the IMDB agent to receive ratings
GNU General Public License v3.0
253 stars 12 forks source link

Tweak Plex custom URL encode #92

Closed burkasaurusrex closed 2 years ago

burkasaurusrex commented 2 years ago

https://github.com/mynttt/UpdateTool/blob/901ca070e4cd2acf3d9bd15eef674642f7550835/src/main/java/updatetool/common/ExtraData.java#L67-L75

I don't know Java that well, but I found the C# default URLencoder encodes = which turns out Plex does not like - it looks like = should be passed as-is. Also seems like / should be passed as %2F.

No idea why they did any of this ... I'll let you know if I find any others ...

mynttt commented 2 years ago

Hi,

at the time I wrote that code I verified that it works properly via this test case:

https://github.com/mynttt/UpdateTool/blob/ef82f5a9277389b6002f41dc7893870d3cb8fccb/src/test/java/URITest.java#L12

It takes this test data as input which I extracted from my own plex database:

https://github.com/mynttt/UpdateTool/blob/master/src/test/resources/uritestdata.txt

Upon running the code I found out how the Java implementation of URLEncoder and what Plex requires differ. The strange replaces behind it are just there to fix these imbalances so Plex causes no errors. In this case = is treated as = by the encoder here. / and %2F should also be treated correctly as else the test case would have produced an error.