Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // THE FOLLOWING 3 ARE ALREADY IMPLEMENTED IN SOURCE IN SVN
- floor = [+ 0 $arg1]
- ceil = [
- if (!=f (floor $arg1) $arg1) [
- if (>=f $arg1 0.0) [+ $arg1 1] [- $arg1 1]
- ] [ result $arg1 ]
- ]
- append = [ nodebug [ $arg1 = (concat $$arg1 $arg2) ] ]
- // usage: (breaklist [ LIST ] <PARTS>)
- breaklist = [
- loopconcat i (ceil (divf (listlen $arg1) $arg2)) [
- result [[@@(sublist $arg1 (* $i $arg2) $arg2)]]
- ]
- ]
- init = [ nodebug [ if (=s $$arg1 "") [ $arg1 = $arg2 ] ] ]
- init songlist
- init songlistloop
- init songcurrent
- showmusicbrowser = [
- songlist = []
- loopfiles f "packages/fanatic" "ogg" [ append songlist (escape $f) ]
- songlist = (sortlist $songlist a b [<s $a $b])
- looplist n $songlistloop [
- if (< (indexof $songlist $n) 0) []
- ]
- songlistloop = (listdel $songlistloop (
- loopconcat n (listlen $songlistloop) [
- ? (< (indexof $songlist (at $songlistloop $n)) 0) [at $songlistloop $n]
- ]
- ))
- songlist = (breaklist $songlist 15)
- showgui "musicbrowser"
- ]
- playasong = [
- if $numargs [
- songcurrent = $arg1
- echo "^f7Now playing:^f2" $songcurrent
- ] [
- local len ; len = (listlen $songlistloop)
- if $len [
- songcurrent = (at $songlistloop (mod (+ (indexof $songlistloop $songcurrent) 1) $len))
- echo "^f7Now playing next queue song:^f2" $songcurrent
- ] [
- songcurrent = (at $songlist (rnd (listlen $songlist)))
- songcurrent = (at $songcurrent (rnd (listlen $songcurrent)))
- echo "^f7Now playing random song:^f2" $songcurrent
- ]
- ]
- music (concatword "fanatic/" (unescape $songcurrent) ".ogg") [ playasong ]
- ]
- newgui "musicbrowser" [
- guistayopen [
- loop p (listlen $songlist) [
- if $p [ guitab (concatword " " $p " ") ]
- guilist [
- guitext (concat"^f7Total songs in loop:^f2" (listlen $songlistloop))
- guispring
- guibutton "" [ songlistloop = [] ] "exit"
- ]
- guibar
- looplist n (at $songlist $p) [
- guilist [
- if (< (indexof $songlistloop $n) 0) [
- guibutton " " [ append songlistloop (escape [@@(unescape $n)]) ; echo $songlistloop] "checkbox_off"
- ] [ guibutton " " [ songlistloop = (listdel $songlistloop (escape [@@(unescape $n)])) ; echo $songlistloop] "radio_on" ]
- guilist [
- guistrut 30 1
- guibutton (concatword "^f2" (strreplace (unescape $n) "-" "^f7-")) [ playasong (unescape [@@n]) ] 0
- ]
- ]
- ]
- ]
- ]
- ] "Music Browser"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement