Devilin_Pixy

Devilin_Pixy

Joined
Jul 24, 2012
Location
The Netherlands
Website
Interests
Anything creative

Activity Stream

Devilin_Pixy commented on a Page, VLC Now Playing  -  Mar 07, 2014

VLC updated quite some time ago and I am having a problem. VLC changed with a login to access the web interface. A window pops up and it needs a password to be able to use the web interface. There are actually two input fields, but the username should be left blank. I can't figure out how to log in using mIRC. I know how to log in to web pages, but this is a system popup. Any help on how to get my mIRC bot to access the web interface through this log in would be appreciated. Also requested help on the VLC forum in this topic: https://forum.videolan.org/viewtopic.php?f=16&t=116246

 Respond  
Devilin_Pixy commented on a Page, VLC Now Playing  -  Sep 09, 2012

@iamselosa You can use it to show title and duration. The code goes into the remote or create a new remote for it. Make sure to use the right tags for title and duration (v%.ti and %v.le). Depending on the streaming software you use you can make it show on stream. I use XSplit myself and you could output both fields to a text file and then use a remote title in XSplit to read this info for example. To just output it to IRC with the bot it's easy though. Use the right fields that show title and duration/length, then make your !now playing command show the %v.ti and %v.le. So you might want to change the code somewhat and add an 'on TEXT' for your '!now playing'. You do need to use the VLC webinterface as well of course.

@TheWhistler You can show any information a radio station provides. Use the debug window in the code to find what info is put between which tags and use those fields to message to IRC.

If either of you needs more info or help, then don't hestitate to reply or contact me.

 Respond  
Devilin_Pixy commented on a Page, VLC Now Playing  -  Aug 19, 2012

@Ragematix Ok, here is the full script as TheNitelyfe started it with the changes to make it work. This is not the actual script I use myself. I added a debug window to the script which will show the actual output from the status.xml in line 14 and 17. I use this script myself but made changes to display the fields I want it to show in a way I like and made quite a few more edits myself. I added the debug window to make it easier to understand the way this script works to allow your own edits and use other fields if you like. That would need editing this code of course.

alias vlc { 
  if (!$istok(-l -m,$1,32)) { echo 2 -ta * /vlc insufficient paramaters: /vlc -l to echo, -m to message active | return }
  if (!$sock(vlc)) {
    sockopen vlc 127.0.0.1 8080
    sockmark vlc $iif($1 == -m,msg $active,echo -a)
  }
}
on *:sockopen:vlc:{
  sockwrite -nt vlc GET /requests/status.xml HTTP/1.1
  sockwrite -nt vlc Host: 127.0.0.1 $str($crlf,2)
}
on *:sockread:vlc:{
  if ($sockerr) { echo -a Error: $sock(vlc).wsmsg }
  window -de @ $+ $sockName -1 -1 500 500
  var %v
  sockread %v
  aline -p @ $+ $sockName : $+ %v
  if (<state>stopped</state> isin %v || <state>paused</state> isin %v ) { echo -a Error: Not playing any songs! | sockclose vlc }
  else {
    if ($regex(%v,/<(length)>([^>]+)<\/length>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(artist|album|title|bitrate|type|sample rate)'>([^>]+)<\/info>/i)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if (</root> isin %v) { 
      $sock(vlc).mark [VLC] (Type:) %v.ty >> %v.ar - %v.ti < $+ %v.al $+ > (Length:) %v.le (Bit Rate:) %v.bi ( $+ %v.sa $+ ) 
      unset %v.*
      sockclose vlc
    }
  }
}
alias -l hf { return $remove($replace($1-,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#39;,'),<![CDATA[,]]>) }

Any questions, just reply in this thread since I am still following this post.

 Respond  
Devilin_Pixy commented on a Page, VLC Now Playing  -  Aug 05, 2012

@JDHammer67: I just changed the part of the code to get the original code by TheNiteLyfe working again. I use the code when streaming on Twitch TV or Justin TV, but I have edited my own code and integrated it into my chat bot, so there are quite a few changes in my code and I added some code as well to make it work for me. My bot only shows 'now playing' info in chat that I find useful. I do not use the bitrate, type or sample rate, but I use the artist, album, title and a few more fields I added to show 'now playing' correctly for me. Different sources use different tags for the media info. For example, a radio station would use text or text or text. Not sure what exactly isn't shown or handled right in your Videos, but you might want to check the fields/tags VLC outputs in the status.xml. Another change i made in the original code is that I am not letting the script look for the tag, but instead changed that to the tag. This way I am sure I get the full output as well, because there are more fields/tags used after that and the tag seemed to be buggy when I tested it. Speaking of radio stations, the original code echos an error saying there is no song playing when 0 is found in the output status.xml. Well, radiostations playing always show a length of 0 or -1 in some cases, so this doesn't mean nothing is playing. I changed that into checking for stopped or paused instead.

Anyways, I have been fiddling around with the code and changed it to work for me. You might want to add a debug window echoing the actual output to make things more clear. If you can be more specific about the issues you have, I might be able to help you out.

 Respond  
Devilin_Pixy commented on a Page, VLC Now Playing  -  Jul 24, 2012

I am using VLC version 2.0.3 Twoflower and had the same problem. Reason the code does not work anymore is because there have been some changes in the status.xml file. I solved it by changing some of the code. Note that I am still learning how to use $regex() so I changed matching to single lines and not sure how to put it all into one. It does work however, although it might be done shorter.

Change,

  if (<length>0</length> isin %v) { echo -a Error: Not playing any songs! | sockclose vlc }
  else {
    if ($regex(%v,/<(length|title|artist|album)>(.+)<\/.+>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name="(Type|Sample rate|Bitrate)">(.+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if (</information> isin %v) { 
      $sock(vlc).mark [VLC] (Type:) %v.ty >> %v.ar - %v.ti < $+ %v.al $+ > (Length:) %v.le (Bit Rate:) %v.bi ( $+ %v.sa $+ ) 
      unset %v.*
      sockclose vlc
    }
  }
}
alias -l hf { return $remove($replace($1-,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#039;,'),<![CDATA[,]]>) }

to

  if (<length>0</length> isin %v) { echo -a Error: Not playing any songs! | sockclose vlc }
  else {
    if ($regex(%v,/<(length)>([^>]+)<\/length>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(artist)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(album)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(title)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(Bitrate)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(Type)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if ($regex(%v,/<info name='(Sample rate)'>([^>]+)<\/info>/)) { set %v. $+ $left($regml(1),2) $hf($regml(2)) }
    if (</information> isin %v) { 
      $sock(vlc).mark [VLC] (Type:) %v.ty >> %v.ar - %v.ti < $+ %v.al $+ > (Length:) %v.le (Bit Rate:) %v.bi ( $+ %v.sa $+ ) 
      unset %v.*
      sockclose vlc
    }
  }
}
alias -l hf { return $remove($replace($1-,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#39;,'),<![CDATA[,]]>) }

@TheNitelyfe: I hope you can use this to update your code ;-)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.