Version: 1.4-beta1 (using KDE KDE 3.5.1) Installed from: Ubuntu Packages OS: Linux Neither Lyrics:Astraweb, nor Lyrics:Lyrc work for me because they don't seem to acknowledge the proxy settings in KDE. I get the following error: For Astraweb: The script 'Lyrics: Astraweb' exited with error code: 1 Details: /usr/lib/ruby/1.8/net/http.rb:562:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH) from /usr/lib/ruby/1.8/net/http.rb:562:in `connect' from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout' from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout' from /usr/lib/ruby/1.8/net/http.rb:562:in `connect' from /usr/lib/ruby/1.8/net/http.rb:555:in `do_start' from /usr/lib/ruby/1.8/net/http.rb:544:in `start' from /usr/lib/ruby/1.8/net/http.rb:1031:in `request' from /usr/lib/ruby/1.8/net/http.rb:771:in `get' from /usr/share/apps/amarok/scripts/lyrics_astraweb/lyrics_astraweb.rb:31:in `fetchLyrics' from /usr/share/apps/amarok/scripts/lyrics_astraweb/lyrics_astraweb.rb:126 from /usr/share/apps/amarok/scripts/lyrics_astraweb/lyrics_astraweb.rb:111 --- For Lyrc: The script 'Lyrics: Lyrc' exited with error code: 1 Details: /usr/lib/ruby/1.8/net/http.rb:562:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH) from /usr/lib/ruby/1.8/net/http.rb:562:in `connect' from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout' from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout' from /usr/lib/ruby/1.8/net/http.rb:562:in `connect' from /usr/lib/ruby/1.8/net/http.rb:555:in `do_start' from /usr/lib/ruby/1.8/net/http.rb:544:in `start' from /usr/lib/ruby/1.8/net/http.rb:1031:in `request' from /usr/lib/ruby/1.8/net/http.rb:771:in `get' from /usr/share/apps/amarok/scripts/lyrics_lyrc/lyrics_lyrc.rb:114:in `fetchLyrics' from /usr/share/apps/amarok/scripts/lyrics_lyrc/lyrics_lyrc.rb:173 from /usr/share/apps/amarok/scripts/lyrics_lyrc/lyrics_lyrc.rb:158 --- When I don't set the proxy in KDE, then every program will report "Network is unreachable" or similar. I also have http_proxy and ftp_proxy environment variables set, so wget, lynx and others also work flawlessly.
Lyrics_lyrc uses the http_proxy environment variable.
> Lyrics_lyrc uses the http_proxy environment variable. But it probably first tries to resolve the IP address of the server or something else without contacting the proxy. I forgot to mention that I'm on a very weird network, and can directly access only the local computers and the proxy is among them. Currently ifconfig returns (among other things) someting like this: inet addr:192.168.0.138 Bcast:192.168.3.255 Mask:255.255.252.0 Proxy is at 192.168.0.2, and it resolves DNS addresses, without me being able to. So even 'ping somecomputer' will just give me 'connect: Network is unreachable' if somecomputer is not on my network. In amarok 1.3.8 lyrics worked just fine, and I haven't changed my network connection or altered the configuration. I just updated amarok and lyrics stopped working. Last.fm works, wikipedia info works, everything else in amarok works except for the lyrics.
I also get this bug with the 1.4beta1 Kubuntu packages. The http_proxy variable *is* set, but the astra script doesn't seem to respect it (although I can see proxy handling code in the other lyrics script, which seems to work). Quite why there's a need to go hacking about setting environment variables, when proxy settings are already stored in the KDE settings already is beyond me anyway ...
same problem here without http_proxy set. Wikipedia works, lyrics don't work. Perhaps amarok could simply export the http_proxy while running the scripts? Anyway http_proxy environment settings aren't an option for me (laptop user, switching between proxy and non-proxy environments, 2 different proxies, 1 simple dsl with router)
Sorry, forgotten: Gentoo user, amarok-1.4_beta2-r1, gcc 4.0, insane useflags/cflages
Here is a suggestion for lyrics_lyrc.rb, works at least for me :) This is the lyrics fetching part, regex & co are the same def fetchLyrics( artist, title, url ) host = "lyrc.com.ar" path = url.empty? ? "/en/tema1en.php?artist=#{artist}&songname=#{title}" : "/en/#{url}" @page_url = "http://" + host + path lyrics = "" cmd = open("|kioexec cat 'http://" + host + path + "'") while (l = cmd.gets) lyrics = lyrics + l end cmd.close enjoy.
Rene, nice idea with the kioexec. But I've tried this on the shell, and there were two problems: 1) It's very slow. There seems to be a large overhead for the component loading it does. 2) Pops up an ugly "Copying" progress dialog. Also I'm wondering if this would work at all if the user has just KDELIBS installed. So I'm not sure this is a viable solution, after all.
I konw that, but kioexec *should* exist as ~/.kde3.5/share/config/kioslaverc or ~/.kde/share/config/kioslaverc (hack: symlinks on my system because some apps used .kde and others used .kde3.5) holds the proxy configuration, so kio must exist if you can set up a proxy. Kio is part of kdelibs: http://websvn.kde.org/trunk/KDE/kdelibs/kio/ At least it's part of that svn branch, but perhaps some mad distros will split it. At least the scripts could use kreadconfig or sed or some ruby code to extract the kde information from the config file, but then the problem remains with proxy configuration scripts (like the one i *should* use). Perhaps amarok could include a download interface per dcop? Anyway amarok must include such code for the wikipedia fetch, adding it to dcop shouldn't be that hard. Additionally you would get rid of all external tools and libs for network access, just plain dcop... I know that all these solutions suck. But I don't have a better idea.
Same problem here with the lyrics_lyrc.rb script in 1.4beta3 on Gentoo. http_proxy is set. Changing the code (as a total hack) in the fetchLyrics function to proxy_host = nil proxy_port = nil if ( ENV['http_proxy'] && proxy_uri = URI.parse( ENV['http_proxy'] ) ) proxy_host = proxy_uri.host proxy_port = proxy_uri.port proxy_host = 'ipcop.devnull.net.nz' proxy_port = 3128 end makes it work for me. Sorry I don't know Ruby, but I am guessing that the URI.parse isn't working properly?
For the ones that are haunted by authenticating proxies OR are willing to use the http_proxy variable, there you go (update for fetchLyrics(3)): proxy_host = nil proxy_port = nil proxy_pass = nil proxy_user = nil if ( ENV['http_proxy'] && proxy_uri = URI.parse( ENV['http_proxy'] ) ) proxy_host = proxy_uri.host proxy_port = proxy_uri.port proxy_user, proxy_pass = proxy_uri.userinfo.split(":") if proxy_uri.userinfo end host = "lyrc.com.ar" path = url.empty? ? "/en/tema1en.php?artist=#{artist}&songname=#{title}" : "/en/#{url}" @page_url = "http://" + host + path if( !proxy_user.empty? && !proxy_pass.empty? ) h = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass).start( host, 80) else h = Net::HTTP.new( host, 80, proxy_host, proxy_port ) end response = h.get( path )
*** Bug 128000 has been marked as a duplicate of this bug. ***
As my Bug 128000 has been marked as duplicate of this bug: I have http_proxy environment variable: #echo http_prxy http://login:passwd@proxy.my.domain:8080 And wget works well, however when I'm starting amarok in konsole this way #amarok To ensure than $ttp_rpoxy is set? I'm getting the same situation as in Bug 128000
*** Bug 124658 has been marked as a duplicate of this bug. ***
this bug is still here on debian sid... have the modification suggestions of the scripts been done? It's just stupid amarok uses proxy for context information except lyrics because they are on scripts.
This is not only happening to lyrc and astraweb scripts but also to all the lyrics scripts available via the KHotNewStuff thing on the scripts window. All the lyrics scripts fail when you are behind a proxy. (I am using tinyproxy together with dansguardian (a content filter) on Debian Sid, if it helps). I've checked it's not a dansguardian problem because I've tried the scripts with it turned off and everything is the same. I'm using KDE 3.5.3 (Debian Sid precompiled package), Amarok 1.4-SVN-0607101844 and ruby 1.8.4 (2005-12-24) [i486-linux] (Debian Sid precompiled package). Keep on the good work. Amarok 1.4.1 is the greatest multimedia app out there!
So far as I can tell, this bug isn't specific to lyric scripts. The last.fm proxy in svn seems to have the same problem.
This bug is really really really important. We need to get a class or something to get ruby to use KDE's proxy settings if available. Else everything internet and ruby related will not work (probably until the user sets the http_proxy env variable - and which _user_ does know that one?). Currently effected: * lyrics * last.fm * and soon daap as well I guess this list will grow, and the longer the list gets, the more features are not usable for people without knowledge of the http_proxy env. This is the reason why I set priority to high - it is a big usability problem and makes the over all user think: "phew, amarok can't even connect to the internet" Anyway, maybe we can import somthing from korundum? Guess it includes something to use kde proxy settings.
In fact the C++ part of the lastfm code is also affected, since we're using QHttp, which is not proxy aware.
Created attachment 17289 [details] proxy auth for lyrc script This is little patch, which add authentication info extracting from $http_proxy environment variable, and passing it then to Net::HTTP.new. Without this patch i was unable to get lyrics even when I've exported http_proxy. This should be added to all lyrics scripts...
And the QHttp used in the Podcast fetching as well. I suppose we should probably make an amaroK::Http that queries KDE for proxy settings. There's a seperate issue I've heard of where xine honors the proxy settings of environmental variables (which overrides whatever the user puts in that dialog) even when connecting to localhost. :S
Also, maybe ruby code for getting proxy settings from $http_proxy should go to some global function, which all lyrics scripts should use. And later, when there will be found way to obtain proxy settings from KDE, only this function should be changed, not all lyrics scripts as in case with proxy authentication code.
Voters on this bug may be interested in the patch attached to bug 131137 (scroll all the way down to the bottom), which provides proxy support for LastFM and lyrics scripts, using the KDE proxy settings (configure them by running "kcmshell proxy"). Note: If you use the xine engine, you need to ensure that the http_proxy environment variable is *not* set. If in doubt, start Amarok with: unset http_proxy ; amarok This should fix lyrics scripts and LastFM, but you will need to set the xine engine proxy for other external streams. Remove any locally applied fixes for proxy support first.
SVN commit 580587 by aoliveira: New DCOP Calls for scripts: proxyForUrl and proxyForProtocol, that return the proxy settings in kde BUG: 122092 M +15 -0 amarok.h M +12 -1 amarokcore/amarokdcophandler.cpp M +2 -0 amarokcore/amarokdcophandler.h M +2 -0 amarokcore/amarokdcopiface.h M +24 -0 scriptmanager.cpp M +7 -5 scripts/lyrics_lyrc/lyrics_lyrc.rb --- trunk/extragear/multimedia/amarok/src/amarok.h #580586:580587 @@ -221,6 +221,21 @@ LIBAMAROK_EXPORT QString escapeHTMLAttr( const QString &s ); LIBAMAROK_EXPORT QString unescapeHTMLAttr( const QString &s ); + /* defined in scriptmanager.cpp */ + /** + * Returns the proxy that should be used for a given URL. + * @param url the url. + * @return The url of the proxy, or a empty string if no proxy should be used. + */ + QString proxyForUrl(const QString& url); + + /** + * Returns the proxy that should be used for a given protocol. + * @param protocol the protocol. + * @return The url of the proxy, or a empty string if no proxy should be used. + */ + QString proxyForProtocol(const QString& protocol); + //////////////////////////////////////////////////////////////////////////////// // class amaroK::ProcIO //////////////////////////////////////////////////////////////////////////////// --- trunk/extragear/multimedia/amarok/src/amarokcore/amarokdcophandler.cpp #580586:580587 @@ -6,6 +6,7 @@ (C) 2004 Christian Muehlhaeuser (C) 2005 Ian Monroe (C) 2005 Seb Ruiz + (C) 2006 Alexandre Oliveira email : berkus@users.sf.net ***************************************************************************/ @@ -152,7 +153,7 @@ { return EngineController::engine()->position() / 1000; } - + int DcopPlayerHandler::trackCurrentTimeMs() { return EngineController::engine()->position(); @@ -915,6 +916,16 @@ return stringList; } + QString DcopScriptHandler::proxyForUrl(const QString& url) + { + return amaroK::proxyForUrl( url ); + } + + QString DcopScriptHandler::proxyForProtocol(const QString& protocol) + { + return amaroK::proxyForProtocol( protocol ); + } + ///////////////////////////////////////////////////////////////////////////////////// // class DcopDevicesHandler ///////////////////////////////////////////////////////////////////////////////////// --- trunk/extragear/multimedia/amarok/src/amarokcore/amarokdcophandler.h #580586:580587 @@ -213,6 +213,8 @@ virtual void removeCustomMenuItem(QString submenu, QString itemTitle ); virtual QString readConfig(const QString& key); virtual QStringList readListConfig(const QString& key); + virtual QString proxyForUrl(const QString& url); + virtual QString proxyForProtocol(const QString& protocol); }; class DcopDevicesHandler : public QObject, virtual public AmarokDevicesInterface --- trunk/extragear/multimedia/amarok/src/amarokcore/amarokdcopiface.h #580586:580587 @@ -206,6 +206,8 @@ virtual void removeCustomMenuItem(QString submenu, QString itemTitle ) = 0; ///< Removes the custom menu item. virtual QString readConfig(const QString& key) = 0; ///< returns a AmarokConfig configuration entry value from the given key virtual QStringList readListConfig(const QString& key) = 0; ///< AmarokConfig lists must use this function + virtual QString proxyForUrl(const QString& url) = 0; ///< Returns the proxy that should be used for the given URL + virtual QString proxyForProtocol(const QString& protocol) = 0; ///< Returns the proxy that should be used for the given protocol }; --- trunk/extragear/multimedia/amarok/src/scriptmanager.cpp #580586:580587 @@ -1,6 +1,8 @@ /*************************************************************************** * Copyright (C) 2004-2006 by Mark Kretschmann <markey@web.de> * * 2005 by Seb Ruiz <me@sebruiz.net> * + * 2006 by Alexandre Oliveira <aleprj@gmail.com> * + * 2006 by Martin Ellis <martin.ellis@kdemail.net> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -51,6 +53,7 @@ #include <kmessagebox.h> #include <kpopupmenu.h> #include <kprocio.h> +#include <kprotocolmanager.h> #include <kpushbutton.h> #include <krun.h> #include <kstandarddirs.h> @@ -77,6 +80,27 @@ */ ProcIO::ProcIO() : KProcIO( QTextCodec::codecForName( "UTF-8" ) ) {} + QString + proxyForUrl(const QString& url) + { + KURL kurl( url ); + + QString proxy; + + if ( KProtocolManager::useProxy() ) { + KProtocolManager::slaveProtocol ( kurl, proxy ); + } + + return proxy; + } + + QString + proxyForProtocol(const QString& protocol) + { + return KProtocolManager::proxyFor ( protocol ); + } + + } //////////////////////////////////////////////////////////////////////////////// --- trunk/extragear/multimedia/amarok/src/scripts/lyrics_lyrc/lyrics_lyrc.rb #580586:580587 @@ -103,17 +103,19 @@ def fetchLyrics( artist, title, url ) + + host = "lyrc.com.ar" + path = url.empty? ? "/en/tema1en.php?artist=#{artist}&songname=#{title}" : "/en/#{url}" + @page_url = "http://" + host + path + proxy_host = nil proxy_port = nil - if ( ENV['http_proxy'] && proxy_uri = URI.parse( ENV['http_proxy'] ) ) + proxy = `dcop amarok script proxyForProtocol http` + if ( proxy && proxy_uri = URI.parse( proxy ) ) proxy_host = proxy_uri.host proxy_port = proxy_uri.port end - host = "lyrc.com.ar" - path = url.empty? ? "/en/tema1en.php?artist=#{artist}&songname=#{title}" : "/en/#{url}" - @page_url = "http://" + host + path - h = Net::HTTP.new( host, 80, proxy_host, proxy_port ) response = h.get( path )
On Monday 04 September 2006 00:26, Alexandre Oliveira wrote: > --- trunk/extragear/multimedia/amarok/src/scriptmanager.cpp #580586:580587 > + QString > + proxyForUrl(const QString& url) > + QString > + proxyForProtocol(const QString& protocol) I'm not sure this is a good place for these functions - it's not just scripts that need to know about the proxy. > - if ( ENV['http_proxy'] && proxy_uri = URI.parse( ENV['http_proxy'] ) ) > + proxy = `dcop amarok script proxyForProtocol http` > + if ( proxy && proxy_uri = URI.parse( proxy ) ) I wonder if setting an environment variable wouldn't be better than an unneccessary fork/exec/shell? Frankly, I find it rather rude that Ian publicly mocked my patch, despite confessing to not having bothered to read the rationale for it, and not suggesting how it might be improved to the point that it might be accepted. Instead, we now have a patch that fixes only one of the three proxy bugs, and the only patch that fixes all three bugs will (semantically) conflict. Madness. :o(
Created attachment 18336 [details] Fix for proxy problem in Lyrc I think @proxy = `dcop amarok script proxyForProtocol http` in lyrics_lyrc.rb should be replaced with @proxy = `dcop amarok script proxyForUrl "#{url}"` because if direct connection is used and proxy was set before direct connection than proxyForProtocol still returns that proxy. Commit 598525 broke it.
Still doesn't work correctly see my previous comment.
SVN commit 601089 by aoliveira: Lyrc script should use ProtocolForUrl dcop call BUG: 122092 M +2 -2 lyrics_lyrc.rb --- trunk/extragear/multimedia/amarok/src/scripts/lyrics_lyrc/lyrics_lyrc.rb #601088:601089 @@ -111,7 +111,7 @@ proxy_host = nil proxy_port = nil if ( @proxy == nil ) - @proxy = `dcop amarok script proxyForProtocol http` + @proxy = `dcop amarok script proxyForUrl "#{@page_url}"` end proxy_uri = URI.parse( @proxy ) if ( proxy_uri.class != URI::Generic ) @@ -134,7 +134,7 @@ lyrics.gsub!( "\n", "" ) # No need for LF, just complicates our RegExps lyrics.gsub!( "\r", "" ) # No need for CR, just complicates our RegExps -# lyrics.gsub!( '
Lyrc can't fetch lyrics on my Ubuntu feisty (development branch) computer. Amarok is 1.4.5, using KDE 3.5.6. Ruby is 1.8 lyrics_lyrc.rb, line 115 says: @proxy = `dcop amarok script proxyForUrl #{@page_url.shellquote}"` http_proxy and ftp_proxy are set to http_proxy=http://www-proxy.ericsson.se:8080 ftp_proxy=http://www-proxy.ericsson.se:8080 Likewise in kioslaverc: ftpProxy=http://www-proxy.ericsson.se:8080 httpProxy=http://www-proxy.ericsson.se:8080 httpsProxy=http://www-proxy.ericsson.se:8080 It worked before I upgraded thu Ubunty system to Feisty. Before that, however, it didn't work with automatic proxy configuration, so I use manual configuration. Konqeror worked with automatic proxy configuration with this URL: http://www-proxy.ericsson.se:3132/accelerated_pac_base.pac corresponding to Proxy Config Script=http://www-proxy.ericsson.se:3132/accelerated_pac_base.pac in kioslaverc.
I also had the line @proxy = `dcop amarok script proxyForUrl #{@page_url.shellquote}"` in my lyrics_lyrc.rb script previously and it didn't work. With @proxy = `dcop amarok script proxyForUrl "#{@page_url}"` as suggested in the patch however I can confirm that it works. Thank you, Alexandre!