Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Alarm Clock...Mp3 player
- menu * {
- Mp3: player
- }
- alias player {
- if ($dialog(clock)) { dialog -c clock clock | dialog -m clock clock | .remove sounds.txt }
- else { dialog -m clock clock }
- }
- alias pause.playback { splay pause | xdid -k clock 6 +nhs $rgb(255,255,255) $mircdirimages\pause.png }
- alias resume.playback { splay resume | xdid -k clock 6 +nhs $rgb(255,255,255) $mircdirimages\play.png }
- alias alarm {
- .timer.alarm -o %alarm.time 1 1 splay $read(sounds.txt)
- set %alarm.on $true
- echo -a Now Playing... $read(sounds.txt,$readn)
- }
- on *:INPUT:*: {
- if (%alarm.on == $true) && ($insong) { splay stop | set %alarm.on $false }
- if ($1 == !alarm) {
- if ($2 == on) {
- if ($3) {
- set %alarm on
- set %alarm.time $3
- alarm
- }
- else {
- echo -a You must supply a time that you wish the alarm to go off at... (24hr format)
- }
- }
- if ($2 == off) {
- set %alarm off
- .timer.alarm off
- }
- }
- }
- on *:MP3END: {
- if (%filename) { did -c clock 10 $didwm(clock,10, $+(*,%filename,*)) | unset %filename }
- write previous.txt $did(clock,10).seltext | play.next
- }
- on *:MIDIEND: {
- if (%alarm.on == $true) {
- play.next
- }
- else {
- unset %alarm*
- }
- }
- on *:WAVEEND: {
- if (%alarm.on == $true) {
- play.next
- }
- else {
- unset %alarm*
- }
- }
- dialog clock {
- title "Clock"
- size -1 -1 300 100
- option dbu
- menu "Alarm", 2
- item "Alarm", 5 disable
- item break, 6
- item "", 3 1
- item "", 4 2
- }
- alias load.music {
- if (%play.favs == $true) { %x = 1 | while (%x <= $lines(mp3.favorites.txt)) { did -a clock 10 $read(mp3.favorites.txt,n,%x) | inc %x } }
- else { %x = 1 | while (%x <= $lines(sounds.txt)) { did -a clock 10 $read(sounds.txt,n,%x) | inc %x } }
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;TODO: Work out using playlists
- alias load.playlists {
- if (%play.playlist == $true) { %x = 1 | while (%x <= $lines(playlists.pl)) { did -a clock 10 $read(playlists.pl,n,%x) | inc %x } }
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- alias clock.time { return $asctime(hh:nn TT) }
- alias update {
- if ($gettok($asctime(hh:nn:ss), 2, 58) != %time) {
- %time = $gettok($asctime(hh:nn:ss), 2, 58)
- did -o clock 2 $clock.time
- }
- if ($insong) && (!$did(clock,10).seltext) {
- did -c clock 10 $didwm(clock,10,$+(*,$nopath($insong.fname),*))
- }
- populate
- }
- alias clock.cb {
- if ($2 == changing) { %pos.x = $5 | %pos.y = $6 }
- if ($2 == mwheel) && ($3 == 26) {
- if ($4 == up) { xdid -v clock 26 $calc($xdid(clock,26).value + 1) | splay seek $calc(($xdid(clock,26).value * 1000) + 1000) }
- if ($4 == down) { xdid -v clock 26 $calc($xdid(clock,26).value - 1) | splay seek $calc(($xdid(clock,26).value * 1000) - 1000) }
- }
- if ($2 == mousebar) {
- if ($insong) { splay seek $calc($7 * 1000) | xdid -v clock 26 $4 }
- }
- if ($2 == rclick) {
- if ($3 == 10) { list.menu }
- if ($3 == 0) { dialog.menu }
- if ($3 == 26) && ($4) { %position = $4 | progbar.menu }
- else { return }
- }
- if ($2 == mouseenter) { } ;
- if ($2 == mouseenter) && ($3 == 20) { .timer.focus.vol -m 1 500 xdid -F clock 20 }
- if ($2 == mouseenter) && ($3 == 0) || ($3 == 12) {
- if ($timer(.focus.vol) != $null) { .timer.focus.vol off }
- if ($timer(.focus.pbar) != $null) { .timer.focus.pbar off }
- }
- if ($2 == mouseenter) && ($3 == 26) { xdid -T clock 26 This is a test | .timer.focus.pbar -m 1 500 xdid -F clock 26 }
- if ($2 == tracking) { }
- if ($regex($2, /(trackend|lineup|linedown|pagedown|pageup)/)) && ($3 == 20) {
- xdid -t clock 24 $xdid(clock,20).value $+ %
- if ($4 < 10) { %decimal = 0.0 $+ $4 | %vol = $calc(65535*%decimal) | vol -p %vol }
- else { %decimal = 0. $+ $4 | %vol = $remove($left($calc(65535*%decimal),5),$chr(46)) | vol -p %vol }
- if ($4 == 100) { vol -p 65535 }
- }
- if ($2 == dclick) && ($3 == 10) {
- if ($regex($xdid(clock,10, $xdid(clock,10).sel).text, /(.*\.pl))) {
- %playlist = $xdid(clock,10, $xdid(clock,10).sel).text
- }
- else { unset %artist | unset %count | xdid -v clock 26 0 | splay $xdid(clock,10, $xdid(clock,10).sel).text | %track = $4 | populate | $spam(srs) }
- if (%filename) { unset %filename }
- }
- if ($2 == sclick) {
- if ($3 == 26) {
- if ($insong) { echo -a $4 | xdid -t clock 9 $gettok($duration($calc($insong.pos / 1000),3),2-,58) | splay seek $calc($4 * 1000) | xdid -v clock 26 $4 }
- if ($insong == $false) { play.next }
- }
- if ($3 == 5) {
- if ($insong.pause == $true) { xdid -t clock 6 ► }
- write previous.txt $did($dname,10).seltext | play.next
- }
- if ($3 == 6) && ($insong == $true) {
- if ($insong.pause == $true) { resume.playback }
- else { pause.playback }
- }
- if ($3 == 6) && ($insong == $false) { play.next }
- if ($3 == 16) { did -h clock 2-14 | id3.info | did -v clock 17 | did -f clock 10 }
- if ($3 == 15) { did -v clock 2-14 | did -h clock 17 }
- if ($3 == 7) { stop.playback | unset %artist %title %length | echo -a Playback stopped.
- if ($insong.pause == $true) { xdid -t clock 6 ► }
- }
- if ($3 == 8) {
- if ($exists(previous.txt)) && ($lines(previous.txt) > 0) { play.previous }
- else { echo -a No previously played tracks found... Play something first. }
- }
- if ($3 == 10) && ($insong == $true) { %filename = $nopath($insong.fname) }
- }
- }
- alias clock.init {
- dcx Mark $dname clock.cb
- dialog -s clock $readini(config.ini,position,x) $readini(config.ini,position,y) -1 -1
- ;;---Dialog color
- xdialog -g clock +b $rgb(0,0,0)
- ;;---dialog buttons
- xdialog -c clock 5 button 32 30 20 20 bitmap
- xdid -k $dname 5 +nhs $rgb(255,255,255) $mircdirimages\next.png
- xdialog -c clock 6 button 10 30 20 20 bitmap
- xdid -k $dname 6 +nhs $rgb(255,255,255) $mircdirimages\play.png
- xdialog -c clock 7 button 54 30 20 20 bitmap
- xdid -k $dname 7 +nhs $rgb(255,255,255) $mircdirimages\stop.png
- xdialog -c clock 8 button 77 30 20 20 bitmap
- xdid -k $dname 8 +nhs $rgb(255,255,255) $mircdirimages\previous.png
- ;;--- Text controls
- ;;--Checkboxes & text beside them
- xdialog -c clock 13 check 160 13 20 20 right
- xdialog -c clock 14 check 160 37 20 20 right
- xdialog -c clock 21 text 100 15 60 30 right
- xdialog -c clock 22 text 100 40 60 30 right
- xdid -t clock 21 Shuffle:
- xdid -C clock 13 +b $rgb(0,0,0)
- xdid -C clock 21 +b $rgb(0,0,0)
- xdid -C clock 21 +k $rgb(0,0,0)
- xdid -C clock 21 +t $rgb(130,192,255)
- ; xdid -C clock 13 +k $rgb(0,0,0)
- xdid -C clock 13 +t $rgb(130,192,255)
- ;;--Repeat Text
- xdid -t clock 22 Repeat:
- xdid -C clock 14 +b $rgb(0,0,0)
- xdid -C clock 22 +b $rgb(0,0,0)
- xdid -C clock 22 +k $rgb(0,0,0)
- xdid -C clock 22 +t $rgb(130,192,255)
- ;;---Volume Trackbar
- xdialog -c $dname 20 trackbar 190 17 100 30 smooth autoticks downisleft
- xdid -c clock 20 74
- xdid -C clock 20 +b $rgb(0,0,0)
- xdid -C clock 20 +k $rgb(0,0,0)
- xdid -n clock 20 10
- ;;---Volume Text
- xdialog -c clock 23 text 180 5 60 20 right
- xdid -t clock 23 Volume:
- xdid -C clock 23 +b $rgb(0,0,0)
- xdid -C clock 23 +k $rgb(0,0,0)
- xdid -C clock 23 +t $rgb(130,192,255)
- ;;--Volume percentage text
- xdialog -c clock 24 text 240 5 30 15 right
- xdid -t clock 24 100%
- xdid -C clock 24 +b $rgb(0,0,0)
- xdid -C clock 24 +k $rgb(0,0,0)
- xdid -C clock 24 +t $rgb(130,192,255)
- ;;---Listview
- xdialog -c clock 10 list 395 10 200 180 sort hsbar vsbar
- xdid -C clock 10 +b $rgb(0,0,0)
- xdid -C clock 10 +t $rgb(130,192,255)
- xdid -x clock 10 +w
- xdialog -c clock 12 box 5 65 230 110 left rounded
- xdid -c clock 12 26 pbar 15 20 200 50 notheme smooth
- xdid -c clock 12 9 text 15 75 30 20
- xdid -c clock 12 11 text 185 75 30 20
- xdid -t clock 12 Now Playing:
- xdid -C clock 12 +b $rgb(0,0,0)
- xdid -C clock 12 +t $rgb(130,192,255)
- xdid -C clock 12 +r $rgb(255,255,255)
- xdid -o clock 26 0
- xdid -k clock 26 $rgb(78,78,78)
- xdid -j clock 26 p
- xdid -c clock 26 $rgb(0,0,0)
- xdid -q clock 26 $rgb(130,192,255)
- xdid -i clock 26 Click here to start playback.
- xdid -T clock 26 test
- xdid -t clock 9 00:00
- xdid -t clock 11 00:00
- xdid -C clock 9 +b $rgb(0,0,0)
- xdid -C clock 9 +k $rgb(0,0,0)
- xdid -C clock 9 +t $rgb(130,192,255)
- xdid -C clock 11 +b $rgb(0,0,0)
- xdid -C clock 11 +k $rgb(0,0,0)
- xdid -C clock 11 +t $rgb(130,192,255)
- xdialog -T clock +pb
- }
- on *:dialog:clock:init:0: { unset %count | clock.init | apply.settings | %populate = $findfile($mircdir/sounds,*.mp3,0,write sounds.txt $nopath($1-)) | load.music | .timer.update -o 0 1 update | xdid -v clock 26 $gettok($calc($insong.pos / 1000),1,46) }
- on *:dialog:clock:close:0: { save.settings | .timer.update off | .remove sounds.txt | .remove previous.txt | unset %time %position %count %decimal %playing %vol %artist %pos.x %pos.y }
- on *:START: {
- if ($exists(sounds.txt) == $false) {
- echo -a 07Loading sound files...
- $findfile($mircdir/sounds,*.mp3,0,write sounds.txt $nopath($1-))
- }
- }
- on *:dialog:clock:menu:*: {
- if ($did == 4) {
- did -o $dialog($dname) 4 Off
- did -o $dialog($dname) 3 On
- unset %alarm*
- did -c $dname 4
- if ($did($dname,3).state == 1) { did -c $dname 3 }
- echo -a $did($dname,$did).text
- }
- if ($did == 3) {
- did -o $dialog($dname) 4 Off
- %alarm.time = $?="Set Alarm: e.g hour:minute (12:30)"
- $iif(%alarm.time != $null, echo -a Alarm set for %alarm.time, %alarm.time = $?="Set Alarm: e.g hour:minute (12:30)")
- did -o $dialog($dname) 3 On - Time: %alarm.time
- did -c $dname 3
- if ($did($dname,4).state == 1) { did -c $dname 4 }
- alarm
- }
- else { echo -a $devent $did }
- }
- alias play.previous {
- xdid -v clock 26 0
- unset %artist
- splay $read(previous.txt,$lines(previous.txt))
- %track = $readn
- did -c clock 10 $didwm(clock,10, * $+ $read(previous.txt,$lines(previous.txt)) $+ *)
- write -d previous.txt
- populate
- }
- alias hmm { %lol = $calc($xdid(clock,10).sel + 1) | xdid -c clock 10 %lol | splay $xdid(clock,10,%lol).text }
- ;counts backwards from song total length to 0
- ;$duration($gettok($calc(($insong.length - $insong.pos) / 1000),1,46),3)
- alias populate {
- if ($insong) {
- ;if ($read($sound($insong.fname).genre $+ .pl,w, $insong.fname)) { hmm }
- ;else { echo -a match not found, writing to genres... $nopath($insong.fname) | write $mircdirsounds/genres $+ $remove($sound($insong.fname).genre $+ .pl,$chr(32)) $insong.fname }
- if (!%artist) {
- %artist = $sound($insong.fname).artist -
- %title = $sound($insong.fname).title -
- %length = $sound($insong.fname).length
- xdid -r clock 26 0 $gettok($calc(%length / 1000),1,46)
- ;echo -a $xdid(clock,26).range $duration($gettok($xdid(clock,26).range,2,32))
- }
- if ($insong.pause != $true) {
- inc %count
- if (!%count) { xdid -v clock 26 1 | %count = 1 }
- if (%count == 1) {
- if (%artist == -) { xdid -t clock 12 Now Playing: | xdid -i clock 26 No ID3 info, using filename. }
- else { xdid -t clock 12 Now Playing: | xdid -i clock 26 %artist % $+ d% $+ % }
- }
- if (%count == 10) {
- if (%title == -) { xdid -t clock 12 Title: | xdid -i clock 26 $nopath($insong.fname) }
- else { xdid -t clock 12 Title: | xdid -i clock 26 %title % $+ d% $+ % }
- }
- ;else { echo -a else | xdid -t clock 12 Now Playing: | xdid -i clock 26 %artist % $+ d% $+ % }
- if (%count == 20) { %count = 0 }
- xdid -v clock 26 $calc($xdid(clock,26).value + 1.5)
- xdid -t clock 9 $gettok($duration($calc($insong.pos / 1000),3),2-,58)
- xdid -t clock 11 $gettok($duration($gettok($calc(%length / 1000),1,46),3),2-,58)
- }
- }
- }
- alias play.next {
- unset %artist
- unset %count
- xdid -v clock 26 0
- if (%play.favs == $false) {
- if ($xdid(clock,14).state == 1) && ($xdid(clock,13).state == 0) || ($xdid(clock,13).state == 1) {
- if ($xdid(clock,10).sel > 0) {
- splay $xdid(clock,10,$xdid(clock,10).sel).text
- }
- }
- if ($did(clock,13).state == 0) && ($xdid(clock,14).state == 0) {
- if (!$did(clock,10).sel) {
- %track = $did($dname,10).sel
- did -c clock 10 1
- splay $did(clock,10).seltext
- }
- else {
- ;echo -a something is selected in the list
- %track = $did(clock,10).sel
- did -c clock 10 $calc(%track + 1)
- splay $did(clock,10).seltext
- }
- }
- if ($xdid(clock,13).state == 1) && ($xdid(clock,14).state == 0) {
- splay $read(sounds.txt)
- ; echo -a shuffle mode on $readn
- %track = $readn
- did -c clock 10 $didwm(clock,10, * $+ $read(sounds.txt,n,%track) $+ *)
- }
- }
- else {
- if ($xdid(clock,14).state == 1) && ($xdid(clock,13).state == 0) || ($xdid(clock,13).state == 1) {
- if ($xdid(clock,10).sel > 0) {
- splay $xdid(clock,10,$xdid(clock,10).sel).text
- }
- }
- if ($did(clock,13).state == 0) && ($xdid(clock,14).state == 0) {
- if (!$did(clock,10).sel) {
- %track = $did($dname,10).sel
- did -c clock 10 1
- splay $did(clock,10).seltext
- ;%length = $duration($gettok($calc($insong.length / 1000),1,46),3) 4
- }
- else {
- ;echo -a something is selected in the list
- %track = $did(clock,10).sel
- did -c clock 10 $calc(%track + 1)
- splay $did(clock,10).seltext
- }
- }
- if ($xdid(clock,13).state == 1) && ($xdid(clock,14).state == 0) {
- splay $read(mp3.favorites.txt)
- ;echo -a shuffle mode on $readn
- %track = $readn
- did -c clock 10 $didwm(clock,10, * $+ $read(mp3.favorites.txt,n,%track) $+ *)
- }
- }
- populate
- $spam(srs)
- }
- ;;;;;-----Settings configuration
- alias save.settings {
- writeini config.ini shuffle shuffle $did(clock,13).state
- writeini config.ini repeat repeat $did(clock,14).state
- writeini config.ini volume volume $xdid(clock,20).value
- writeini config.ini favorites favorites %play.favs
- writeini config.ini alarm alarm $did(clock,3).state
- writeini config.ini position x %pos.x
- writeini config.ini position y %pos.y
- }
- alias apply.settings {
- if ($readini(config.ini,shuffle,shuffle) == 1) { did -c clock 13 }
- if ($readini(config.ini,repeat,repeat) == 1) { did -c clock 14 }
- xdid -v clock 20 $readini(config.ini,volume,volume)
- xdid -t clock 24 $readini(config.ini,volume,volume) $+ %
- %play.favs = $readini(config.ini,favorites,favorites)
- if ($readini(config.ini, alarm,alarm) == 1) { did -o clock 3 On - Time: %alarm.time | did -c clock 3 | did -o clock 4 Off | .timer.alarm -o %alarm.time 1 1 splay $read(sounds.txt) }
- else { did -o clock 4 Off | did -c clock 4 | did -o clock 3 On }
- }
- ;;-------Menus
- alias playing {
- if ($insong) { return $sound($insong.fname).artist - $sound($insong.fname).title }
- else { return Nothing playing. }
- }
- alias list.menu {
- if ($xpopup(list.menu).ismenu) xpopup -d list.menu
- xpopup -c list.menu normal
- xpopup -p list.menu $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(130,192,255) $rgb(130,192,255)
- xpop -a list.menu 1 $chr(9) +gc 0 1 $playing
- xpop -a list.menu 2 $chr(9) +g 215 3
- xpop -a list.menu 3 $chr(9) +s 125 3 Favorites
- xpop -a list.menu 3 1 $chr(9) + 10 3 Add
- xpop -a list.menu 3 2 $chr(9) + 11 3 Remove
- xpop -a list.menu 4 $chr(9) +s 125 3 Playlists (Not Implemented)
- xpop -a list.menu 5 $chr(9) $state 125 2 Play Favorites
- xpop -a list.menu 6 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 3 $iif($insong.pause == $false, Pause, Unpause)
- xpop -a list.menu 7 $chr(9) + 227 3 Previous
- xpop -a list.menu 8 $chr(9) + 228 3 Stop
- xpop -a list.menu 9 $chr(9) + 229 3 Next
- xpop -a list.menu 10 $chr(9) + 231 1 Edit ID3
- xpopup -s list.menu + $calc($mouse.dx - 55) $mouse.dy
- }
- alias state {
- if (%play.favs == $true) { return +c }
- else { return + }
- }
- alias stop.playback { splay stop | xdid -v clock 26 0 | xdid -t clock 12 Playback stopped: | xdid -i clock 26 Click here to start playback. | xdid -t clock 9,11 00:00 }
- ON *:SIGNAL:Xpopup-*: {
- var %m $gettok($signal, 2-, 45)
- if ($1 == 0) { return }
- if ($1 == 225) { splay seek $calc(%position * 1000) | xdid -v clock 26 %position }
- if ($1 == 226) { $iif($insong.pause == $false, pause.playback, resume.playback) }
- if ($1 == 227) { play.previous }
- if ($1 == 228) { stop.playback }
- if ($1 == 229) { play.next }
- if ($1 == 231) { $id3.open }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;TODO
- if ($1 == 230) { echo -a Not implemented yet... }
- ;echo -a Loading Playlists.pl... | %play.playlist = $true | xdid -r clock 10 | load.playlists ;}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- if ($1 == 10) { write mp3.favorites.txt $xdid(clock,10,$xdid(clock,10).sel).text }
- if ($1 == 125) {
- if (exists(mp3.favorites.txt) == $false) || ($lines(mp3.favorites.txt) == 0) { echo -a You need to add files to the list of favorites before you can play Favorites. | halt }
- if (!%play.favs) { %play.favs = $false }
- if (%play.favs == $true) { %play.favs = $false }
- else { %play.favs = $true }
- if (exists(mp3.favorites.txt)) && (%play.favs == $true) { echo -a loading favorites | did -r clock 10 | load.music }
- else { echo -a loading normal playlist... | did -r clock 10 | load.music }
- }
- }
- alias progbar.menu {
- if ($xpopup(progbar.menu).ismenu) xpopup -d progbar.menu
- xpopup -c progbar.menu normal
- xpopup -p progbar.menu $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(130,192,255) $rgb(130,192,255)
- xpop -a progbar.menu 1 $chr(9) +gc 0 1 $playing
- xpop -a progbar.menu 2 $chr(9) +g 215 3
- xpop -a progbar.menu 3 $chr(9) + 225 3 Seek to: $duration(%position)
- xpop -a progbar.menu 4 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 2 $iif($insong.pause == $false, Pause, Unpause)
- xpop -a progbar.menu 5 $chr(9) + 227 3 Previous
- xpop -a progbar.menu 6 $chr(9) + 228 3 Stop
- xpop -a progbar.menu 7 $chr(9) + 229 3 Next
- xpopup -s progbar.menu + $calc($mouse.dx - 55) $mouse.dy
- }
- alias dialog.menu {
- if ($xpopup(dialog.menu).ismenu) xpopup -d dialog.menu
- xpopup -c dialog.menu normal
- xpopup -p dialog.menu $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(0,0,0) $rgb(0,0,0) $rgb(130,192,255) $rgb(130,192,255) $rgb(130,192,255)
- xpop -a dialog.menu 1 $chr(9) +gc 0 1 $playing
- xpop -a dialog.menu 2 $chr(9) +g 215 3
- xpop -a dialog.menu 3 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 2 $iif($insong.pause == $false, Pause, Unpause)
- xpop -a dialog.menu 4 $chr(9) + 227 3 Previous
- xpop -a dialog.menu 5 $chr(9) + 228 3 Stop
- xpop -a dialog.menu 6 $chr(9) + 229 3 Next
- xpop -a dialog.menu 7 $chr(9) + 230 2 Load Playlists
- xpopup -s dialog.menu + $calc($mouse.dx - 55) $mouse.dy
- }
- alias spam {
- if (%spam == on) {
- if ($1 == srs) && ($insong == $true) {
- if (%artist != -) { msg $active 07 $sound($insong.fname).artist 09-07 $sound($insong.fname).title 09-07 $sound($insong.fname).bitrate $+ kbps }
- else { msg $active 07 No Id3 info: $nopath($insong.fname) }
- }
- ;msg # Album: $sound($insong.fname).album Year: $sound($insong.fname).year Comment: $sound($insong.fname).comment Genre: $sound($insong.fname).genre Track: $sound($insong.fname).track Length: $gettok($duration($gettok($calc(%length / 1000),1,46),3),2-,58) Version: $sound($insong.fname).version Bitrate: $sound($insong.fname).bitrate $+ kbps VBR: $sound($insong.fname).vbr Sample: $sound($insong.fname).sample Mode: $sound($insong.fname).mode Copyright: $sound($insong.fname).copyright Private: $sound($insong.fname).private CRC: $sound($insong.fname).crc Id3: $sound($insong.fname).id3 Tag: $sound($insong.fname).tag Tags Available: $sound($insong.fname).tags
- }
- }
- alias id3.info {
- %file = $qt($insong.fname)
- fopen editor %file
- if ($ferr > 0) { echo -a error. | halt }
- else {
- echo -a $sound($insong.fname).tags
- fseek -w editor *$nopath($insong.fname)*
- if ($ferr > 0) { fclose * }
- else {
- echo -a $fread(editor)
- bset -t &id3.nfo 1 $fread(editor)
- echo -a $bvar(&id3.nfo,$bvar(&id3.nfo,1),$bvar(&id3.nfo,0).text
- fclose *
- }
- }
- }
- ;id3 dialog
- dialog ID3 {
- title "ID3 Tag Editor"
- size -1 -1 295 93
- option pixels
- edit "", 1, 3 2 200 20, read autohs
- button "Browse", 2, 208 2 85 20
- edit "", 3, 3 24 285 22, autohs
- combo 4, 123 47 110 120, size drop
- button "Update", 5, 3 70 150 20
- button "", 7, 0 0 0 0, hide ok
- combo 8, 3 47 120 180, size drop
- }
- ;dialog events
- on *:dialog:ID3:*:*:{
- if $devent == init {
- did -a $dname 1 No file selected.
- did -f $dname 2
- genre
- did -b $dname 8,5
- didtok -a $dname 4 32 Title Artist Album Year Comment Genre
- }
- if $devent == sclick {
- if $did == 2 {
- did -ra $dname 1 $file="Choose an .mp3" *.mp3
- if .mp3 !isin $did(1) { did -ra $dname 1 | did -b $dname 5 }
- else { did -e $dname 5 }
- }
- if $did == 4 {
- did -f $dname 3
- dialog -t $dname $+(ID3 Tag Editor:,$chr(32),$did(4).seltext)
- did -ra $dname 3 $PR0P($did(1),$did(4).sel)
- if $did(4).sel == 6 { did -c $dname 8 $didwm(8,$did(3)) }
- }
- if $did == 5 && $did(4).sel {
- var %file = $shortfn($did(ID3,1))
- $EDIT(%file,$did(4).sel)
- }
- if $did(4).sel == 6 { did -e $dname 8 | did -m $dname 3 }
- else { did -b $dname 8 | did -n $dname 3 }
- if $did == 8 && $did(4).sel == 6 { did -ra $dname 3 $did(8).seltext }
- }
- }
- alias -l id3.open {
- var %input = $input(In order to edit ID3 tags you must stop using any files. Do you wish to continue?,y,Attention!)
- if (%input == $true) {
- splay stop
- dialog -md id3 id3
- }
- elseif (%input == $false) {
- dialog $iif($dialog(mp3),-v,-md) mp3 mp3
- }
- }
- ;edit alias
- alias -l EDIT {
- bread $1 $B_CALC($1,128) 3 &tag
- echo -a $1 $bvar(&tag,1-3).text $mp3($1).version
- if ($bvar(&tag,1-3).text != TAG) {
- bwrite $1 $B_CALC($1,128) 3 TAG
- bset &fill 125 0
- bwrite $1 $B_CALC($1,125) 124 &fill
- bunset &fill
- }
- if ($mp3($1).version == MPEG 2.0 Layer 3) || ($mp3($1).version == MPEG 1.0 Layer 3) {
- if ($did(ID3,3)) {
- bset &val $N_BYTE($2) $iif($2 == 6,$calc($did(ID3,8).sel - 1),$did(ID3,3))
- bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
- $iif($2 < 6,.bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) $did(ID3,3))
- }
- else {
- bset &val 30 $asc($chr(32))
- bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
- }
- bunset &val
- dialog -t $dname $+(ID3 Tag Editor:,$chr(32),Updated!)
- }
- }
- ;B_CALC alias
- alias -l B_CALC {
- echo -a B_CALC $calc($file($1).size - $2)
- return $calc($file($1).size - $2)
- }
- ;N_BYTE alias
- alias -l N_BYTE {
- echo -a N_BYTE $gettok(30 30 30 4 30 1,$1,32)
- return $gettok(30 30 30 4 30 1,$1,32)
- }
- ;S_BYTE alias
- alias -l S_BYTE {
- return $calc($file($1).size - $gettok(125 95 65 35 31 1,$2,32))
- }
- ;genre alias
- alias -l genre {
- didtok ID3 8 44 Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks,SoundTrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise,Alternative Rock $&
- ,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock,Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,Euro Dance,Dream,Southern Rock,Comedy,Cult,Gangsta Rap,Top 40,Christian Rap,Pop/Funk,Jungle,Native American,Cabaret,New Wave,Psychedelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock n' Roll
- didtok ID3 8 44 Hard Rock,Folk,Folk-Rock,National Folk,Swing,Fast Fusion,Bebop,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony,Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango $&
- ,Samba,Folklore,Ballad,Power Ballad,Rhythmic Soul,Freestyle,Duet,Punk Rock,Drum Solo,Acapella,Euro-House,Dance Hall,
- }
- on *:TEXT:*:#: { if ($1 == .spam) && ($2 == off) { %spam = off } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement