<div>Sure. I'd be happy to. </div><div><br><div class="gmail_quote"><div>On Mon, 13 Mar 2017 at 4:44 PM Albert Astals Cid <<a href="mailto:aacid@kde.org">aacid@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">El dilluns, 6 de març de 2017, a les 15:29:00 CET, Xin Huang va escriure:<br class="gmail_msg">
> Hi All,<br class="gmail_msg">
><br class="gmail_msg">
> When I am using Parley, I find that the FetchSound plugin has some<br class="gmail_msg">
> problems. I am using Ubuntu 16.10 and everything from the official package<br class="gmail_msg">
> repository. (I noticed there are some update, but the problem seems still)<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> 1. The mwclient package, used by wikitionary, requires to be upgraded since<br class="gmail_msg">
> Wikipedia deprecated API via http request. (should be https)<br class="gmail_msg">
><br class="gmail_msg">
> After upgrading mwclient, an extra package request_oauthlib is also<br class="gmail_msg">
> required. Because mwclient is distributed by source code, it might be<br class="gmail_msg">
> required adding request_oauthlib source. (Or adding by using pip<br class="gmail_msg">
> dependencies?)<br class="gmail_msg">
<br class="gmail_msg">
Yes, i guess mwclient should be updated and request_oauthlib "added" if it's a<br class="gmail_msg">
dependency. Can you work on a patch for that?<br class="gmail_msg">
<br class="gmail_msg">
Cheers,<br class="gmail_msg">
Albert<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
> 2. After mwclient is upgraded, there is a problem during saving sound file<br class="gmail_msg">
> url/path in keduvockvtml2writer.<br class="gmail_msg">
><br class="gmail_msg">
> ( The code on GitHub can be found here: <a href="https://github.com/KDE/" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/KDE/</a><br class="gmail_msg">
> libkeduvocdocument/blob/ddb743b7e312e69d7f1eee9a3f4c25<br class="gmail_msg">
> ef8031b27b/keduvocdocument/keduvockvtml2writer.cpp#L549 )<br class="gmail_msg">
><br class="gmail_msg">
> bool KEduVocKvtml2Writer::writeTranslation( QDomElement<br class="gmail_msg">
> &translationElement, KEduVocTranslation* translation )<br class="gmail_msg">
> {<br class="gmail_msg">
> // ...<br class="gmail_msg">
> // sound<br class="gmail_msg">
> if ( !translation->soundUrl().isEmpty() ) {<br class="gmail_msg">
> QString urlString;<br class="gmail_msg">
> qDebug() << "soundUrl" << translation->soundUrl();<br class="gmail_msg">
> if (<br class="gmail_msg">
> KIO::upUrl(m_doc->url().adjusted(QUrl::RemoveFilename)).isParentOf(<br class="gmail_msg">
> translation->soundUrl()) ) {<br class="gmail_msg">
> // try to save as relative url<br class="gmail_msg">
> urlString = m_doc->url().toString(QUrl::RemoveFilename) + '/' +<br class="gmail_msg">
> translation->soundUrl().toString(); // <------------ HERE<br class="gmail_msg">
> } else {<br class="gmail_msg">
> urlString = translation->soundUrl().url();<br class="gmail_msg">
> }<br class="gmail_msg">
> qDebug() << "urlString" << urlString;<br class="gmail_msg">
> translationElement.appendChild( newTextElement( KVTML_SOUND,<br class="gmail_msg">
> urlString ) );<br class="gmail_msg">
> }<br class="gmail_msg">
><br class="gmail_msg">
> Notice the line marked: The soundUrl of a translation parley passed in is<br class="gmail_msg">
> "file:///path/to/kvtml/kvtmlfilename_files/File:En-us-Word.ogg", and the<br class="gmail_msg">
> m_doc->url() is "file:///path/to/kvtml/kvtmlfilename.kvtml". By the logic<br class="gmail_msg">
> saving as relative url, the result will be "file:///path/to/kvtml/file://<br class="gmail_msg">
> /path/to/kvtml/kvtmlfilename_files/Files:En-us-word.ogg".<br class="gmail_msg">
><br class="gmail_msg">
> To fix the saving to relative url, the code should be:<br class="gmail_msg">
><br class="gmail_msg">
> QDir dir(m_doc->url().adjusted(QUrl::RemoveFilename).<br class="gmail_msg">
> toLocalFile());<br class="gmail_msg">
> qDebug() << m_doc->url().toString(QUrl::RemoveFilename);<br class="gmail_msg">
> urlString = dir.relativeFilePath(translation->soundUrl().<br class="gmail_msg">
> toLocalFile());<br class="gmail_msg">
><br class="gmail_msg">
> Similar code for saving image to relative path is also incorrect. (Lines<br class="gmail_msg">
> above saving sound)<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> I have submitted a patch (<a href="https://git.reviewboard.kde.org/r/129992/" rel="noreferrer" class="gmail_msg" target="_blank">https://git.reviewboard.kde.org/r/129992/</a>) for<br class="gmail_msg">
> the second issue. For the first issue requires update mwclient package, I<br class="gmail_msg">
> don't know what would be a proper solution.<br class="gmail_msg">
><br class="gmail_msg">
> Thanks,<br class="gmail_msg">
> Xin Huang<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div></div>