[Konversation-devel] [Bug 188813] New: Now playing scripts don't work
hyper_ch
bugs.kde.org at sjau.ch
Sat Apr 4 17:03:33 CEST 2009
https://bugs.kde.org/show_bug.cgi?id=188813
Summary: Now playing scripts don't work
Product: konversation
Version: unspecified
Platform: Ubuntu Packages
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
AssignedTo: konversation-devel at kde.org
ReportedBy: bugs.kde.org at sjau.ch
Version: 1.1 (KDE 3.5.10) (using KDE 4.2.2)
OS: Linux
Installed from: Ubuntu Packages
I have a strange problem.
I had until yesterday Kubuntu Intrepid 8.10 with KDE 4.2. Then I made a clean
install with Kubuntu Jaunty 9.04 and upgraded to KDE 4.2.2 by the PPA packages.
So, on Intrepid I used a ruby script that I used as now playing script because
of Amarok 2 [SVN]. This script stopped working for no apparent reason.
However I found an old bash script that could just submit info to konversation
fine. I made a simple script that will run inside the ruby script and then post
it.
Neither approach worked, although when called each script from the cli (and
entered static info for server and channel) they worked fine.
I even downloaded the media script as announced on the konversation portal
page. I can say that the media script and ruby script both worked at some
stage, but after a restart of konversation they ceased working.
I have no explanation for this, especially when they run from the shell.
Below is the script:
#!/usr/bin/ruby
#appid = $*[0]
#server = $*[1]
#target = $*[2]
appid = "konversation"
server = "0"
target = "#konversation"
metadata = `qdbus org.mpris.amarok /Player GetMetadata 2> /dev/null`.chomp
hash = Hash.new
metadata = metadata.split("\n")
metadata.each do |line|
key = line.split(": ")[0]
value = line.split(": ")[1]
if value.nil?
value = ""
end
hash[key] = value
end
title = hash["title"]
artist = hash["artist"]
album = hash["album"]
year = hash["year"]
streamName = "" #CGI.unescape(`qdbus org.mpris.amarok /Player
streamName`.chomp)
version = "" #`qdbus org.mpris.amarok /Player version`.chomp
version = `amarok --version`.match(/^Amarok\:(.+)/i).captures
output = ""
if title.empty?
output += `qdbus org.mpris.amarok /Player nowPlaying`.chomp
else
# Strip file extension
extensions = ".ogg", ".mp3", ".wav", ".flac", ".fla", ".wma", ".mpc",
".oga"
ext = File.extname( title ).downcase
if extensions.include?( ext )
title = title[0, title.length - ext.length]
end
if artist.empty?
output += "'#{title}'"
else
output += "'#{title}' by '#{artist}'"
end
unless album.empty?
output += " on '#{album}'"
output += " (anno: #{year})" unless year == "0" or year.empty?
# output += "]"
end
unless streamName.empty?
output += " (#{streamName})"
end
unless version.empty?
output += " - [Amarok#{version}]"
end
end
info = "appid: #{appid} - server: #{server} - target: #{target}"
f = File.open("ruby.txt", 'w')
f.write(info)
f.close
#puts output
#puts "#{output}"
`dcop konversation irc say #{server} "#{target}" "/me is listening to
#{output}"`
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Konversation-devel
mailing list