Repository navigation
Guitar Chord Diagrams - #858
Conversation
There was a problem hiding this comment.
Hmm, this won't work in IE8
|
@charles-l thanks for the PR; looks cool & useful! I'm not sure what we're going to do about the IE8 dataURI compatibility problem; @jagtalon @moollaza Any ideas on the best way to handle this? The only option I can think of is to actually save all the PNG's into the |
|
@charles-l also there appears to be a dependecy issue: https://travis-ci.org/duckduckgo/zeroclickinfo-goodies/jobs/44633711#L275 |
|
@mintsoft Ah, I didn't realize I could generate the images in the I did add I'll also look through the supported chords to see if my regex is blocking anything. |
|
@charles-l No problem; it's not well documented functionality :) Looking at the current packages, @jagtalon / @moollaza what's the best/easiest way to add a system dependency in or should we look for another method? |
|
@mintsoft Hmm... is there some trick to getting the path to a I was thinking this might help, but it also is embedding as base64... |
|
@charles-l I thought there was a way of doing it which was handled by the ImageRole; however I didn't realise it was Data URI'ing it. I'll have to loop in @moollaza and @jagtalon as they might have a better idea than me. |
|
As you see, The ImageRole will be your best bet, I know it's used in the SunInfo Goodie. This approach base64 encodes the image. Alternatively you could use the |
|
@moollaza is it OK to use Base64 even if it isn't supported by IE8? Right now, I'm leaning towards the inline JavaScript (even though it's kind of a hacky work around). |
|
@charles-l I think use the ImageRole for now, we know it doesn't work with IE8 so we'll have to solve that within the Role. That's essentially already a problem (#770) @moollaza seem reasonable? |
|
@charles-l yup, I agree with @mintsoft -- it's a tolerated bug I hope to fix soon |
|
OK, I switched over to ImageRole and updated regex. You can generate the images in |
There was a problem hiding this comment.
Did you know you can use named captures? It might make this a little simpler
/(?<m>$date_number)/
# then use it
print $+{'m'}|
@charles-l Cool, that's a nice way of doing the image creation! The only thing that 'bothers' me now is that the regex + parsing section is a little difficult to follow, I think it could probably be done with more of a $a = 'm' if ($a =~ /minor/);
$b = 'M' if ($b =~ /major/);
return "$a $b $c $d";kind of thing, rather than appending onto the string as you go which might make it a bit clearer |
|
@charles-l Also, before I hook in the design guys can you make it return the name of the chord I.e. G7sus4 in the output in addition to the image? |
|
@mintsoft, it already displays the chord name in the label of the image. Do you want html text in addition? |
|
@mintsoft that's my bad, the images are generated to the |
|
@jagtalon @mintsoft I think everything should be working now :) |
|
Huh. The second build failed for some reason... |
There was a problem hiding this comment.
This is what's failed the build:
https://travis-ci.org/duckduckgo/zeroclickinfo-goodies/jobs/50566417#L3675
There was a problem hiding this comment.
@mintsoft err... sorry, I'm still missing it. It's saying something about a TAP plan? Dunno what that is, though.
There was a problem hiding this comment.
@charles-l you need to scroll up a little to line 3675:
[23:52:22] t/GuitarChords.t ................. Smartmatch is experimental at /home/travis/build/duckduckgo/zeroclickinfo-goodies/.build/9vst6yMqvN/blib/lib/DDG/Goodie/GuitarChords.pm line 67.
Compilation failed in require at t/GuitarChords.t line 12.
[23:52:22] t/GuitarChords.t ................. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
The problem is the "smartmatch" operator (~~), which I guess is considered experimental. Any chance you can find an alternative to that?
|
@charles-l I fixed the most recent build problem in master yesterday; can you merge-in again? |
|
@mintsoft merged, and it works! :D |
|
@charles-l Good news then! @jagtalon @moollaza I think this is ready |
|
Sorry about the delay guys, will try and get around to this one soon! |
|
@moollaza no problem, and thanks for the heads up :) |
|
@charles-l thanks! Putting it up on a server. |
|
@abeyang up on https://ddh9.duckduckgo.com/?q=G%23m6+guitar+chord&ia=answer! @moollaza I don't know much about guitar chords--maybe you could spot check the IA to see if the info is correct? |
|
@charles-l thanks for fixing the filenames btw! |
There was a problem hiding this comment.
Could you add a brief comment before the function which explains what it does? It's a bit intimidating at first glance.
|
💥 |
|
@charles-l Thanks again for taking the time to contribute! We really appreciate it. Feel free to stick around and comment/help on other PR's & Issues or even submit more Instant Answers! |
|
Congrats @charles-l 🎉 |
|
@mintsoft thank you And thank you for all the help :) |
|
Happy to help @charles-l ! |
|
@charles-l congrats! It's live: https://duckduckgo.com/?q=G+guitar+chord&ia=answer Thanks again for taking the time to contribute! We really appreciate it. Feel free to stick around and comment/help on other PR's & Issues or even submit more Instant Answers! |
What does your Instant Answer do?
It returns a requested guitar chord diagram.
What problem does your Instant Answer solve (Why is it better than organic links)?
Easier access.
What is the data source for your Instant Answer? (Provide a link if possible)
The GD::Tab::Guitar cpan module. (http://search.cpan.org/~taniguchi/GD-Tab-Guitar-0.03/lib/GD/Tab/Guitar.pm)
Why did you choose this data source?
Because it generates the diagrams.
Are there any other alternative (better) data sources?
Not that I know of.
What are some example queries that trigger this Instant Answer?
'G guitar chord' 'G#m6 guitar chord'
Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)
Musicians.
Is this Instant Answer connected to a DuckDuckHack Instant Answer idea?
(https://duck.co/ideas/idea/537/piano-guitar-chords), but it looks like it was abandoned?
Which existing Instant Answers will this one supercede/overlap with?
None.
Are you having any problems? Do you need our help with anything?
Nope.
What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)

[x] Added metadata and attribution information (https://duck.co/duckduckhack/metadata)
[x] Wrote test file and added to t/ directory (https://duck.co/duckduckhack/goodie_tests)
[x] Verified that instant answer adheres to design guidelines (https://duck.co/duckduckhack/design_styleguide)
[x] Verified that instant answer adheres to code styleguide (https://duck.co/duckduckhack/code_styleguide)
[x] Tested cross-browser compatibility