source: trunk/mediafolder/bin/insTrk2.rx@ 9

Last change on this file since 9 was 2, checked in by stevenhl, 8 years ago

Import sources from cwmm-full.zip dated 2005-03-21

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