<div dir="ltr"><div><div><div><div><div><div><div>Hi All,<br><br></div>When I am using Parley, I find that the FetchSound plugin has some problems. I am using Ubuntu 16.10 and everything from the official package repository. (I noticed there are some update, but the problem seems still)<br><br><br></div>1. The mwclient package, used by wikitionary, requires to be upgraded since Wikipedia deprecated API via http request. (should be https)<br></div><br>After upgrading mwclient, an extra package request_oauthlib is also required. Because mwclient is distributed by source code, it might be required adding request_oauthlib source. (Or adding by using pip dependencies?)<br><br><br><br>2. After mwclient is upgraded, there is a problem during saving sound file url/path in keduvockvtml2writer.<br><br>( The code on GitHub can be found here: <a href="https://github.com/KDE/libkeduvocdocument/blob/ddb743b7e312e69d7f1eee9a3f4c25ef8031b27b/keduvocdocument/keduvockvtml2writer.cpp#L549" target="_blank">https://github.com/KDE/<wbr>libkeduvocdocument/blob/<wbr>ddb743b7e312e69d7f1eee9a3f4c25<wbr>ef8031b27b/keduvocdocument/<wbr>keduvockvtml2writer.cpp#L549</a> )<br><br></div><div>bool KEduVocKvtml2Writer::<wbr>writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation )<br>{<br>    // ...<br>    // sound<br>    if ( !translation->soundUrl().<wbr>isEmpty() ) {<br>        QString urlString;<br>        qDebug() << "soundUrl" << translation->soundUrl();<br>        if ( KIO::upUrl(m_doc->url().<wbr>adjusted(QUrl::RemoveFilename)<wbr>).isParentOf( translation->soundUrl()) ) {<br>            // try to save as relative url<br>            urlString = m_doc->url().toString(QUrl::<wbr>RemoveFilename) + '/' + translation->soundUrl().<wbr>toString();     // <------------ HERE<br>        } else {<br>            urlString =  translation->soundUrl().url();<br>        }<br>        qDebug() << "urlString" << urlString;<br>        translationElement.<wbr>appendChild( newTextElement( KVTML_SOUND, urlString ) );<br>    }<br><br></div><div>Notice the line marked: The soundUrl of a translation parley passed in is "file:///path/to/kvtml/<wbr>kvtmlfilename_files/File:En-<wbr>us-Word.ogg", and the m_doc->url() is "file:///path/to/kvtml/<wbr>kvtmlfilename.kvtml". By the logic saving as relative url, the result will be "file:///path/to/kvtml/file://<wbr>/path/to/kvtml/kvtmlfilename_<wbr>files/Files:En-us-word.ogg".<br><br></div><div>To fix the saving to relative url, the code should be:<br><br>            QDir dir(m_doc->url().adjusted(<wbr>QUrl::RemoveFilename).<wbr>toLocalFile());<br>            qDebug() << m_doc->url().toString(QUrl::<wbr>RemoveFilename);<br>            urlString = dir.relativeFilePath(<wbr>translation->soundUrl().<wbr>toLocalFile());<br></div><div><br></div>Similar code for saving image to relative path is also incorrect. (Lines above saving sound)<br><br></div><br>I have submitted a patch (<a href="https://git.reviewboard.kde.org/r/129992/">https://git.reviewboard.kde.org/r/129992/</a>) for the second issue. For the first issue requires update mwclient package, I don't know what would be a proper solution.<br><br></div>Thanks,<br></div>Xin Huang<br></div>