Giter VIP home page Giter VIP logo

Comments (11)

Sophist-UK avatar Sophist-UK commented on August 25, 2024

Please feel free to submit a PR to fix this.

from picard-plugins.

PeterCodar avatar PeterCodar commented on August 25, 2024

If I could code that in Python, I would do that...

from picard-plugins.

Sophist-UK avatar Sophist-UK commented on August 25, 2024

The Paper CD case code does not e.g. convert Träne to Träne - that appears to be done by the python webbrowser functionality.

If you can provide an example Release MBID then I will see what I can do to fix this.

from picard-plugins.

Sophist-UK avatar Sophist-UK commented on August 25, 2024

Actually I don't think that Tr%26auml;ne will work either as my testing suggests that the ne gets dropped. Instead based on creating a test using the papercdcase form suggests that it should be Tr%E4ne.

A look at the code suggests that this is a combination of using QUrl.toString and webbrowser.open - perhaps we should be using QUrl.toEncoded instead.

I will need to run some tests to see what works - please provide an example Album MBID that I can use for testing and I will see what I can do about this.

from picard-plugins.

Sophist-UK avatar Sophist-UK commented on August 25, 2024

Also I need to know whether you are using Picard 1.4.x or Picard 2.0.x

from picard-plugins.

PeterCodar avatar PeterCodar commented on August 25, 2024

I'm using Picard 1.4.2 and an example MBID is: https://musicbrainz.org/release/b5a959e6-8192-42f2-9a8b-ac5393d5c500

If I replace the part &track2=Keni%20Träne%20Meh in the URL for the above album to &track2=Keni%20Tr%26auml;ne%20Meh the text "Keni Träne Meh" will bi displayed correctly in the paper cd case-form.

The complete URL actually looks like:
http://papercdcase.com/advanced.php?artist=&title=Unmatched%20Files&track1=Indianer&track2=Keni%20Tr%26auml;ne%20Meh&track3=B%C3%BCetzer&track4=Ohni%20Di&track5=I%20h%C3%A4t%20No%20Viu%20bl%C3%B6der%20Ta&track6=Vatter&track7=Uf%20U%20Dervo&track8=Hingedri&track9=Schwan&track10=Grossp%C3%A8re&track11=Fl%C3%BCgu&track12=Zyt%20Zum%20Danke

The original URL is converted here on GitHub automatically (using Google Chrome on Windows 10). The vowels are directly visible as ä ö ü and not as %C3%A4 or %C3%B6
....&track3=Büetzer&track4=Ohni%20Di&track5=I%20hät%20No%20Viu%20blöder%20Ta....

from picard-plugins.

phw avatar phw commented on August 25, 2024

I am sure I tested this back then, but might be I could not fine a solution. The HTML escpaing trick works, even if it is pretty unusual. But papercdcase just cannot deal with Unicode values passed in the URL, and as long as this workaround does the trick we should use it. Thanks for finding this.

Just have to figure out how to most elegantly do the HTML conversion. Unfortunately Python's html.escpape is of no use here since it only escapes the absolutely necessary (&, <, >)

I used this for testing: https://musicbrainz.org/release/5f4488c6-fc10-4129-b319-63c86754efa0

@Sophist-UK

Actually I don't think that Tr%26auml;ne will work either as my testing suggests that the ne gets dropped. Instead based on creating a test using the papercdcase form suggests that it should be Tr%E4ne.

The HTML entity approach worked for me. While %E4 would also work, this involves encoding the string to ISO-8859-1, as this is the encoding the site uses. But with the HTML entitiy approach you can also pass characters outside of this encdoing, e.g. this works for passing Japanese characters: http://papercdcase.com/advanced.php?artist=%26%23x65E5;%26%23x672C;%26%23x8A9E;

from picard-plugins.

Sophist-UK avatar Sophist-UK commented on August 25, 2024

I have made several attempts to find a way of making this work and failed completely.

urllib.urlencode or urllib.quote_plus just crash the plugin without an error message, and cgi.escape doesn't handle any but the most basic HTML entities.

Sorry.

from picard-plugins.

phw avatar phw commented on August 25, 2024

So I added some code to handle this, see #149 and #150 . I went with the urlencode instead, that's cleaner. Passing HTML entities is actually abusing an existing HTML injection vulnerability :(

Works for me for the iso-8859-1 encoding range. I also tried to get CJK working, but could not yet figure out what papercdcase.com expects here. It is really a shame it doesn't support Unicode.

from picard-plugins.

PeterCodar avatar PeterCodar commented on August 25, 2024

Your plugin works now great with vowels. Thank you for that quick fix, @phw

from picard-plugins.

phw avatar phw commented on August 25, 2024

@PeterCodar Glad to hear it works :) I have updated the plugin to deal with a few more characters that could break the URL, so best you update again.

from picard-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.