1 | /* rexx - Parse the contents of an M3U file
|
---|
2 | and insert for every trackname a CWAudioShadow
|
---|
3 | in the given folder.
|
---|
4 |
|
---|
5 | This script is part of the media folder package.
|
---|
6 |
|
---|
7 | (c) Chris Wohlgemuth 2002-2003
|
---|
8 |
|
---|
9 | http://www.os2world.com/cdwriting
|
---|
10 | http://www.geocities.com/SiliconValley/Sector/5785/
|
---|
11 |
|
---|
12 | */
|
---|
13 |
|
---|
14 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
15 | call SysLoadFuncs
|
---|
16 |
|
---|
17 |
|
---|
18 | theFilepath=ARG(1)
|
---|
19 | theFolderPath=ARG(2)
|
---|
20 |
|
---|
21 | a=0
|
---|
22 | DO WHILE lines(theFilePath)
|
---|
23 | theLine=STRIP(LINEIN(theFilePath))
|
---|
24 | if checkTheLine()=1 THEN DO
|
---|
25 | a=a+1
|
---|
26 | theTracks.a._name=theLine
|
---|
27 | END
|
---|
28 | END
|
---|
29 | theTracks.0=a
|
---|
30 | call stream thefilepath, 'C','close'
|
---|
31 |
|
---|
32 | DO a=theTracks.0 to 1 by -1
|
---|
33 | rc=SysCreateObject(CWAudioShadow, " ", theFolderPath,"SHADOWID="theTracks.a._name)
|
---|
34 | END
|
---|
35 |
|
---|
36 | rc=0
|
---|
37 | EXIT
|
---|
38 |
|
---|
39 |
|
---|
40 | checkTheLine:
|
---|
41 |
|
---|
42 | if LENGTH(theLine)=0 then
|
---|
43 | return 0; /* Empty line */
|
---|
44 |
|
---|
45 | if SUBSTR(theLine, 1, 1)='#' then
|
---|
46 | return 0; /* Comment */
|
---|
47 |
|
---|
48 | if SUBSTR(theLine, 2, 1)\=':' THEN DO
|
---|
49 | /* relative path. Prepend path of M3U file */
|
---|
50 | if SUBSTR(theLine, 1, 1)\='\' & SUBSTR(theLine, 1, 1)\='/' THEN DO
|
---|
51 | theLine=FILESPEC('drive', theFilePath)||FILESPEC('path', theFilePath)||theLine
|
---|
52 | END
|
---|
53 | ELSE
|
---|
54 | theLine=FILESPEC('drive', theFilePath)||FILESPEC('path', theFilePath)||SUBSTR(theLine,2)
|
---|
55 |
|
---|
56 | END
|
---|
57 | /* Rockbox for the ArchosJukebox uses '/' as path separators in M3U lists.
|
---|
58 | Change them to backslashes */
|
---|
59 | theLine=TRANSLATE(theLine, '\', '/')
|
---|
60 | return 1;
|
---|
61 |
|
---|
62 |
|
---|