mIRC Home    About    Download    Register    News    Help

Print Thread
VLC - Now Playing Script! #245122 11/04/14 12:28 PM
Joined: Apr 2014
Posts: 3
L
Louge Offline OP
Self-satisified door
OP Offline
Self-satisified door
L
Joined: Apr 2014
Posts: 3
Hi , i need help with this VLC script :

Code:
menu channel {

  Now Playing: {
    sockclose vlc
    sockopen vlc localhost 8080 
  }
}
on *:sockopen:vlc: {
  var %login = Password=mypass
  sockwrite -n $sockname POST /requests/status.xml HTTP/1.0
  sockwrite -n $sockname Host: localhost 
  sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
  sockwrite -n $sockname Content-Length: $len(%login) 
  sockwrite -n $sockname %login
}

on *:sockopen:vlc:{
  if $sockerr > 0 { echo -at vlc not running | sockclose vlc }
  sockwrite -n $sockname GET /requests/status.xml HTTP/1.1
  sockwrite -n $sockname Host: localhost
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname $crlf
}

on *:sockread:vlc: {
  if $sockerr > 0 { echo -a error | sockclose vlc }
  sockread %vlcx
  ;echo -a %vlcx

  if (*name='filename'>* iswm %vlcx) {

    if ($regex(%vlcx,<info name='filename'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      set %vlcann1 $regml(1)
    }
  }

  if (*name='Frame rate'>* iswm %vlcx) {
    if ($regex(%vlcx,<info name='Frame rate'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      var %vlcann2 $regml(1)
    }
  }

  if (*name='Codec'>* iswm %vlcx) {
    if ($regex(%vlcx,<info name='Codec'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      var %vlcann3 $regml(1)
      msg $active VLC %vlcann1 :: %vlcann3 $+ @ $+ %vlcann2 fps
      unset %vlcann1
    }
  }


}


The WEBINTERFACE requires a Password (Popup) username is not needed but it doesnt work frown

maybe someone can help smile

Thank You

Re: VLC - Now Playing Script! [Re: Louge] #245127 11/04/14 01:28 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
All of your requests need an authorization header

Code:
sockwrite -n $sockname Authorization: Basic $encode(:password,m)


Re: VLC - Now Playing Script! [Re: Loki12583] #245148 11/04/14 09:43 PM
Joined: Apr 2014
Posts: 3
L
Louge Offline OP
Self-satisified door
OP Offline
Self-satisified door
L
Joined: Apr 2014
Posts: 3
can you include it to my script? i have no idea how to do it frown

thx

Re: VLC - Now Playing Script! [Re: Loki12583] #245149 11/04/14 10:08 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
Just put it with the rest of your headers:

Code:
menu channel {
  Now Playing: {
    sockclose vlc
    sockopen vlc localhost 8080 
  }
}

on *:sockopen:vlc:{
  if $sockerr > 0 { echo -at vlc not running | sockclose vlc }
  sockwrite -n $sockname GET /requests/status.xml HTTP/1.1
  sockwrite -n $sockname Host: localhost
  sockwrite -n $sockname Authorization: Basic $encode(:password,m)
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname $crlf
}

on *:sockread:vlc: {
  if $sockerr > 0 { echo -a error | sockclose vlc }
  sockread %vlcx
  ;echo -a %vlcx

  if (*name='filename'>* iswm %vlcx) {

    if ($regex(%vlcx,<info name='filename'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      set %vlcann1 $regml(1)
    }
  }

  if (*name='Frame rate'>* iswm %vlcx) {
    if ($regex(%vlcx,<info name='Frame rate'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      var %vlcann2 $regml(1)
    }
  }

  if (*name='Codec'>* iswm %vlcx) {
    if ($regex(%vlcx,<info name='Codec'>\s*\K(.+?)(?=\s*<\/info>)) == 1) {
      var %vlcann3 $regml(1)
      msg $active VLC %vlcann1 :: %vlcann3 $+ @ $+ %vlcann2 fps
      unset %vlcann1
    }
  }
}

Re: VLC - Now Playing Script! [Re: Loki12583] #245154 12/04/14 07:07 AM
Joined: Apr 2014
Posts: 3
L
Louge Offline OP
Self-satisified door
OP Offline
Self-satisified door
L
Joined: Apr 2014
Posts: 3
wow , it works fine

Thank YOU smile