rebol_mp3播放器
来源:互联网 发布:网络药品销售促成技巧 编辑:程序博客网 时间:2024/03/29 00:51
- REBOL [Title: "Play a pile of songs"]
- ;--- 1. Setup (change this as needed)
- music-dir: %/d/music/
- file-types: [%.wma %.mp3 %.wav]
- player: "C:/Program Files/Windows Media Player/wmplayer.exe"
- ;--- 2. Function that gathers all the files:
- file-list: [] ; hold list of media files (rebol format)
- find-files: func [dir list /local files] [
- files: sort load dir
- ; Get files that match the above types:
- foreach file files [
- if find file-types suffix? file [
- append list dir/:file
- ]
- ]
- ; Search sub-directories:
- foreach file files [
- if find file "/" [find-files dir/:file list]
- ]
- ]
- find-files music-dir file-list
- ;--- 3. Convert the file list to local format:
- localize-file: func [file] [
- rejoin [{"} to-local-file clean-path file {"}]
- ]
- play-list: [] ; hold list of media files (windows format)
- foreach file file-list [
- append play-list localize-file file
- ]
- ;--- 3. Play the list:
- call probe reform [player play-list]
- halt