Updated applescript fun
This commit is contained in:
parent
d3ec523894
commit
e3210a174b
3 changed files with 48 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
import xchat
|
#import xchat
|
||||||
import commands
|
import commands
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
@ -27,10 +27,11 @@ def cog_cb(word, word_eol, userdata):
|
||||||
sec = length % 60
|
sec = length % 60
|
||||||
line = "[ Artist: %s ][ Album: %s ][ Title: %s ][ %skbps ][ %i:%02i ]" % (info[1], info[2], info[0], info[3], min, sec)
|
line = "[ Artist: %s ][ Album: %s ][ Title: %s ][ %skbps ][ %i:%02i ]" % (info[1], info[2], info[0], info[3], min, sec)
|
||||||
|
|
||||||
xchat.command("me is playing %s" % line)
|
print line
|
||||||
|
# xchat.command("me is playing %s" % line)
|
||||||
|
|
||||||
return xchat.EAT_ALL
|
return xchat.EAT_ALL
|
||||||
|
|
||||||
xchat.hook_command("cog", cog_cb)
|
#xchat.hook_command("cog", cog_cb)
|
||||||
|
|
||||||
print "Cog loaded..."
|
print "Cog loaded..."
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
tell application "Cog"
|
tell application "Cog"
|
||||||
set this_title to the title of the currententry
|
set this_title to the title of the currentEntry
|
||||||
set this_artist to the artist of the currententry
|
set this_artist to the artist of the currentEntry
|
||||||
set this_album to the album of the currententry
|
set this_album to the album of the currentEntry
|
||||||
set this_bitrate to the bitrate of the currententry
|
set this_bitrate to the bitrate of the currentEntry
|
||||||
set this_length to the length of the currententry
|
set this_length to the length of the currentEntry
|
||||||
end tell
|
end tell
|
||||||
return this_title & tab & this_artist & tab & this_album & tab & this_bitrate & tab & this_length
|
return this_title & tab & this_artist & tab & this_album & tab & this_bitrate & tab & this_length
|
||||||
|
|
||||||
|
|
39
xchat/cog_test.py
Normal file
39
xchat/cog_test.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#import xchat
|
||||||
|
import commands
|
||||||
|
import string
|
||||||
|
|
||||||
|
__module_name__ = "Cog status plugin"
|
||||||
|
__module_version__ = "0.1"
|
||||||
|
__module_description__ = "Displays the current song cog is playing"
|
||||||
|
|
||||||
|
#def cog_cb(word, word_eol, userdata):
|
||||||
|
def cog_test():
|
||||||
|
command = "osascript -e \\\n\
|
||||||
|
\"tell application \\\"Cog\\\"\n\
|
||||||
|
set this_title to the title of the currententry\n\
|
||||||
|
set this_artist to the artist of the currententry\n\
|
||||||
|
set this_album to the album of the currententry\n\
|
||||||
|
set this_bitrate to the bitrate of the currententry\n\
|
||||||
|
set this_length to the length of the currententry\n\
|
||||||
|
end tell\n\
|
||||||
|
return this_title & tab & this_artist & tab & this_album & tab & this_bitrate & tab & this_length\""
|
||||||
|
|
||||||
|
output = commands.getoutput(command);
|
||||||
|
|
||||||
|
# print output
|
||||||
|
info = string.split(output,"\t")
|
||||||
|
length = float(info[4])
|
||||||
|
length = int(length/1000)
|
||||||
|
min = length / 60
|
||||||
|
sec = length % 60
|
||||||
|
line = "[ Artist: %s ][ Album: %s ][ Title: %s ][ %skbps ][ %i:%02i ]" % (info[1], info[2], info[0], info[3], min, sec)
|
||||||
|
|
||||||
|
print line
|
||||||
|
# xchat.command("me is playing %s" % line)
|
||||||
|
|
||||||
|
# return xchat.EAT_ALL
|
||||||
|
|
||||||
|
#xchat.hook_command("cog", cog_cb)
|
||||||
|
|
||||||
|
print "Cog loaded..."
|
||||||
|
cog_test();
|
Loading…
Reference in a new issue