[Tkabber-dev] r48 - in trunk/plugins: now_playing now_playing/contrib np_send/contrib

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Sep 21 04:35:30 MSD 2007


Author: kostix
Date: 2007-09-21 04:35:30 +0400 (Fri, 21 Sep 2007)
New Revision: 48

Added:
   trunk/plugins/now_playing/contrib/tkamarok/
   trunk/plugins/now_playing/now_playing.tcl
Removed:
   trunk/plugins/now_playing/np_file.tcl
   trunk/plugins/np_send/contrib/tkamarok/
Log:
tkamarok script moved to now_playing/contrib from np_send/contrib.

now_playing/np_file.tcl renamed to now_playing/now_playing.tcl + misc changes to the code.


Copied: trunk/plugins/now_playing/contrib/tkamarok (from rev 46, trunk/plugins/np_send/contrib/tkamarok)

Copied: trunk/plugins/now_playing/now_playing.tcl (from rev 47, trunk/plugins/now_playing/np_file.tcl)
===================================================================
--- trunk/plugins/now_playing/now_playing.tcl	                        (rev 0)
+++ trunk/plugins/now_playing/now_playing.tcl	2007-09-21 00:35:30 UTC (rev 48)
@@ -0,0 +1,507 @@
+# $Id$
+# "Now Playing" -- User Tune plugin for Tkabber.
+# Queries a file with "now playing" information updated by
+# one of the supported media players and posts the information
+# aquired to the user's "User Tune" PEP nodes.
+# Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
+# See license.terms for details about distribution.
+# See README for details about usage.
+
+namespace eval now_playing {
+	variable options
+	variable lasttime 0
+	variable lastmethod none
+	variable connections [list]
+	variable monitoring off
+	variable nwarns
+
+	proc mycmd args {
+		lset args 0 [uplevel 1 namespace current]::[lindex $args 0]
+	}
+
+	custom::defgroup "User Tune" \
+		[::msgcat::mc "Plugins for automatic gathering of\
+			information for User Tune personal eventing facility."] \
+		-group Plugins
+
+	custom::defgroup "Now Playing" \
+		[::msgcat::mc "Support processing of \"now playing\" information\
+			served by various media players."] \
+		-group "User Tune"
+
+	custom::defvar options(media_player) "" \
+		[::msgcat::mc "Media player that manages the now playing file.\
+			Please note that some media players and/or their \"now playing\"\
+			plugins require additional configuration to work with this plugin.\
+			Please consult the README file of this plugin for configuration\
+			instructions. Select \"None\" to disable this plugin."] \
+		-type options \
+		-values [list] \
+		-command [mycmd on_media_player_changed] \
+		-group "Now Playing"
+
+	custom::defvar options(check_timeout) 1 \
+		[::msgcat::mc "Timeout (in seconds) between checks\
+			for modification of the now-playing file."] \
+		-type integer \
+		-group "Now Playing"
+
+	custom::defvar options(update_threshold) 30 \
+		[::msgcat::mc "Minimal amount of time (in seconds) that must tick\
+			between adjacent now-playing file modifications\
+			for its contents to be used."] \
+		-type integer \
+		-command [mycmd on_update_thresh_changed] \
+		-group "Now Playing"
+
+	custom::defvar options(file) [file join $::configdir now_playing] \
+		[::msgcat::mc "Pathname of the now playing file."] \
+		-type file \
+		-group "Now Playing"
+
+	hook::add connected_hook \
+		[mycmd on_new_connection]
+	hook::add disconnected_hook \
+		[mycmd on_connection_gone]
+
+	# How many warnings of each topic to report:
+	set options(throttle_warns_after) 3
+}
+
+proc now_playing::warn {topic msg} {
+	variable options
+	variable nwarns
+
+	if {![info exists nwarns($topic)]} {
+		set nwarns($topic) 0
+	} elseif {$nwarns($topic) >= $options(throttle_warns_after)} return
+
+	puts stderr "np_file: $msg"
+	incr nwarns($topic)
+}
+
+proc now_playing::enabled {} {
+	variable options
+
+	expr {![string equal $options(media_player) none]}
+}
+
+proc now_playing::monitoring {op args} {
+	variable monitoring
+
+	switch -- $op {
+		get {
+			set monitoring
+		}
+		is {
+			expr {$monitoring && [lindex $args 0]}
+		}
+		set {
+			variable options
+			variable repollid
+
+			set activate [lindex $args 0]
+
+			if {$activate && !$monitoring} {
+				set monitoring on
+				[mycmd poll] ;# must be fully qualified
+			} elseif {$monitoring && !$activate} {
+				set monitoring off
+				if {[info exists repollid]} {
+					after cancel $repollid
+				}
+			}
+			set monitoring
+		}
+		default {
+			return -code error "Bad operation \"$op\":\
+				must be get, is or set"
+		}
+	}
+}
+
+# Calling of this procedure does only have sense when done from
+# a np_file_enumerate_media_players hook.
+proc now_playing::add_media_player args {
+	variable options
+	variable players
+
+	foreach {opt val} $args {
+		switch -- $opt {
+			-tag    { set tag $val }
+			-name   { set name $val }
+			-method { set method $val }
+			-parser { set parser $val }
+			default {
+				return -code error "Bad option \"$opt\":\
+					must be one of -tag, -name or -parser"
+			}
+		}
+	}
+
+	foreach v {tag name method parser} {
+		if {![info exists $v]} {
+			return -code error "Required option missing: -$v"
+		}
+	}
+
+	if {$tag == ""} {
+		return -code error "Empty tag is reserved and cannot be used"
+	}
+
+	switch -- $method {
+		file - registry - send - {}
+		default {
+			return -code error "Bad method \"$method\":\
+				must be one of file, registry or send"
+		}
+	}
+
+	set options(name,$tag)   $name
+	set options(method,$tag) $method
+	set options(parser,$tag) $parser
+
+	lappend players $tag $name
+}
+
+proc now_playing::enumerate_media_players args {
+	variable options
+	variable players
+
+	foreach {tag name method parser} [list \
+		none       [::msgcat::mc "None"]  none     {} \
+		amarok     "Amarok"               send     {} \
+		foobar     "Foobar2000"           file     [mycmd foobar_yield] \
+		QL         "Quod Libet"           file     [mycmd quodlibet_yield] \
+		wmp        "Windows Media Player" registry [mycmd wmp_yield]  \
+	] {
+		add_media_player -tag $tag -name $name -method $method -parser $parser
+	}
+
+	hook::run np_file_enumerate_media_players
+
+	custom::configvar [namespace current]::options(media_player) -values $players
+
+	unset players
+}
+
+proc now_playing::on_new_connection connid {
+	variable connections
+
+	set connections [lsort -unique [lappend connections $connid]]
+
+	monitoring set [expr {[enabled] && [llength $connections] > 0}]
+}
+
+proc now_playing::on_connection_gone connid {
+	variable connections
+
+	set ix [lsearch -sorted $connections $connid]
+	if {$ix >= 0} {
+		set connections [lreplace $connections $ix $ix]
+	}
+
+	monitoring set [expr {[enabled] && [llength $connections] > 0}]
+}
+
+proc now_playing::on_media_player_changed args {
+	variable connections
+	variable lastmethod
+	variable players
+
+	monitoring set [expr {[enabled] && [llength $connections] > 0}]
+
+	upvar 0 options(media_player) player
+	upvar 0 players($tag,method) method
+
+	if {![string equal $lastmethod $method]} {
+		method_stop_$lastmethod
+	}
+	if {[monitoring is on]} {
+		method_start_$method
+	}
+	set lastmethod $method
+}
+
+proc now_playing::on_update_thresh_changed args {
+	variable options
+
+	# Prevent modification time threshold from being lower than 10 sec:
+	if {$options(update_threshold) < 10} {
+		set options(update_threshold) 10
+	}
+}
+
+proc now_playing::now_playing args {
+	variable connections
+
+	# TODO check options for sanity
+
+	set state ""
+	set opts [list]
+	foreach {opt val} $args {
+		if {[string equal $opt -state]} {
+			set state $val
+		} else {
+			if {$val != ""} {
+				lappend opts $opt $val
+			}
+		}
+	}
+
+	switch -- $state {
+		inactive {
+			foreach connid $connections {
+				::plugins::tune::unpublish $connid
+			}
+		}
+		active {
+			foreach connid $connections {
+				eval [list ::plugins::tune::publish $connid] $opts
+			}
+		}
+		default {
+			return -code error "Bad playing status: \"$state\":\
+				must be active or inactive"
+		}
+	}
+}
+
+proc now_playing::polling_start with {
+	variable repollid
+}
+
+proc now_playing::polling_cancel {} {
+	variable repollid
+
+	if {$repollid != ""} { after cancel $repollid }
+}
+
+#### Method: none
+
+proc now_playing::method_start_none {} {}
+
+proc now_playing::method_stop_none {} {}
+
+#### Method: file
+
+proc now_playing::method_start_file {} {
+}
+
+proc now_playing::method_stop_file {} {
+}
+
+proc now_playing::file_poll {} {
+	variable options
+	variable repollid
+
+	file_yield
+
+	if {$options(check_timeout) > 0} {
+		set repollid [after \
+			[expr {$options(check_timeout) * 1000}] [info level 0]]
+	}
+}
+
+proc now_playing::file_yield {} {
+	variable options
+	variable lasttime
+	variable monitoring
+	variable connections
+
+	if {![file exists $options(file)]} {
+		warn missing "file \"$options(file)\" doesn't exist"
+		return
+	}
+
+	set mtime [file mtime $options(file)]
+	if {$mtime - $lasttime < $options(update_threshold)} return
+	set lasttime $mtime
+
+	upvar 0 options(media_player) tag
+	set failed [catch [list $options(parser,$tag) $options(file)]]
+	if {$failed} {
+		global errorInfo
+		set monitoring false
+		warn parsing "parser script for player \"$options(name,$tag)\"\
+			failed: $errorInfo"
+	}
+}
+
+#### Foobar2000:
+
+proc now_playing::foobar_yield fname {
+	variable connections
+
+	debugmsg tune [info level 0]
+
+	set fd [open $fname]
+	fconfigure $fd -encoding utf-8
+	set data [read $fd]
+	close $fd
+
+	foobar_parse $data info
+
+	switch -- $info(status) {
+		STOPPED {
+			foreach connid $connections {
+				::plugins::tune::unpublish $connid
+			}
+		}
+		PLAYING {
+			unset info(status)
+			set args [list]
+			foreach {key val} [array get info] {
+				if {$val == ""} continue
+				lappend args -$key $val
+			}
+			foreach connid $connections {
+				eval [list ::plugins::tune::publish $connid] $args
+			}
+		}
+	}
+}
+
+proc now_playing::foobar_parse {data vinfo} {
+	upvar 1 $vinfo info
+
+	array set info {
+		status ""
+		artist ""
+		title  ""
+		track  ""
+		length ""
+		source ""
+		uri    ""
+	}
+
+	set lines [list]
+	foreach line [split $data \n] {
+		lappend lines [string trim $line]
+	}
+
+	set status [string toupper [lindex $lines 0]]
+	switch -- $status {
+		STOPPED {
+			return
+		}
+		PLAYING {
+			# processed below
+		}
+		default {
+			return -code error "Bad playing status \"$status\":\
+				must be one of PLAYING or STOPPED"
+		}
+	}
+
+	foreach line [lrange $lines 1 end] {
+		if {[regexp -nocase \
+				{^(artist|title|track|length|source|uri)\s+(.*)$} \
+				$line -> tag value]} {
+			set tag [string tolower $tag]
+			set info($tag) $value
+		} else {
+			warn junk "skipped junk line \"$line\""
+		}
+	}
+
+	if {![string equal $info(length) ""]} {
+		set length [string trimleft $info(length) 0]
+		if {![string is integer $length] || $length < 0} {
+			warn format "bad length \"$length\":\
+				must be non-negative short integer"
+			set length ""
+		}
+	}
+}
+
+#### Quod Libet:
+
+proc now_playing::quodlibet_yield fname {
+	variable connections
+
+	set fd [open $fname]
+	fconfigure $fd -encoding utf-8
+	set data [read $fd]
+	close $fd
+
+	quodlibet_parse $data info
+
+	switch -- $info(status) {
+		paused -
+		inactive {
+			foreach connid $connections {
+				::plugins::tune::unpublish $connid
+			}
+		}
+		playing {
+			unset info(status)
+			set args [list]
+			foreach {key val} [array get info] {
+				if {$val == ""} continue
+				lappend args -$key $val
+			}
+			foreach connid $connections {
+				eval [list ::plugins::tune::publish $connid] $args
+			}
+		}
+		default {
+			warn format "unknown or missing playing status, ignored"
+		}
+	}
+}
+
+proc now_playing::quodlibet_parse {data vinfo} {
+	upvar 1 $vinfo info
+
+	array set info {
+		status ""
+		artist ""
+		title  ""
+		track  ""
+		length ""
+		source ""
+		uri    ""
+	}
+
+	foreach line [split $data \n] {
+		set line [string trim $line]
+		if {[string length $line] == 0} continue
+		set ix [string first = $line]
+		set key [string range $line 0 [expr {$ix - 1}]]
+		set val [string range $line [expr {$ix + 1}] end]
+		switch -- $key {
+			status      { set info(status) $val }
+			album       { set info(source) $val }
+			artist      { set info(artist) $val }
+			date        { set info(date)   $val }
+			~#length    { set info(length) $val }
+			title       { set info(title)  $val }
+			tracknumber { set info(track)  $val }
+			default     {
+				warn format "unknown key: \"$key\", ignored"
+			}
+		}
+	}
+}
+
+#### Method: send
+
+proc now_playing::method_start_send {} {
+}
+
+proc now_playing::method_stop_send {} {
+}
+
+#### Method: registry
+
+proc now_playing::method_start_registry {} {
+}
+
+proc now_playing::method_stop_registry {} {
+}
+
+#### Final startup
+
+np_file::enumerate_media_players
+

Deleted: trunk/plugins/now_playing/np_file.tcl
===================================================================
--- trunk/plugins/now_playing/np_file.tcl	2007-09-20 23:39:29 UTC (rev 47)
+++ trunk/plugins/now_playing/np_file.tcl	2007-09-21 00:35:30 UTC (rev 48)
@@ -1,463 +0,0 @@
-# $Id$
-# "Now Playing File" -- User Tune plugin for Tkabber.
-# Queries a file with "now playing" information updated by
-# one of the supported media players and posts the information
-# aquired to the user's "User Tune" PEP nodes.
-# Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
-# See license.terms for details about distribution.
-# See README for details about usage.
-
-namespace eval np_file {
-	variable options
-	variable lasttime 0
-	variable lastmethod none
-	variable connections [list]
-	variable monitoring off
-	variable nwarns
-
-	proc mycmd args {
-		lset args 0 [uplevel 1 namespace current]::[lindex $args 0]
-	}
-
-	custom::defgroup "User Tune" \
-		[::msgcat::mc "Plugins for automatic gathering of\
-			information for User Tune personal eventing facility."] \
-		-group Plugins
-
-	custom::defgroup NowPlayingFile \
-		[::msgcat::mc "Support for files with \"now playing\" information\
-			managed by various media players."] \
-		-group "User Tune"
-
-	custom::defvar options(media_player) "" \
-		[::msgcat::mc "Media player that manages the now playing file.\
-			Please note that some media players and/or their \"now playing\"\
-			plugins require additional configuration to work with this plugin.\
-			Please consult the README file of this plugin for configuration\
-			instructions. Select \"None\" to disable this plugin."] \
-		-type options \
-		-values [list] \
-		-command [mycmd on_media_player_changed] \
-		-group NowPlayingFile
-
-	custom::defvar options(file) [file join $::configdir np.txt] \
-		[::msgcat::mc "Pathname of the now playing file."] \
-		-type file \
-		-group NowPlayingFile
-
-	custom::defvar options(check_timeout) 1 \
-		[::msgcat::mc "Timeout (in seconds) between checks\
-			for modification of the now-playing file."] \
-		-type integer \
-		-group NowPlayingFile
-
-	custom::defvar options(update_threshold) 30 \
-		[::msgcat::mc "Minimal amount of time (in seconds) that must tick\
-			between adjacent now-playing file modifications\
-			for its contents to be used."] \
-		-type integer \
-		-command [mycmd on_update_thresh_changed] \
-		-group NowPlayingFile
-
-	hook::add connected_hook \
-		[mycmd on_new_connection]
-	hook::add disconnected_hook \
-		[mycmd on_connection_gone]
-
-	# How many warnings of each topic to report:
-	set options(throttle_warns_after) 3
-}
-
-proc np_file::warn {topic msg} {
-	variable options
-	variable nwarns
-
-	if {![info exists nwarns($topic)]} {
-		set nwarns($topic) 0
-	} elseif {$nwarns($topic) >= $options(throttle_warns_after)} return
-
-	puts stderr "np_file: $msg"
-	incr nwarns($topic)
-}
-
-proc np_file::enabled {} {
-	variable options
-
-	expr {$options(media_player) != ""}
-}
-
-proc np_file::monitoring {op args} {
-	variable monitoring
-
-	switch -- $op {
-		get {
-			set monitoring
-		}
-		is {
-			expr {$monitoring && [lindex $args 0]}
-		}
-		set {
-			variable options
-			variable repollid
-
-			set activate [lindex $args 0]
-
-			if {$activate && !$monitoring} {
-				set monitoring on
-				[mycmd poll] ;# must be fully qualified
-			} elseif {$monitoring && !$activate} {
-				set monitoring off
-				if {[info exists repollid]} {
-					after cancel $repollid
-				}
-			}
-			set monitoring
-		}
-		default {
-			return -code error "Bad operation \"$op\":\
-				must be get, is or set"
-		}
-	}
-}
-
-# Calling of this procedure does only have sense when done from
-# a np_file_enumerate_media_players hook.
-proc np_file::add_media_player args {
-	variable options
-	variable players
-
-	foreach {opt val} $args {
-		switch -- $opt {
-			-tag    { set tag $val }
-			-name   { set name $val }
-			-method { set method $val }
-			-parser { set parser $val }
-			default {
-				return -code error "Bad option \"$opt\":\
-					must be one of -tag, -name or -parser"
-			}
-		}
-	}
-
-	foreach v {tag name method parser} {
-		if {![info exists $v]} {
-			return -code error "Required option missing: -$v"
-		}
-	}
-
-	if {$tag == ""} {
-		return -code error "Empty tag is reserved and cannot be used"
-	}
-
-	switch -- $method {
-		file - registry - send - {}
-		default {
-			return -code error "Bad method \"$method\":\
-				must be one of file, registry or send"
-		}
-	}
-
-	set options(name,$tag)   $name
-	set options(method,$tag) $method
-	set options(parser,$tag) $parser
-
-	lappend players $tag $name
-}
-
-proc np_file::enumerate_media_players args {
-	variable options
-	variable players
-
-	foreach {tag name method parser} [list \
-		none       [::msgcat::mc "None"]  none     {} \
-		foobar     "Foobar2000"           file     [mycmd foobar_yield] \
-		QL         "Quod Libet"           file     [mycmd quodlibet_yield] \
-		wmp        "Windows Media Player" registry [mycmd wmp_yield]  \
-	] {
-		add_media_player -tag $tag -name $name -method $method -parser $parser
-	}
-
-	hook::run np_file_enumerate_media_players
-
-	custom::configvar [namespace current]::options(media_player) -values $players
-
-	unset players
-}
-
-proc np_file::on_new_connection connid {
-	variable connections
-
-	set connections [lsort -unique [lappend connections $connid]]
-
-	monitoring set [expr {[enabled] && [llength $connections] > 0}]
-}
-
-proc np_file::on_connection_gone connid {
-	variable connections
-
-	set ix [lsearch -sorted $connections $connid]
-	if {$ix >= 0} {
-		set connections [lreplace $connections $ix $ix]
-	}
-
-	monitoring set [expr {[enabled] && [llength $connections] > 0}]
-}
-
-#### Method: none
-
-proc np_file::method_start_none {} {}
-
-proc np_file::method_stop_none {} {}
-
-#### Method: file
-
-proc np_file::method_start_file {} {
-}
-
-proc np_file::method_stop_file {} {
-}
-
-proc np_file::poll {} {
-	variable options
-	variable repollid
-
-	yield
-
-	if {$options(check_timeout) > 0} {
-		set repollid [after \
-			[expr {$options(check_timeout) * 1000}] [info level 0]]
-	}
-}
-
-proc np_file::yield {} {
-	variable options
-	variable lasttime
-	variable monitoring
-	variable connections
-
-	if {![file exists $options(file)]} {
-		warn missing "file \"$options(file)\" doesn't exist"
-		return
-	}
-
-	set mtime [file mtime $options(file)]
-	if {$mtime - $lasttime < $options(update_threshold)} return
-	set lasttime $mtime
-
-	upvar 0 options(media_player) tag
-	set failed [catch [list $options(parser,$tag) $options(file)]]
-	if {$failed} {
-		global errorInfo
-		set monitoring false
-		warn parsing "parser script for player \"$options(name,$tag)\"\
-			failed: $errorInfo"
-	}
-}
-
-proc np_file::on_media_player_changed args {
-	variable connections
-	variable lastmethod
-	variable players
-
-	# TODO remove this:
-	# method should become enabled when method isn't "none"
-	monitoring set [expr {[enabled] && [llength $connections] > 0}]
-
-	upvar 0 options(player) tag
-	upvar 0 players($tag,method) method
-
-	if {![string equal $lastmethod $method]} {
-		method_stop_$lastmethod
-	}
-	if {[monitoring is on]} {
-		method_start_$method
-	}
-	set lastmethod $method
-}
-
-proc np_file::on_update_thresh_changed args {
-	variable options
-
-	# Prevent modification time threshold from being lower than 10 sec:
-	if {$options(update_threshold) < 10} {
-		set options(update_threshold) 10
-	}
-}
-
-#### Foobar2000:
-
-proc np_file::foobar_yield fname {
-	variable connections
-
-	debugmsg tune [info level 0]
-
-	set fd [open $fname]
-	fconfigure $fd -encoding utf-8
-	set data [read $fd]
-	close $fd
-
-	foobar_parse $data info
-
-	switch -- $info(status) {
-		STOPPED {
-			foreach connid $connections {
-				::plugins::tune::unpublish $connid
-			}
-		}
-		PLAYING {
-			unset info(status)
-			set args [list]
-			foreach {key val} [array get info] {
-				if {$val == ""} continue
-				lappend args -$key $val
-			}
-			foreach connid $connections {
-				eval [list ::plugins::tune::publish $connid] $args
-			}
-		}
-	}
-}
-
-proc np_file::foobar_parse {data vinfo} {
-	upvar 1 $vinfo info
-
-	array set info {
-		status ""
-		artist ""
-		title  ""
-		track  ""
-		length ""
-		source ""
-		uri    ""
-	}
-
-	set lines [list]
-	foreach line [split $data \n] {
-		lappend lines [string trim $line]
-	}
-
-	set status [string toupper [lindex $lines 0]]
-	switch -- $status {
-		STOPPED {
-			return
-		}
-		PLAYING {
-			# processed below
-		}
-		default {
-			return -code error "Bad playing status \"$status\":\
-				must be one of PLAYING or STOPPED"
-		}
-	}
-
-	foreach line [lrange $lines 1 end] {
-		if {[regexp -nocase \
-				{^(artist|title|track|length|source|uri)\s+(.*)$} \
-				$line -> tag value]} {
-			set tag [string tolower $tag]
-			set info($tag) $value
-		} else {
-			warn junk "skipped junk line \"$line\""
-		}
-	}
-
-	if {![string equal $info(length) ""]} {
-		set length [string trimleft $info(length) 0]
-		if {![string is integer $length] || $length < 0} {
-			warn format "bad length \"$length\":\
-				must be non-negative short integer"
-			set length ""
-		}
-	}
-}
-
-#### Quod Libet:
-
-proc np_file::quodlibet_yield fname {
-	variable connections
-
-	set fd [open $fname]
-	fconfigure $fd -encoding utf-8
-	set data [read $fd]
-	close $fd
-
-	quodlibet_parse $data info
-
-	switch -- $info(status) {
-		paused -
-		inactive {
-			foreach connid $connections {
-				::plugins::tune::unpublish $connid
-			}
-		}
-		playing {
-			unset info(status)
-			set args [list]
-			foreach {key val} [array get info] {
-				if {$val == ""} continue
-				lappend args -$key $val
-			}
-			foreach connid $connections {
-				eval [list ::plugins::tune::publish $connid] $args
-			}
-		}
-		default {
-			warn format "unknown or missing playing status, ignored"
-		}
-	}
-}
-
-proc np_file::quodlibet_parse {data vinfo} {
-	upvar 1 $vinfo info
-
-	array set info {
-		status ""
-		artist ""
-		title  ""
-		track  ""
-		length ""
-		source ""
-		uri    ""
-	}
-
-	foreach line [split $data \n] {
-		set line [string trim $line]
-		if {[string length $line] == 0} continue
-		set ix [string first = $line]
-		set key [string range $line 0 [expr {$ix - 1}]]
-		set val [string range $line [expr {$ix + 1}] end]
-		switch -- $key {
-			status      { set info(status) $val }
-			album       { set info(source) $val }
-			artist      { set info(artist) $val }
-			date        { set info(date)   $val }
-			~#length    { set info(length) $val }
-			title       { set info(title)  $val }
-			tracknumber { set info(track)  $val }
-			default     {
-				warn format "unknown key: \"$key\", ignored"
-			}
-		}
-	}
-}
-
-#### Method: send
-
-proc np_file::method_start_send {} {
-}
-
-proc np_file::method_stop_send {} {
-}
-
-#### Method: registry
-
-proc np_file::method_start_registry {} {
-}
-
-proc np_file::method_stop_registry {} {
-}
-
-#### Final startup
-
-np_file::enumerate_media_players
-



More information about the Tkabber-dev mailing list