Radio-world-one player

Description

Voila, c'est mon premier post ici, cela fait depuis le mois de février 2008 que je me suis mis à Scripter,
Je monte actuellement un script complet, et je voulais partager avec vous, d'un élément qui en fait parti, un Player Radio, il est simple mais trés efficace, et je tenais à remercier celui qui a poster le code OneRadioPlayer, car sans lui, je n'aurai pas pu faire cette remote.
J'imagine que les critiques seront la, mais cela permet souvent de progresser donc, n'hésitez pas :) !!!

Source / Exemple :


;********************************************************************
;*---------- Remote Radio-World-One  ----- Version 2.1 ----- 02/09 -*
;********************************************************************
;*---------------Created and Scripted by PsychoFlex-----------------*
;********************************************************************
;*  http://www.Another-world.fr   /   irc.Another-world.fr : 13005  *
;********************************************************************
;********************* PsychoFlex@another-world.fr ******************
;********************************************************************
;*-IMPORTANT : NE PAS TOUCHER SINON CELA NE FONCTIONNE PLUS, MERCI!-*
;********************************************************************
;*******************************
;*** DEFINITION MENU CHANNEL ***
;*******************************
menu channel {
  Radio-World-One: Radioworldone 
}
;***************************
;*** DEFINITION DIALOGUE ***
;***************************
dialog Radio {
  title "Radio-World-One Player"
  icon $scriptdirbmp\Another.ico, 0
  size -1 -1 157 60
  option dbu
  box " Radio-World-One ", 1, 5 3 147 55
  list 2, 8 40 15 15, size
  list 3, 22 40 15 15, size
  list 4, 36 40 15 15, size
  list 5, 50 40 15 15, size
  check ">", 6, 138 13 10 10, push 
  button "Annoncer", 7, 100 41 35 12, center
  edit "", 8, 8 27 141 10, read center autohs 
  text "<< Actuellement à l'Antenne >>", 9, 45 15 85 8, right
  edit "", 10, 8 14 30 10, read center
  combo 11, 8 65 140 40, size drop
}
on 1:dialog:Radio:*:*: {
  if ($devent == init) {
    if ($hget(WorldOne) != WorldOne) hmake WorldOne 100 
    .World.Plug
    .WorldOne.stop
    mdx SetMircVersion $version 
    mdx MarkDialog $dname $dialog(radio).hwnd radio
    mdx SetBorderStyle $dname 8,10 clientedge
    mdx SetBorderStyle $dname 6,7 staticedge
    mdx SetFont $dname 1,6,7,8,9,10,11 14 900 Arial   
    mdx SetColor 2,3,4,5,6,7,9 background $rgb(1,2,30) 
    mdx SetColor 9 textbg $rgb(1,2,30) 
    mdx SetColor 9 text [ $rgb(192,192,192) ]
    mdx SetColor 8,10 background $rgb(0,0,0) 
    mdx SetColor 8,10 textbg $rgb(0,0,0) 
    mdx SetColor 8,10 text [ $rgb(55,155,255) ]
    mdx SetColor 1 background $rgb(180,180,180)
    mdx SetDialog $dname bgcolor $rgb(1,2,30)
    mdx SetControlMDX $dname 2,3,4,5 ToolBar flat nodivider > $bars
    mdx SetBorderStyle $dname 2,3,4,5 
    did -i $dname 2,3,4,5 1 bmpsize 22 22
    did -i $dname 2 1 setimage +nh 0 bmp $img(Lecture)
    did -i $dname 3 1 setimage +nh 0 bmp $img(vol+)
    did -i $dname 4 1 setimage +nh 0 bmp $img(vol-)
    did -i $dname 5 1 setimage +nh 0 bmp $img(Sons)
    did -a $dname 2 1 $chr(9) $+ Lecture/Stop
    did -a $dname 3 1 $chr(9) $+ Augmenter le Volume
    did -a $dname 4 1 $chr(9) $+ Diminuer le Volume
    did -a $dname 5 1 $chr(9) $+ Mode Silence
    did -a $dname 11 Canal Actif
    did -a $dname 11 Tous les Canaux du Serveur
    did -a $dname 11 Canal Actif sur Tous les Serveurs
    did -a $dname 11 Tous les Canaux de Tous les Serveurs
    if ($gettok(%WorldOne,1,32) > 0) did -c $dname 11 $gettok(%WorldOne,1,32) 
    else did -c $dname 11 1 
    if ($gettok(%WorldOne,2,32) > 0) var %a $WorldOne.Amp(misc,setvolume $gettok(%WorldOne,2,32)) 
    if ($gettok(%WorldOne,3,32) = 0) did -u $dname 6 
    did -ra $dname 6 $iif($gettok(%WorldOne,3,32) = 1,<,>) 
    dialog -sb $dname -1 -1 157 $iif($gettok(%WorldOne,3,32) = 1,80,60) 
  }
  if ($devent == sclick) {
    if ($did == 2) WorldOne.lecture 
    if ($did == 3) World.vol +20  
    if ($did == 4) World.vol -20 
    if ($did == 5) { if ($rrad(Sons) == off) { vol -vu1 $vol(master) | did -i $dname 5 1  setimage +nh 1 bmp $img(SSons) | .wrad Sons on } | else { vol -vu2 $vol(master) | did -i $dname 5 1  setimage +nh 1 bmp $img(Sons) | .wrad Sons off } } 
    if ($did == 6) { 
      set %WorldOne $did(Radio,11).sel $mid($dll($WorldOne.Amp,Misc,getvolume),4) $did(Radio,6).state 
      did -ra $dname 6 $iif($gettok(%WorldOne,3,32) = 1 ,<,>) 
      dialog -sb Radio -1 -1 157 $iif($gettok(%WorldOne,3,32) = 1,80,60) 
    }
    if ($did == 7) .timerRWO 1 3 WorldOne.All $did(Radio,11).sel écoute 6[8 $hget(WorldOne,stream) 6]11 sur 6[9 #13Radio9-13World9-13One 6]9-13[ 6A9-13n9-6o9-13t9-6h9-13e9-6r9-15-9-6S9-13c9-6r9-13i9-6p9-13T6?9-13V06 $+ 209 $+ .06 $+ 0 13]
  }
  if ($devent == close) {
    set %WorldOne $did(Radio,11).sel $mid($dll($WorldOne.Amp,Misc,getvolume),4) $did(Radio,6).state
    WorldOne.stop 
  }
}
;****************************
;*** DEFINITION DES ALIAS ***
;****************************
alias F7 Radioworldone 
alias Radioworldone dialog $iif($dialog(Radio),-ie Radio Radio,-omd Radio Radio)

alias -l mdx { var %dll = $scriptdir\dll\mdx.dll | return $dll(%dll,$1,$2-) }
alias -l bars return $scriptdir\dll\BARS.MDX 
alias -l WorldOne.Amp return $scriptdirplugins\amp_in.dll
alias -l img { return $scriptdirbmp\ $+ $$1 $+ .bmp }
alias -l wrad { .writeini Radio-World-One\Radio-World-One.ini Setup $1- }
alias -l rrad { return $readini(Radio-World-One\Radio-World-One.ini,Setup,$1) }
alias -l Radioworld { return $readini(Radio-World-One\Radio-World-One.ini,WorldOne,$1) }
alias -l World.Plug {
  var %a $dll($WorldOne.Amp,PluginManager,load input $scriptdirplugins\in_vorbis.dll)
  var %a $dll($WorldOne.Amp,PluginManager,load input $scriptdirplugins\in_mp3.dll)
  var %a $dll($WorldOne.Amp,PluginManager,load output $scriptdirplugins\out_ds.dll)
}
alias -l t.f return $iif($len($1) == 1,$+(0,$1),$1)
alias -l WorldOne.time { 
  var %a $gettok($dll($WorldOne.Amp,CurrentMusic,position),2,32),%x $int($calc(%a / 1000 / 60)) 
  var %h $int($calc(%x / 60)),%m $int($calc(%x - %h * 60)),%s $int($calc(%a / 1000 - 60 * %x)) 
  var %b $+($t.f(%h),:,$t.f(%m),:,$t.f(%s)) 
  if ($did(Radio,10) != %b) did -ra Radio 10 %b 
}
alias -l WorldOne.afftime {
  WorldOne.time
  var %a $WorldOne.current
  if ($did(Radio,8) != %a) { did -ra Radio 8 %a | did -u Radio 8 1 1 }
}
alias -l WorldOne.lecture {
  if ($dll($WorldOne.Amp,CurrentMusic,status) == OK playing) { WorldOne.stop | did -i Radio 2 1 setimage +nh 1 bmp $img(Lecture) }
  else {
    var %b $Radioworld(adresse)
    if $right(%b,3) != ogg { var %a $dll($WorldOne.Amp,Play, $+ %b $+ .mp3) }
    else var %a $dll($WorldOne.Amp,Play,%b) 
    .timerWorldOne -iom 0 1000 WorldOne.afftime
    did -i Radio 2 1 setimage +nh 1 bmp $img(Stop)
  }
}
alias -l WorldOne.stop {
  var %a $dll($WorldOne.Amp,Stop,.)
  did -i radio 2 1 setimage +nh 1 bmp $img(Lecture) 
  .timerWorldOne off
  did -r Radio 8
  did -ra Radio 10 --:--:--
}
alias -l World.vol {
  var %a $dll($WorldOne.Amp,Misc,setvolume $calc($mid($dll($WorldOne.Amp,Misc,getvolume),4) + $1))
  var %a $mid($dll($WorldOne.Amp,Misc,getvolume),4)
  if (%a < 0) var %a $dll($WorldOne.Amp,Misc,setvolume 0)
  elseif (%a > 260) var %a $dll($WorldOne.Amp,Misc,setvolume 260)
}
alias -l WorldOne.current {
  if ($mid($dll($WorldOne.Amp,CurrentMusic,status),4) != stopped) {
    var %a $mid($dll($WorldOne.Amp,CurrentMusic,title),3)                                                         
    var %b $remove(%a,$chr(40),$chr(41),$chr(93),$chr(91),$chr(123),$chr(125))                                                                                                                    
    if (($chr(40) isin %a) && ($len($gettok(%a,1,40)) > 1) ) {
      hadd WorldOne stream $gettok(%a,1- $+ $WorldOne.testtitreradio(%a) $+ ,40)                                
      var %d = $wildtok(%a,#*,1,32)           
      if ($hget(WorldOne,stream2) != %d) {
        hadd WorldOne stream2 %d 
      }
    }
    else {
      if ((timed out isin %a) || (could not connect isin %a) || (unknown host isin %a)) { }
      elseif (([ICY 200 OK] isin %a) || (HTTP/ isin %a)) { hdel WorldOne stream2 }
      elseif (connecting isin %a) { hdel WorldOne stream2 | hadd WorldOne stream connection... }
      elseif (buffer isin %a) { hdel WorldOne stream2 | hadd WorldOne stream Mise en mémoire tampon... }
      else { 
        if ($len($hget(WorldOne,stream2)) == 0) {
          hadd WorldOne stream $remove(%a,$chr(40),$chr(41)) 
          hadd WorldOne stream2 $remove(%a,$chr(40),$chr(41)) 
        }
      }
    }
    return $hget(WorldOne,stream)
  }
  else WorldOne.stop
}
alias -l WorldOne.testtitreradio { 
  var %a $remove($1-,$chr(32)),%x $numtok(%a,40) 
  while (%x)  { 
    if ($right($gettok(%a,%x,40),1) != $chr(41)) return %x 
    dec %x 
  } 
} 
on 1:ACTIVE:*: {
  if ($dialog(Radio) == Radio) && ($len($server) > 0) && (# isin $active) hadd WorldOne cid $cid $active
}
alias -l WorldOne.All {
  if ($mid($dll($WorldOne.Amp,CurrentMusic,status),4) != stopped) {
    if (1 == $1) {
      scid $gettok($hget(WorldOne,cid),1,32)
      describe $gettok($hget(WorldOne,cid),2,32) $2-
    }
    elseif (2 == $1) {
      scid $gettok($hget(WorldOne,cid),1,32)
      ame $2-
    }
    elseif (3 == $1) {
      Scon -at1 WorldOne.Aff $gettok($hget(WorldOne,cid),2,32) $2-
    }
    elseif (4 == $1) {
      Scon -at1 ame $2-
    }
  }
} 
alias -l WorldOne.Aff { 
  var %y $chan(0) 
  while (%y) { 
    if  (($chan(%y) isin $1) || ($1 == ALL)) describe $chan(%y) $2- 
    dec %y 
  } 
}
ON 1:LOAD:{ echo -a 12Merci $me $+ , d'avoir installé 6[13 Radio-World-One Player V2.1 6] 7By PsychoFlex 12et bonne utilisation et écoute 4!!! 9- 6( Petit Rappel : 13Il est conseillé d'être connecté pour l'utiliser 6) }
ON 1:UNLOAD:{ echo -a 12Désinstallation de 6[13 Radio-World-One Player V2.1 6] 7By PsychoFlex 12est 4terminée, 12Merci pour votre utilisation de 4Radio-World-One Player!!! }

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.