amaroknowplaying.rb

来自「Amarok是一款在LINUX或其他类UNIX操作系统中运行的音频播放器软件。 」· RB 代码 · 共 53 行

RB
53
字号
#!/usr/bin/env ruby## Now playing script for IRC.# Use with the "/exec -o" command of your client. You can bind an alias like this:# /alias np exec -o /home/myself/amaroknowplaying.rb## (c) 2005-2006 Mark Kretschmann <markey@web.de># License: GNU General Public License V2title  = `dcop amarok player title 2> /dev/null`.chompexit( 1 ) unless $?.success? # Abort if Amarok isn't runningartist = `dcop amarok player artist`.chompalbum  = `dcop amarok player album`.chompyear   = `dcop amarok player year`.chomplastfm = `dcop amarok player lastfmStation`.chompoutput = ""if title.empty?    output += `dcop amarok player nowPlaying`.chompelse    # Strip file extension    extensions = ".ogg", ".mp3", ".wav", ".flac", ".fla", ".wma", ".mpc"    ext = File.extname( title ).downcase    if extensions.include?( ext )        title = title[0, title.length - ext.length]    end    if artist.empty?        output += "#{title}"    else        output += "#{artist} - #{title}"    end    unless album.empty?        output += " [#{album}"        output += ", #{year}" unless year == "0"        output += "]"    end    unless lastfm.empty?        output += " (Last.fm #{lastfm})"    endendputs( "np: #{output}" ) unless output.empty?

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?