source: branches/v2.9/mediafolder/bin/insTrack.rx@ 20

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

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

File size: 1.4 KB
Line 
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
14call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
15call SysLoadFuncs
16
17
18theFilepath=ARG(1)
19theFolderPath=ARG(2)
20
21a=0
22DO 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
28END
29theTracks.0=a
30call stream thefilepath, 'C','close'
31
32DO a=theTracks.0 to 1 by -1
33 rc=SysCreateObject(CWAudioShadow, " ", theFolderPath,"SHADOWID="theTracks.a._name)
34END
35
36rc=0
37EXIT
38
39
40checkTheLine:
41
42if LENGTH(theLine)=0 then
43 return 0; /* Empty line */
44
45if SUBSTR(theLine, 1, 1)='#' then
46 return 0; /* Comment */
47
48if 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
56END
57/* Rockbox for the ArchosJukebox uses '/' as path separators in M3U lists.
58 Change them to backslashes */
59theLine=TRANSLATE(theLine, '\', '/')
60return 1;
61
62
Note: See TracBrowser for help on using the repository browser.