Advertisement
Xzempt

Untitled

May 31st, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.72 KB | None | 0 0
  1. ;Alarm Clock...Mp3 player
  2. menu * {
  3. Mp3: player
  4. }
  5. alias player {
  6. if ($dialog(clock)) { dialog -c clock clock | dialog -m clock clock | .remove sounds.txt }
  7. else { dialog -m clock clock }
  8. }
  9. alias pause.playback { splay pause | xdid -k clock 6 +nhs $rgb(255,255,255) $mircdirimages\pause.png }
  10. alias resume.playback { splay resume | xdid -k clock 6 +nhs $rgb(255,255,255) $mircdirimages\play.png }
  11. alias alarm {
  12. .timer.alarm -o %alarm.time 1 1 splay $read(sounds.txt)
  13. set %alarm.on $true
  14. echo -a Now Playing... $read(sounds.txt,$readn)
  15. }
  16. on *:INPUT:*: {
  17. if (%alarm.on == $true) && ($insong) { splay stop | set %alarm.on $false }
  18. if ($1 == !alarm) {
  19. if ($2 == on) {
  20. if ($3) {
  21. set %alarm on
  22. set %alarm.time $3
  23. alarm
  24. }
  25. else {
  26. echo -a You must supply a time that you wish the alarm to go off at... (24hr format)
  27. }
  28. }
  29. if ($2 == off) {
  30. set %alarm off
  31. .timer.alarm off
  32. }
  33. }
  34. }
  35.  
  36. on *:MP3END: {
  37.  
  38. if (%filename) { did -c clock 10 $didwm(clock,10, $+(*,%filename,*)) | unset %filename }
  39. write previous.txt $did(clock,10).seltext | play.next
  40.  
  41. }
  42. on *:MIDIEND: {
  43. if (%alarm.on == $true) {
  44. play.next
  45. }
  46. else {
  47. unset %alarm*
  48. }
  49. }
  50.  
  51. on *:WAVEEND: {
  52. if (%alarm.on == $true) {
  53. play.next
  54. }
  55. else {
  56. unset %alarm*
  57. }
  58. }
  59. dialog clock {
  60. title "Clock"
  61. size -1 -1 300 100
  62. option dbu
  63. menu "Alarm", 2
  64. item "Alarm", 5 disable
  65. item break, 6
  66. item "", 3 1
  67. item "", 4 2
  68. }
  69. alias load.music {
  70. if (%play.favs == $true) { %x = 1 | while (%x <= $lines(mp3.favorites.txt)) { did -a clock 10 $read(mp3.favorites.txt,n,%x) | inc %x } }
  71. else { %x = 1 | while (%x <= $lines(sounds.txt)) { did -a clock 10 $read(sounds.txt,n,%x) | inc %x } }
  72. }
  73. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  74. ;TODO: Work out using playlists
  75. alias load.playlists {
  76. if (%play.playlist == $true) { %x = 1 | while (%x <= $lines(playlists.pl)) { did -a clock 10 $read(playlists.pl,n,%x) | inc %x } }
  77. }
  78. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  79. alias clock.time { return $asctime(hh:nn TT) }
  80. alias update {
  81. if ($gettok($asctime(hh:nn:ss), 2, 58) != %time) {
  82. %time = $gettok($asctime(hh:nn:ss), 2, 58)
  83. did -o clock 2 $clock.time
  84. }
  85. if ($insong) && (!$did(clock,10).seltext) {
  86. did -c clock 10 $didwm(clock,10,$+(*,$nopath($insong.fname),*))
  87.  
  88. }
  89. populate
  90. }
  91.  
  92. alias clock.cb {
  93. if ($2 == changing) { %pos.x = $5 | %pos.y = $6 }
  94. if ($2 == mwheel) && ($3 == 26) {
  95. if ($4 == up) { xdid -v clock 26 $calc($xdid(clock,26).value + 1) | splay seek $calc(($xdid(clock,26).value * 1000) + 1000) }
  96. if ($4 == down) { xdid -v clock 26 $calc($xdid(clock,26).value - 1) | splay seek $calc(($xdid(clock,26).value * 1000) - 1000) }
  97. }
  98. if ($2 == mousebar) {
  99. if ($insong) { splay seek $calc($7 * 1000) | xdid -v clock 26 $4 }
  100. }
  101. if ($2 == rclick) {
  102. if ($3 == 10) { list.menu }
  103. if ($3 == 0) { dialog.menu }
  104. if ($3 == 26) && ($4) { %position = $4 | progbar.menu }
  105. else { return }
  106. }
  107. if ($2 == mouseenter) { } ;
  108. if ($2 == mouseenter) && ($3 == 20) { .timer.focus.vol -m 1 500 xdid -F clock 20 }
  109. if ($2 == mouseenter) && ($3 == 0) || ($3 == 12) {
  110. if ($timer(.focus.vol) != $null) { .timer.focus.vol off }
  111. if ($timer(.focus.pbar) != $null) { .timer.focus.pbar off }
  112. }
  113. if ($2 == mouseenter) && ($3 == 26) { xdid -T clock 26 This is a test | .timer.focus.pbar -m 1 500 xdid -F clock 26 }
  114. if ($2 == tracking) { }
  115. if ($regex($2, /(trackend|lineup|linedown|pagedown|pageup)/)) && ($3 == 20) {
  116. xdid -t clock 24 $xdid(clock,20).value $+ %
  117. if ($4 < 10) { %decimal = 0.0 $+ $4 | %vol = $calc(65535*%decimal) | vol -p %vol }
  118. else { %decimal = 0. $+ $4 | %vol = $remove($left($calc(65535*%decimal),5),$chr(46)) | vol -p %vol }
  119. if ($4 == 100) { vol -p 65535 }
  120. }
  121. if ($2 == dclick) && ($3 == 10) {
  122. if ($regex($xdid(clock,10, $xdid(clock,10).sel).text, /(.*\.pl))) {
  123. %playlist = $xdid(clock,10, $xdid(clock,10).sel).text
  124. }
  125. else { unset %artist | unset %count | xdid -v clock 26 0 | splay $xdid(clock,10, $xdid(clock,10).sel).text | %track = $4 | populate | $spam(srs) }
  126. if (%filename) { unset %filename }
  127. }
  128. if ($2 == sclick) {
  129. if ($3 == 26) {
  130. 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 }
  131. if ($insong == $false) { play.next }
  132. }
  133. if ($3 == 5) {
  134. if ($insong.pause == $true) { xdid -t clock 6 ► }
  135. write previous.txt $did($dname,10).seltext | play.next
  136. }
  137. if ($3 == 6) && ($insong == $true) {
  138. if ($insong.pause == $true) { resume.playback }
  139. else { pause.playback }
  140. }
  141. if ($3 == 6) && ($insong == $false) { play.next }
  142. if ($3 == 16) { did -h clock 2-14 | id3.info | did -v clock 17 | did -f clock 10 }
  143. if ($3 == 15) { did -v clock 2-14 | did -h clock 17 }
  144.  
  145. if ($3 == 7) { stop.playback | unset %artist %title %length | echo -a Playback stopped.
  146. if ($insong.pause == $true) { xdid -t clock 6 ► }
  147. }
  148. if ($3 == 8) {
  149. if ($exists(previous.txt)) && ($lines(previous.txt) > 0) { play.previous }
  150. else { echo -a No previously played tracks found... Play something first. }
  151. }
  152. if ($3 == 10) && ($insong == $true) { %filename = $nopath($insong.fname) }
  153. }
  154. }
  155. alias clock.init {
  156. dcx Mark $dname clock.cb
  157.  
  158. dialog -s clock $readini(config.ini,position,x) $readini(config.ini,position,y) -1 -1
  159. ;;---Dialog color
  160. xdialog -g clock +b $rgb(0,0,0)
  161. ;;---dialog buttons
  162. xdialog -c clock 5 button 32 30 20 20 bitmap
  163. xdid -k $dname 5 +nhs $rgb(255,255,255) $mircdirimages\next.png
  164.  
  165. xdialog -c clock 6 button 10 30 20 20 bitmap
  166. xdid -k $dname 6 +nhs $rgb(255,255,255) $mircdirimages\play.png
  167. xdialog -c clock 7 button 54 30 20 20 bitmap
  168. xdid -k $dname 7 +nhs $rgb(255,255,255) $mircdirimages\stop.png
  169. xdialog -c clock 8 button 77 30 20 20 bitmap
  170. xdid -k $dname 8 +nhs $rgb(255,255,255) $mircdirimages\previous.png
  171. ;;--- Text controls
  172.  
  173. ;;--Checkboxes & text beside them
  174. xdialog -c clock 13 check 160 13 20 20 right
  175. xdialog -c clock 14 check 160 37 20 20 right
  176. xdialog -c clock 21 text 100 15 60 30 right
  177. xdialog -c clock 22 text 100 40 60 30 right
  178. xdid -t clock 21 Shuffle:
  179. xdid -C clock 13 +b $rgb(0,0,0)
  180. xdid -C clock 21 +b $rgb(0,0,0)
  181. xdid -C clock 21 +k $rgb(0,0,0)
  182. xdid -C clock 21 +t $rgb(130,192,255)
  183. ; xdid -C clock 13 +k $rgb(0,0,0)
  184. xdid -C clock 13 +t $rgb(130,192,255)
  185. ;;--Repeat Text
  186. xdid -t clock 22 Repeat:
  187. xdid -C clock 14 +b $rgb(0,0,0)
  188. xdid -C clock 22 +b $rgb(0,0,0)
  189. xdid -C clock 22 +k $rgb(0,0,0)
  190. xdid -C clock 22 +t $rgb(130,192,255)
  191.  
  192.  
  193. ;;---Volume Trackbar
  194. xdialog -c $dname 20 trackbar 190 17 100 30 smooth autoticks downisleft
  195. xdid -c clock 20 74
  196. xdid -C clock 20 +b $rgb(0,0,0)
  197. xdid -C clock 20 +k $rgb(0,0,0)
  198. xdid -n clock 20 10
  199.  
  200. ;;---Volume Text
  201. xdialog -c clock 23 text 180 5 60 20 right
  202. xdid -t clock 23 Volume:
  203. xdid -C clock 23 +b $rgb(0,0,0)
  204. xdid -C clock 23 +k $rgb(0,0,0)
  205. xdid -C clock 23 +t $rgb(130,192,255)
  206.  
  207. ;;--Volume percentage text
  208. xdialog -c clock 24 text 240 5 30 15 right
  209. xdid -t clock 24 100%
  210. xdid -C clock 24 +b $rgb(0,0,0)
  211. xdid -C clock 24 +k $rgb(0,0,0)
  212. xdid -C clock 24 +t $rgb(130,192,255)
  213.  
  214. ;;---Listview
  215. xdialog -c clock 10 list 395 10 200 180 sort hsbar vsbar
  216. xdid -C clock 10 +b $rgb(0,0,0)
  217. xdid -C clock 10 +t $rgb(130,192,255)
  218. xdid -x clock 10 +w
  219.  
  220.  
  221. xdialog -c clock 12 box 5 65 230 110 left rounded
  222. xdid -c clock 12 26 pbar 15 20 200 50 notheme smooth
  223. xdid -c clock 12 9 text 15 75 30 20
  224. xdid -c clock 12 11 text 185 75 30 20
  225. xdid -t clock 12 Now Playing:
  226. xdid -C clock 12 +b $rgb(0,0,0)
  227. xdid -C clock 12 +t $rgb(130,192,255)
  228. xdid -C clock 12 +r $rgb(255,255,255)
  229.  
  230. xdid -o clock 26 0
  231. xdid -k clock 26 $rgb(78,78,78)
  232. xdid -j clock 26 p
  233. xdid -c clock 26 $rgb(0,0,0)
  234. xdid -q clock 26 $rgb(130,192,255)
  235. xdid -i clock 26 Click here to start playback.
  236. xdid -T clock 26 test
  237.  
  238. xdid -t clock 9 00:00
  239. xdid -t clock 11 00:00
  240. xdid -C clock 9 +b $rgb(0,0,0)
  241. xdid -C clock 9 +k $rgb(0,0,0)
  242. xdid -C clock 9 +t $rgb(130,192,255)
  243.  
  244. xdid -C clock 11 +b $rgb(0,0,0)
  245. xdid -C clock 11 +k $rgb(0,0,0)
  246. xdid -C clock 11 +t $rgb(130,192,255)
  247. xdialog -T clock +pb
  248. }
  249.  
  250.  
  251. 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) }
  252. 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 }
  253.  
  254.  
  255. on *:START: {
  256. if ($exists(sounds.txt) == $false) {
  257. echo -a 07Loading sound files...
  258. $findfile($mircdir/sounds,*.mp3,0,write sounds.txt $nopath($1-))
  259. }
  260. }
  261. on *:dialog:clock:menu:*: {
  262. if ($did == 4) {
  263. did -o $dialog($dname) 4 Off
  264. did -o $dialog($dname) 3 On
  265. unset %alarm*
  266. did -c $dname 4
  267. if ($did($dname,3).state == 1) { did -c $dname 3 }
  268. echo -a $did($dname,$did).text
  269. }
  270. if ($did == 3) {
  271. did -o $dialog($dname) 4 Off
  272. %alarm.time = $?="Set Alarm: e.g hour:minute (12:30)"
  273. $iif(%alarm.time != $null, echo -a Alarm set for %alarm.time, %alarm.time = $?="Set Alarm: e.g hour:minute (12:30)")
  274. did -o $dialog($dname) 3 On - Time: %alarm.time
  275. did -c $dname 3
  276. if ($did($dname,4).state == 1) { did -c $dname 4 }
  277. alarm
  278. }
  279. else { echo -a $devent $did }
  280. }
  281.  
  282. alias play.previous {
  283. xdid -v clock 26 0
  284. unset %artist
  285. splay $read(previous.txt,$lines(previous.txt))
  286. %track = $readn
  287. did -c clock 10 $didwm(clock,10, * $+ $read(previous.txt,$lines(previous.txt)) $+ *)
  288. write -d previous.txt
  289. populate
  290.  
  291. }
  292. alias hmm { %lol = $calc($xdid(clock,10).sel + 1) | xdid -c clock 10 %lol | splay $xdid(clock,10,%lol).text }
  293. ;counts backwards from song total length to 0
  294. ;$duration($gettok($calc(($insong.length - $insong.pos) / 1000),1,46),3)
  295. alias populate {
  296. if ($insong) {
  297. ;if ($read($sound($insong.fname).genre $+ .pl,w, $insong.fname)) { hmm }
  298. ;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 }
  299. if (!%artist) {
  300.  
  301. %artist = $sound($insong.fname).artist -
  302. %title = $sound($insong.fname).title -
  303. %length = $sound($insong.fname).length
  304. xdid -r clock 26 0 $gettok($calc(%length / 1000),1,46)
  305. ;echo -a $xdid(clock,26).range $duration($gettok($xdid(clock,26).range,2,32))
  306. }
  307.  
  308. if ($insong.pause != $true) {
  309. inc %count
  310. if (!%count) { xdid -v clock 26 1 | %count = 1 }
  311. if (%count == 1) {
  312. if (%artist == -) { xdid -t clock 12 Now Playing: | xdid -i clock 26 No ID3 info, using filename. }
  313. else { xdid -t clock 12 Now Playing: | xdid -i clock 26 %artist % $+ d% $+ % }
  314. }
  315. if (%count == 10) {
  316. if (%title == -) { xdid -t clock 12 Title: | xdid -i clock 26 $nopath($insong.fname) }
  317. else { xdid -t clock 12 Title: | xdid -i clock 26 %title % $+ d% $+ % }
  318. }
  319. ;else { echo -a else | xdid -t clock 12 Now Playing: | xdid -i clock 26 %artist % $+ d% $+ % }
  320.  
  321. if (%count == 20) { %count = 0 }
  322. xdid -v clock 26 $calc($xdid(clock,26).value + 1.5)
  323. xdid -t clock 9 $gettok($duration($calc($insong.pos / 1000),3),2-,58)
  324. xdid -t clock 11 $gettok($duration($gettok($calc(%length / 1000),1,46),3),2-,58)
  325. }
  326. }
  327. }
  328. alias play.next {
  329. unset %artist
  330. unset %count
  331. xdid -v clock 26 0
  332. if (%play.favs == $false) {
  333. if ($xdid(clock,14).state == 1) && ($xdid(clock,13).state == 0) || ($xdid(clock,13).state == 1) {
  334. if ($xdid(clock,10).sel > 0) {
  335. splay $xdid(clock,10,$xdid(clock,10).sel).text
  336. }
  337. }
  338. if ($did(clock,13).state == 0) && ($xdid(clock,14).state == 0) {
  339. if (!$did(clock,10).sel) {
  340. %track = $did($dname,10).sel
  341. did -c clock 10 1
  342. splay $did(clock,10).seltext
  343. }
  344. else {
  345. ;echo -a something is selected in the list
  346. %track = $did(clock,10).sel
  347. did -c clock 10 $calc(%track + 1)
  348. splay $did(clock,10).seltext
  349. }
  350. }
  351. if ($xdid(clock,13).state == 1) && ($xdid(clock,14).state == 0) {
  352. splay $read(sounds.txt)
  353. ; echo -a shuffle mode on $readn
  354. %track = $readn
  355. did -c clock 10 $didwm(clock,10, * $+ $read(sounds.txt,n,%track) $+ *)
  356. }
  357. }
  358. else {
  359. if ($xdid(clock,14).state == 1) && ($xdid(clock,13).state == 0) || ($xdid(clock,13).state == 1) {
  360. if ($xdid(clock,10).sel > 0) {
  361. splay $xdid(clock,10,$xdid(clock,10).sel).text
  362. }
  363. }
  364. if ($did(clock,13).state == 0) && ($xdid(clock,14).state == 0) {
  365. if (!$did(clock,10).sel) {
  366. %track = $did($dname,10).sel
  367. did -c clock 10 1
  368. splay $did(clock,10).seltext
  369. ;%length = $duration($gettok($calc($insong.length / 1000),1,46),3) 4
  370. }
  371. else {
  372. ;echo -a something is selected in the list
  373. %track = $did(clock,10).sel
  374. did -c clock 10 $calc(%track + 1)
  375. splay $did(clock,10).seltext
  376. }
  377. }
  378. if ($xdid(clock,13).state == 1) && ($xdid(clock,14).state == 0) {
  379. splay $read(mp3.favorites.txt)
  380. ;echo -a shuffle mode on $readn
  381. %track = $readn
  382. did -c clock 10 $didwm(clock,10, * $+ $read(mp3.favorites.txt,n,%track) $+ *)
  383. }
  384.  
  385. }
  386. populate
  387. $spam(srs)
  388. }
  389.  
  390. ;;;;;-----Settings configuration
  391. alias save.settings {
  392. writeini config.ini shuffle shuffle $did(clock,13).state
  393. writeini config.ini repeat repeat $did(clock,14).state
  394. writeini config.ini volume volume $xdid(clock,20).value
  395. writeini config.ini favorites favorites %play.favs
  396. writeini config.ini alarm alarm $did(clock,3).state
  397. writeini config.ini position x %pos.x
  398. writeini config.ini position y %pos.y
  399.  
  400. }
  401. alias apply.settings {
  402. if ($readini(config.ini,shuffle,shuffle) == 1) { did -c clock 13 }
  403. if ($readini(config.ini,repeat,repeat) == 1) { did -c clock 14 }
  404. xdid -v clock 20 $readini(config.ini,volume,volume)
  405. xdid -t clock 24 $readini(config.ini,volume,volume) $+ %
  406. %play.favs = $readini(config.ini,favorites,favorites)
  407. 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) }
  408. else { did -o clock 4 Off | did -c clock 4 | did -o clock 3 On }
  409. }
  410.  
  411.  
  412.  
  413. ;;-------Menus
  414.  
  415. alias playing {
  416. if ($insong) { return $sound($insong.fname).artist - $sound($insong.fname).title }
  417. else { return Nothing playing. }
  418. }
  419. alias list.menu {
  420. if ($xpopup(list.menu).ismenu) xpopup -d list.menu
  421. xpopup -c list.menu normal
  422. 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)
  423. xpop -a list.menu 1 $chr(9) +gc 0 1 $playing
  424. xpop -a list.menu 2 $chr(9) +g 215 3
  425. xpop -a list.menu 3 $chr(9) +s 125 3 Favorites
  426. xpop -a list.menu 3 1 $chr(9) + 10 3 Add
  427. xpop -a list.menu 3 2 $chr(9) + 11 3 Remove
  428. xpop -a list.menu 4 $chr(9) +s 125 3 Playlists (Not Implemented)
  429. xpop -a list.menu 5 $chr(9) $state 125 2 Play Favorites
  430. xpop -a list.menu 6 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 3 $iif($insong.pause == $false, Pause, Unpause)
  431. xpop -a list.menu 7 $chr(9) + 227 3 Previous
  432. xpop -a list.menu 8 $chr(9) + 228 3 Stop
  433. xpop -a list.menu 9 $chr(9) + 229 3 Next
  434. xpop -a list.menu 10 $chr(9) + 231 1 Edit ID3
  435. xpopup -s list.menu + $calc($mouse.dx - 55) $mouse.dy
  436. }
  437. alias state {
  438. if (%play.favs == $true) { return +c }
  439. else { return + }
  440. }
  441.  
  442. 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 }
  443. ON *:SIGNAL:Xpopup-*: {
  444. var %m $gettok($signal, 2-, 45)
  445. if ($1 == 0) { return }
  446. if ($1 == 225) { splay seek $calc(%position * 1000) | xdid -v clock 26 %position }
  447. if ($1 == 226) { $iif($insong.pause == $false, pause.playback, resume.playback) }
  448. if ($1 == 227) { play.previous }
  449. if ($1 == 228) { stop.playback }
  450. if ($1 == 229) { play.next }
  451. if ($1 == 231) { $id3.open }
  452. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  453. ;TODO
  454. if ($1 == 230) { echo -a Not implemented yet... }
  455. ;echo -a Loading Playlists.pl... | %play.playlist = $true | xdid -r clock 10 | load.playlists ;}
  456. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  457.  
  458. if ($1 == 10) { write mp3.favorites.txt $xdid(clock,10,$xdid(clock,10).sel).text }
  459. if ($1 == 125) {
  460.  
  461. 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 }
  462. if (!%play.favs) { %play.favs = $false }
  463. if (%play.favs == $true) { %play.favs = $false }
  464. else { %play.favs = $true }
  465. if (exists(mp3.favorites.txt)) && (%play.favs == $true) { echo -a loading favorites | did -r clock 10 | load.music }
  466. else { echo -a loading normal playlist... | did -r clock 10 | load.music }
  467. }
  468. }
  469.  
  470. alias progbar.menu {
  471. if ($xpopup(progbar.menu).ismenu) xpopup -d progbar.menu
  472. xpopup -c progbar.menu normal
  473. 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)
  474. xpop -a progbar.menu 1 $chr(9) +gc 0 1 $playing
  475. xpop -a progbar.menu 2 $chr(9) +g 215 3
  476. xpop -a progbar.menu 3 $chr(9) + 225 3 Seek to: $duration(%position)
  477.  
  478. xpop -a progbar.menu 4 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 2 $iif($insong.pause == $false, Pause, Unpause)
  479. xpop -a progbar.menu 5 $chr(9) + 227 3 Previous
  480. xpop -a progbar.menu 6 $chr(9) + 228 3 Stop
  481. xpop -a progbar.menu 7 $chr(9) + 229 3 Next
  482. xpopup -s progbar.menu + $calc($mouse.dx - 55) $mouse.dy
  483. }
  484. alias dialog.menu {
  485. if ($xpopup(dialog.menu).ismenu) xpopup -d dialog.menu
  486. xpopup -c dialog.menu normal
  487. 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)
  488. xpop -a dialog.menu 1 $chr(9) +gc 0 1 $playing
  489. xpop -a dialog.menu 2 $chr(9) +g 215 3
  490.  
  491.  
  492. xpop -a dialog.menu 3 $chr(9) $iif($insong == $false,+g,$iif($insong.pause == $true,+c,+)) 226 2 $iif($insong.pause == $false, Pause, Unpause)
  493. xpop -a dialog.menu 4 $chr(9) + 227 3 Previous
  494. xpop -a dialog.menu 5 $chr(9) + 228 3 Stop
  495. xpop -a dialog.menu 6 $chr(9) + 229 3 Next
  496. xpop -a dialog.menu 7 $chr(9) + 230 2 Load Playlists
  497. xpopup -s dialog.menu + $calc($mouse.dx - 55) $mouse.dy
  498. }
  499.  
  500. alias spam {
  501. if (%spam == on) {
  502. if ($1 == srs) && ($insong == $true) {
  503. if (%artist != -) { msg $active 07 $sound($insong.fname).artist 09-07 $sound($insong.fname).title 09-07 $sound($insong.fname).bitrate $+ kbps }
  504. else { msg $active 07 No Id3 info: $nopath($insong.fname) }
  505. }
  506. ;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
  507.  
  508. }
  509. }
  510. alias id3.info {
  511. %file = $qt($insong.fname)
  512. fopen editor %file
  513. if ($ferr > 0) { echo -a error. | halt }
  514. else {
  515. echo -a $sound($insong.fname).tags
  516. fseek -w editor *$nopath($insong.fname)*
  517. if ($ferr > 0) { fclose * }
  518. else {
  519. echo -a $fread(editor)
  520. bset -t &id3.nfo 1 $fread(editor)
  521. echo -a $bvar(&id3.nfo,$bvar(&id3.nfo,1),$bvar(&id3.nfo,0).text
  522. fclose *
  523. }
  524. }
  525. }
  526.  
  527.  
  528. ;id3 dialog
  529. dialog ID3 {
  530. title "ID3 Tag Editor"
  531. size -1 -1 295 93
  532. option pixels
  533. edit "", 1, 3 2 200 20, read autohs
  534. button "Browse", 2, 208 2 85 20
  535. edit "", 3, 3 24 285 22, autohs
  536. combo 4, 123 47 110 120, size drop
  537. button "Update", 5, 3 70 150 20
  538. button "", 7, 0 0 0 0, hide ok
  539. combo 8, 3 47 120 180, size drop
  540. }
  541.  
  542. ;dialog events
  543. on *:dialog:ID3:*:*:{
  544. if $devent == init {
  545. did -a $dname 1 No file selected.
  546. did -f $dname 2
  547. genre
  548. did -b $dname 8,5
  549. didtok -a $dname 4 32 Title Artist Album Year Comment Genre
  550. }
  551. if $devent == sclick {
  552. if $did == 2 {
  553. did -ra $dname 1 $file="Choose an .mp3" *.mp3
  554. if .mp3 !isin $did(1) { did -ra $dname 1 | did -b $dname 5 }
  555. else { did -e $dname 5 }
  556. }
  557. if $did == 4 {
  558. did -f $dname 3
  559. dialog -t $dname $+(ID3 Tag Editor:,$chr(32),$did(4).seltext)
  560. did -ra $dname 3 $PR0P($did(1),$did(4).sel)
  561. if $did(4).sel == 6 { did -c $dname 8 $didwm(8,$did(3)) }
  562. }
  563. if $did == 5 && $did(4).sel {
  564. var %file = $shortfn($did(ID3,1))
  565. $EDIT(%file,$did(4).sel)
  566. }
  567. if $did(4).sel == 6 { did -e $dname 8 | did -m $dname 3 }
  568. else { did -b $dname 8 | did -n $dname 3 }
  569. if $did == 8 && $did(4).sel == 6 { did -ra $dname 3 $did(8).seltext }
  570. }
  571. }
  572. alias -l id3.open {
  573. var %input = $input(In order to edit ID3 tags you must stop using any files. Do you wish to continue?,y,Attention!)
  574. if (%input == $true) {
  575. splay stop
  576. dialog -md id3 id3
  577. }
  578. elseif (%input == $false) {
  579. dialog $iif($dialog(mp3),-v,-md) mp3 mp3
  580. }
  581. }
  582.  
  583.  
  584. ;edit alias
  585. alias -l EDIT {
  586. bread $1 $B_CALC($1,128) 3 &tag
  587. echo -a $1 $bvar(&tag,1-3).text $mp3($1).version
  588. if ($bvar(&tag,1-3).text != TAG) {
  589. bwrite $1 $B_CALC($1,128) 3 TAG
  590. bset &fill 125 0
  591. bwrite $1 $B_CALC($1,125) 124 &fill
  592. bunset &fill
  593. }
  594. if ($mp3($1).version == MPEG 2.0 Layer 3) || ($mp3($1).version == MPEG 1.0 Layer 3) {
  595. if ($did(ID3,3)) {
  596. bset &val $N_BYTE($2) $iif($2 == 6,$calc($did(ID3,8).sel - 1),$did(ID3,3))
  597. bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
  598. $iif($2 < 6,.bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) $did(ID3,3))
  599. }
  600. else {
  601. bset &val 30 $asc($chr(32))
  602. bwrite $1 $S_BYTE($1,$2) $N_BYTE($2) &val
  603. }
  604. bunset &val
  605. dialog -t $dname $+(ID3 Tag Editor:,$chr(32),Updated!)
  606. }
  607. }
  608.  
  609. ;B_CALC alias
  610. alias -l B_CALC {
  611. echo -a B_CALC $calc($file($1).size - $2)
  612. return $calc($file($1).size - $2)
  613. }
  614.  
  615. ;N_BYTE alias
  616. alias -l N_BYTE {
  617. echo -a N_BYTE $gettok(30 30 30 4 30 1,$1,32)
  618. return $gettok(30 30 30 4 30 1,$1,32)
  619. }
  620.  
  621. ;S_BYTE alias
  622. alias -l S_BYTE {
  623. return $calc($file($1).size - $gettok(125 95 65 35 31 1,$2,32))
  624. }
  625.  
  626. ;genre alias
  627. alias -l genre {
  628. 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 $&
  629. ,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
  630. 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 $&
  631. ,Samba,Folklore,Ballad,Power Ballad,Rhythmic Soul,Freestyle,Duet,Punk Rock,Drum Solo,Acapella,Euro-House,Dance Hall,
  632. }
  633. on *:TEXT:*:#: { if ($1 == .spam) && ($2 == off) { %spam = off } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement