rebol_mp3播放器

来源:互联网 发布:网络药品销售促成技巧 编辑:程序博客网 时间:2024/03/29 00:51
  1. REBOL [Title: "Play a pile of songs"]
  2. ;--- 1. Setup (change this as needed)
  3. music-dir: %/d/music/
  4. file-types: [%.wma %.mp3 %.wav]
  5. player: "C:/Program Files/Windows Media Player/wmplayer.exe"
  6. ;--- 2. Function that gathers all the files:
  7. file-list: []  ; hold list of media files (rebol format)
  8. find-files: func [dir list /local files] [
  9.     files: sort load dir
  10.     ; Get files that match the above types:
  11.     foreach file files [
  12.         if find file-types suffix? file [
  13.             append list dir/:file
  14.         ]
  15.     ]
  16.     ; Search sub-directories:
  17.     foreach file files [
  18.         if find file "/" [find-files dir/:file list]
  19.     ]
  20. ]
  21. find-files music-dir file-list
  22. ;--- 3. Convert the file list to local format:
  23. localize-file: func [file] [
  24.     rejoin [{"} to-local-file clean-path file {"}]
  25. ]
  26. play-list: []  ; hold list of media files (windows format)
  27. foreach file file-list [
  28.     append play-list localize-file file
  29. ]
  30. ;--- 3. Play the list:
  31. call probe reform [player play-list]
  32. halt