Lecteur mp3 qui passe automatiquement au suivant à la fin

Soyez le premier à donner votre avis sur cette source.

Snippet vu 5 457 fois - Téléchargée 26 fois

Contenu du snippet

Lorsq'un MP3 fini (on mp3end) ca passe au suivant dans la liste :)

Source / Exemple :


;Alias
alias mp3_play {
  if ($dialog(mp3player)) {
    if ($did(mp3player,1).seltext == $null) { echo -a 13•( Player )•14 Aucun MP3 sélectionné | halt }
    set %ItemList $did(mp3player,1).sel
    set %CurrentPlaying %Mp3Dir $+ $did(mp3player,1).seltext $+ .mp3
    var %MP3_Time = $calc($sound(%CurrentPlaying).length / 1000)
    var %MP3_Time = $duration(%MP3_Time)
    splay -p %CurrentPlaying
    if ($mp3(%CurrentPlaying).artist == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    if ($mp3(%CurrentPlaying).title == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    else { echo -a 13•( Player )•14 $mp3(%CurrentPlaying).artist 13-14 $mp3(%CurrentPlaying).title 14[13 $+ %MP3_Time $+ 14] } 
  }
}

alias mp3_pause {
  if ($dialog(mp3player)) {
    if (%Pause == $null) { set %Pause oui | splay -p pause }
    else { splay -p resume | unset %Pause }
  }
}

alias mp3_stop {
  if ($dialog(mp3player)) {
    unset %ItemList 
    splay -p stop 
    echo -a 13•( Player )•14 Lecture stoppée 
  }
}

alias mp3_prev {
  if ($dialog(mp3player)) {
    set %ItemList $calc(%ItemList - 1)
    set %CurrentPlaying %Mp3Dir $+ $did(mp3player,1,%ItemList).text $+ .mp3
    var %MP3_Time = $calc($sound(%CurrentPlaying).length / 1000)
    var %MP3_Time = $duration(%MP3_Time)
    splay -p %CurrentPlaying 
    if ($mp3(%CurrentPlaying).artist == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    if ($mp3(%CurrentPlaying).title == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    else { echo -a 13•( Player )•14 $mp3(%CurrentPlaying).artist 13-14 $mp3(%CurrentPlaying).title 14[13 $+ %MP3_Time $+ 14] } 
  }
}

alias mp3_next {
  if ($dialog(mp3player)) {
    if (%ItemList == $did(mp3player,1).lines) { echo -a 13•( Player )•14 Fin de playlist | halt }
    inc %ItemList
    set %CurrentPlaying %Mp3Dir $+ $did(mp3player,1,%ItemList).text $+ .mp3
    var %MP3_Time = $calc($sound(%CurrentPlaying).length / 1000)
    var %MP3_Time = $duration(%MP3_Time)
    splay -p %CurrentPlaying 
    if ($mp3(%CurrentPlaying).artist == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    if ($mp3(%CurrentPlaying).title == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    else { echo -a 13•( Player )•14 $mp3(%CurrentPlaying).artist 13-14 $mp3(%CurrentPlaying).title 14[13 $+ %MP3_Time $+ 14] } 
  }
}

alias mp3_next_on_end {
  if ($dialog(mp3player)) {
    if (%ItemList == $did(mp3player,1).lines) { halt }
    inc %ItemList
    set %CurrentPlaying %Mp3Dir $+ $did(mp3player,1,%ItemList).text $+ .mp3
    var %MP3_Time = $calc($sound(%CurrentPlaying).length / 1000)
    var %MP3_Time = $duration(%MP3_Time)
    splay -p %CurrentPlaying
    if ($mp3(%CurrentPlaying).artist == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    if ($mp3(%CurrentPlaying).title == $null) { echo -a 13•( Player )•14 $left($nopath(%CurrentPlaying),$calc($len($nopath(%CurrentPlaying)) - 4)) 14[13 $+ %MP3_Time $+ 14] | halt }
    else { echo -a 13•( Player )•14 $mp3(%CurrentPlaying).artist 13-14 $mp3(%CurrentPlaying).title 14[13 $+ %MP3_Time $+ 14] } 
  }
}

alias mp3_config { if ($dialog(mp3player)) { did -r mp3player 1 | set %Mp3Dir $$sdir(C:\,Répertoire de vos MP3s ) | set %MP3 $findfile(%Mp3Dir,*.mp3,0,1,didtok mp3player 1 C $left($nopath($1-),$calc($len($nopath($1-)) - 4))) } }
alias mp3_vol_plus { if ($dialog(mp3player)) { if ($vol(mp3) == 65000) { halt } | vol -p $calc($vol(mp3) + 2000) } }
alias mp3_vol_moins { if ($dialog(mp3player)) { if ($vol(mp3) == 0) { halt } | vol -p $calc($vol(mp3) - 2000) } }

;Dialog
dialog mp3player {
  title "TitaXium Player"
  size -1 -1 381 156

  list 1, 5 30 370 100, size
  button "Play", 2, 30 5 60 20
  button "Pause", 3, 93 5 60 20
  button "Stop", 4, 156 5 60 20
  button "Prev", 5, 219 5 60 20
  button "Next", 6, 282 5 60 20
  button "Config", 7, 254 134 60 20
  button "Fermer", 8, 317 134 60 20, ok
  text ".: TitaXium Player 2 :.", 9, 5 138 120 20
  button "vol +", 10, 140 134 40 20
  button "vol -", 11, 185 134 40 20
}

on *:DIALOG:mp3player:init:*: { set %MP3 $findfile(%Mp3Dir,*.mp3,0,0,didtok mp3player 1 C $left($nopath($1-),$calc($len($nopath($1-)) - 4))) }
on *:DIALOG:mp3player:dclick:1: { mp3_play }
on *:DIALOG:mp3player:sclick:2: { mp3_play }
on *:DIALOG:mp3player:sclick:3: { mp3_pause }
on *:DIALOG:mp3player:sclick:4: { mp3_stop }
on *:DIALOG:mp3player:sclick:5: { mp3_prev }
on *:DIALOG:mp3player:sclick:6: { mp3_next }
on *:DIALOG:mp3player:sclick:7: { mp3_config }
on *:DIALOG:mp3player:sclick:10: { mp3_vol_plus }
on *:DIALOG:mp3player:sclick:11: { mp3_vol_moins }
on *:MP3END: { mp3_next_on_end }

Conclusion :


++

A voir également

Ajouter un commentaire

Commentaires

Commenter la réponse de cs_HeXoR

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.