Advertisement
Guest User

Untitled

a guest
May 21st, 2011
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. alias xbmc {
  2. ; put the host and port to your XBMC web interface here
  3. set %xbmc.host 192.168.1.3
  4. set %xbmc.port 8080
  5.  
  6. ; go to the following website and generate your
  7. ; digest from the credentials you use to access
  8. ; the xbmc web interface
  9. ; http://www.motobit.com/util/base64-decoder-encoder.asp
  10. ; enter username:password
  11. ; hit Convert
  12. ; put the result here
  13. set %xbmc.digest DIGEST HERE
  14.  
  15. ; #### NO NEED TO EDIT BELOW THIS LINE ####
  16.  
  17. sockopen xbmc.sock %xbmc.host %xbmc.port
  18. set %xbmc.window $active
  19. }
  20.  
  21. on *:sockopen:xbmc.sock:{
  22. if ($sockerr) || (!$sock($sockname)) return
  23. sockwrite -n $sockname GET /xbmcCmds/xbmcHttp?command=getcurrentlyplaying HTTP/1.1
  24. sockwrite -n $sockname Authorization: Basic %xbmc.digest
  25. sockwrite -n $sockname $crlf
  26. }
  27.  
  28. on *:sockread:xbmc.sock:{
  29. var %xbmc.read | sockread %xbmc.read
  30. ; if (!$1) || ($result == 5) return
  31. ; For debugging purposes:
  32. ;echo -s %xbmc.read
  33.  
  34. if (<li>Type: isin %xbmc.read) {
  35. ;echo -s type %xbmc.read
  36. noop $regsub(, %xbmc.read, ^<li>Type:,, %xbmc.type)
  37. return
  38. }
  39.  
  40. if (<li>Show Title: isin %xbmc.read) {
  41. ;echo -s show title %xbmc.read
  42. noop $regsub(, %xbmc.read, ^<li>Show Title:,, %xbmc.show)
  43. return
  44. }
  45.  
  46. if (<li>Title: isin %xbmc.read) {
  47. ;echo -s Eptitle - %xbmc.read
  48. noop $regsub(, %xbmc.read, ^<li>Title:,, %xbmc.title)
  49. return
  50. }
  51.  
  52. if (<li>Season: isin %xbmc.read) {
  53. ;echo -s Season - %xbmc.read
  54. noop $regsub(, %xbmc.read, ^<li>Season:,, %xbmc.season)
  55. return
  56. }
  57.  
  58. if (<li>Episode: isin %xbmc.read) {
  59. ;echo -s Episode - %xbmc.read
  60. noop $regsub(, %xbmc.read, ^<li>Episode:,, %xbmc.episode)
  61. return
  62. }
  63.  
  64. if (<li>Track: isin %xbmc.read) {
  65. ;echo -s Eptitle - %xbmc.read
  66. noop $regsub(, %xbmc.read, ^<li>Track:,, %xbmc.track)
  67. return
  68. }
  69.  
  70. if (<li>Artist: isin %xbmc.read) {
  71. ;echo -s Artist - %xbmc.read
  72. noop $regsub(, %xbmc.read, ^<li>Artist:,, %xbmc.artist)
  73. return
  74. }
  75.  
  76. if (<li>Album: isin %xbmc.read) {
  77. ;echo -s Year - %xbmc.read
  78. noop $regsub(, %xbmc.read, ^\<li\>Album:,, %xbmc.album)
  79. return
  80. }
  81.  
  82. if (<li>Year: isin %xbmc.read) {
  83. ;echo -s Year - %xbmc.read
  84. noop $regsub(, %xbmc.read, ^<li>Year:,, %xbmc.year)
  85. return
  86. }
  87.  
  88. if (</html> isin %xbmc.read) {
  89. ;echo -s Type: %xbmc.type
  90. ;echo -s Show: %xbmc.show
  91. ;echo -s Title: %xbmc.title
  92. ;echo -s Season: %xbmc.season
  93. ;echo -s Episode: %xbmc.episode
  94. ;echo -s Year: %xbmc.year
  95. ;echo -s Artist: %xbmc.artist
  96. ;echo -s Album: %xbmc.album
  97. ;echo -s Track: %xbmc.track
  98. if (%xbmc.show != $null) {
  99. set %xbmc.result Series: %xbmc.show - %xbmc.season $+ x $+ %xbmc.episode - %xbmc.title
  100. }
  101. elseif (%xbmc.type == video) {
  102. set %xbmc.result Movie: %xbmc.title ( $+ %xbmc.year $+ )
  103. }
  104. elseif (%xbmc.type == audio) {
  105. set %xbmc.result Music: %xbmc.artist - %xbmc.title $chr(91) $+ %xbmc.album $chr(40) $+ %xbmc.year $+ $chr(41) $+ $chr(93)
  106. }
  107. if (%xbmc.type) describe %xbmc.window np %xbmc.result (via XBMC)
  108. unset %xbmc.*
  109. return
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement