home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu / 2008-06-02_hobbes.nmsu.edu.zip / new / time4z12.zip / TIME4Z.TXT < prev    next >
Text File  |  2008-05-29  |  15KB  |  260 lines

  1. Time4Z is my scheduler in REXX for Dink's Z text mode MP3 player. I release
  2. the source code (version 1.2) for free use and modification by anyone for use
  3. in OS/2 - eCS, but NO OTHER OS. With a few changes, and perhaps tweaking, the
  4. basic scheme will also work with PM123. -- I prefer Z. My thanks to Dink.
  5.  
  6. Version 1.0 finalizes the basic scheme (no huge bugs or inconveniences IMO!),
  7. adds Browse mode besides some minor features, cleans up cosmetics and code.
  8.  
  9. Version 1.1 has new function from more experience with unattended operation
  10. (see end for description of the unique box I'm using): the Window List is
  11. queried every minute to check that Z is running; a new optional keyword,
  12. "CLEAR", frees up space by deleting older files if necessary before copying
  13. recorded files from temporary to permanent storage. And some minor changes.
  14.  
  15. Version 1.2 has a new strategy for disk space in the "MAX" keyword, which sets
  16. a maximum size for all MP3s in the specified "SAVEPATH", and when saving via
  17. "MOVE" will delete files starting with oldest first. This fixes the somewhat
  18. daffy "CLEAR" method inspired by using a second HD on my dedicated recorder so
  19. that I didn't care if the drive filled up. Duh. The new method is handy. Been a
  20. delay of release because an obscure bug introduced with this method caused an
  21. exit if stream failed and re-start failed, but believe it's fixed.
  22.  
  23.  
  24. Purpose and Features:
  25. - Runs Z on a schedule: automates playing and recording streams.
  26. - Plays random streams (or local files) for background music.
  27. - Can spool recorded files to a RAM drive, then move completed files to HD.
  28. - Displays scheduling for every minute of the day.
  29. - Alarm clock substitute; wake-to-music (or sound effects!).
  30.  
  31. NEW in v1.0:
  32. - Function key access to 12 favorite streams.
  33. - Browse mode for easy access to files and (mainly) playlists.
  34. - Key to refresh stream (for stream errors that have caused Z to exit).
  35. - Key to re-read (changed) schedule and re-start without exiting Time4Z.
  36. - Optional hours:minutes form for duration.
  37. - Automatically sets the read-only attribute on all playlists under \TZ which
  38.   are NOT set when started. This would be major nuisance in other languages,
  39.   but turns out to require only two lines of code in OS/2 REXX!
  40.  
  41. ==============================================================================
  42.  
  43. - INSTALLATION
  44.   Requires Warp 4 FP15, because that's about minimum for Z.
  45.  
  46.   Unzip to C:\TZ12. (Edit the source code if you MUST place elsewhere.)
  47.     Directory tree should be created automatically (using OS/2 'unzip').
  48.     Sample TZ.SCH, and some sample playlists are in sub-directories.
  49.  
  50.   Copy any existing TZ.SCH into the new directory. -- OR copy TZ.CMD and this
  51.   file to the old directory; they're the only changed files.
  52.  
  53.   Put Z.EXE in C:\Z28. (Again, modify source if needed.)
  54.  
  55.   Run TZ.CMD from OS/2 command line, or create program object. -- It's safe
  56.   to run without any set-up; worst that can happen is that the OS/2 command
  57.   processor won't find Z.EXE, or Z won't find a playlist; they'll simply,
  58.   probably invisibly, complain and exit. -- It should start streaming from
  59.   the net. Control is mostly by editing the TZ.SCH text file, though a few
  60.   keys have actions as noted below.
  61.  
  62. ==============================================================================
  63.  
  64. Time4Z is best for streaming, especially recording. It can also play MP3s in a
  65. given directory. However, because there's no easy way in REXX to get status
  66. information from Z, this is open-ended control: it just sends the list to Z,
  67. then waits for the next event on its schedule. From version 1.1, the program
  68. checks every minute that "Z for named pipe" appears to be running, but this is
  69. the only feedback used, and it's due to frequent stream errors that cause Z to
  70. quit and miss programs. You can always go into the "Z for named pipe" window
  71. to operate Z. Doesn't look as though I'll ever get to more advanced methods.
  72.  
  73. Time4Z is in daily use, and I particularly like automatic changing of streams
  74. on a schedule, and randomly at selected interval the rest of the time.
  75.  
  76. Scheduling is by manually editing a text file of simple yet flexible format.
  77. For example, the line below changes to random streams (from playlists present
  78. in the given directory) every 7 minutes for the entire day, every day:
  79.     RST SMTWTFS 00:00 24:00 C:\TZ\favored 7
  80. action^  ^days  ^start ^duration ^lists   ^time on each stream (test value)
  81. The scheme inherently does "flying start", meaning an event will start at any
  82. time within its specified period, and end at its normal time. Other events can
  83. be scheduled over this without the tedium of resolving conflicts; the random
  84. streams specified above resume whenever nothing else is on. See TZ.SCH file
  85. for more information, and run TZ.CMD to _see_ this scheme displayed.
  86.  
  87. A specific stream at specific time can be scheduled, and optionally recorded
  88. with file name created from date and time. Files are created in a common
  89. permanent directory, or a (temporary) directory may be individually specified
  90. and the file optionally moved when complete. I use a RAM drive (with RAMFS121)
  91. to avoid the chatter and wear of thrashing a HD. -- CLEAR and MAX keywords only
  92. work if MOVE is used.
  93.  
  94. Playlists are easily obtained from Shoutcast.com, and other webbish places.
  95. There are two common problems: they're all named the same, and are not in the
  96. directory where you wish to save them. - NEW IN v1.0, DONE IN BROWSE MODE.
  97.  
  98. >>> A 3rd problem with playlists is hardwired into Z:
  99. >>> For some inscrutable reason, Z IMMEDIATELY DELETES PLAYLISTS!
  100. >>> All playlists must be protected by setting the read-only attribute:
  101. >>>   In playlist directory: >attrib * +r
  102. >>> NOW DONE AUTOMATICALLY by TZ.CMD; just remember when using Z by itself!
  103.  
  104. You may sometimes need to edit a playlist if a stream doesn't work, or has
  105. stopped working. The format should be obvious; web documentation adds little.
  106. Some sites - especiallly NPR - put a fixed "commercial" at start of the
  107. playlist; this can sometimes be edited out (remove "Title1" and adjust
  108. numbers), or <esc> sometimes gets past it. Murky area.
  109.  
  110. Z by itself uses only the first listed site; try removing it, adjusting number
  111. listed. If you go into the Z window when it's been given a playlist having
  112. multiple addresses, you can hit "N" to try the next one. -- You may have to be
  113. QUICK before it times out and exits on the error!
  114.  
  115. -----------------------------------------------------------------------------
  116.  
  117. KEYBOARD OPERATION:
  118.  
  119.   IF you've set up function keys in TZ.SCH, favorites will be listed to left
  120.     of corresponding number. (You can select any WHILE recording, but can't
  121.     easily RESUME unless previous stream is also on a function key. Hmm...
  122.     Work-around at present is to hit <backspace> to re-read schedule.)
  123.   H shows the Help screen (more or less, this).
  124.   X eXits, leaving "Z for named pipe" running (if it is); this is a feature.
  125.   The ` (left single quote) key tries to refresh / resume a lost stream.
  126.   The ~ (tilde) STOPS / erases the current action; to resume, <backspace>.
  127.   <backspace> re-initialize all by re-reading TZ.SCH (use also if edited)
  128.  
  129.   <tab> goes into Browse mode (if not recording):
  130.     <home> marks a directory to copy playlists into (default: C:\TZ\FAVORED)
  131.     <insert> copies a playlist (.M3U or .PLS) to current "home" dir
  132.     <enter> selects playlist or local files for immediate play.
  133.     <del> IMMEDIATELY deletes a playlist (.M3U or .PLS) but NO other files.
  134.     \ (backslash) makes a new directory.
  135.     <esc> or <tab> returns to Scheduled mode.
  136.     <F1> help in File Selector; most important are lowercase a-z for drive
  137.  
  138.   In Random STream (RST) mode only:
  139.     R Random new stream is picked from those in the specified directory.
  140.     S Stays on current stream to end of scheduled period.
  141.     Any other key just resets the Random STream change timer to 0.
  142.  
  143.  
  144. USING PLAYLISTS IN BROWSE MODE: <tab> to enter; <esc> or <tab> leaves it. Can
  145. only enter Browse Mode if NOT recording. While in Browse mode, NONE of the
  146. scheduling is active (you might use this "feature" to prevent scheduled events
  147. from running), but it will more or less resume upon return.
  148.  
  149. Default "home" for playlists is "C:\TZ\FAVORED". If you wish to put playlists
  150. elsewhere, navigate TO a directory, but NOT INTO, and press the <home> key.
  151.  
  152. Now, in your browser, go to Shoutcast.com. Click on the "listen" icon of a
  153. stream you want to try; browser should download a "Shoutcast-Playlist.pls"
  154. (and should add numbering like "(2)" if more are clicked on). Back in Time4Z,
  155. navigate to the download directory, select if more than one playlist is there,
  156. and hit <enter>. Z should start the stream. If you like it, hit <insert>, type
  157. a name if you wish (without extension), and <enter>. You'll get some screen
  158. clutter that should confirm the file was copied to the selected directory.
  159.  
  160. >>> Thought the above procedure was clumsy, but recently observed the same
  161. problem of generic playlist names in XP with WinAmp. There MAY be a way there
  162. to save playlists with a true name, but if so, it's not obvious.
  163.  
  164. May be handy to delete playlists from the download directory using Time4Z, as
  165. the read-only attribute will be set. When you delete the last playlist, a
  166. "fix" for a baffling unexpected glitch (bug) will move one step up the tree.
  167.  
  168. Selecting with <enter> always causes current playing to stop and the new to
  169. start (if stream is good). The same action occurs for .MP3s or .WAVs, but
  170. while the File Selector procedure has capability to tag files, that'd at best
  171. duplicate function already in Z, besides complicate Time4Z. So the main uses
  172. are for playlists: to sample, rename, organize, delete, and easily select from
  173. a practically unlimited number of playlists in directories. -- I'm already
  174. noticing that my ad-hoc method of marking a "home" directory to copy files to
  175. is QUITE handy for sorting out files, and don't know of any OS or file manager
  176. that has similar function. Please STEAL this idea at least as an option!
  177.  
  178. -----------------------------------------------------------------------------
  179.  
  180. The file selector is general purpose and available (search KMPFS on Hobbes for
  181. a recent version that does a bit more than testing) to use in your own REXX
  182. code. A file selector is a fundamental building block, and I was NOT pleased
  183. with GUI implementations -- even in OS/2 WPS -- apparently this is one
  184. building block that programmers consider "good enough". All GUI methods to
  185. navigate a directory tree are annoying wastes of time, always reset the list
  186. to the top, which nearly always requires scrolling, particularly annoying when
  187. you want to return to a directory just exited. In my method, left and right
  188. arrow keys switch instantly back and forth between directory levels.
  189.  
  190. This fairly major effort began in Turbo Pascal v5.5, converted line by line,
  191. both greatly simplified and painfully contorted by REXX's peculiarities. I've
  192. stuck to Classic Rexx to avoid various complications. REXX is one of OS/2's
  193. best features, and mostly been a delight to use. - Oh, now and then one
  194. encounters an unearthly odd "feature", and a missing quote mark can drive one
  195. crazy, but overall, REXX is THE language for most that a reasonable person
  196. would want to do, and has installable features through DLLs for the rest.
  197.  
  198. I've tested by rummaging around on drives, looking into OS/2's obscure spots.
  199. Found a 900K Postscript file (winsock.ps) on W4 that I'd bet NO ONE has EVER
  200. used, probably a legacy from M$, as wasting space is their hallmark.
  201.  
  202. -----------------------------------------------------------------------------
  203.  
  204. Possible coming improvements:
  205.  
  206. - Display is a bit crowded in 80x25. A future version might use 'mode 90, 30'
  207.   or more, though so far looks like requires manual re-sizing upon start-up.
  208.  
  209. - A "record now" feature that will automatically create filename, really the
  210.   only benefit over using Z directly, so not exactly high-priority...
  211.  
  212.  
  213. NOT PLANNED:
  214.  
  215. - A built-in editor for TZ.SCH. To say the least, it'd be duplicative effort
  216.   when TEDIT is available and adequate. A little time spent studying TEDIT's
  217.   help screen is worthwhile; its mark and move functions are fairly nice
  218.   though most other functions are a bit Byzantine... Anyway, TEDIT is quite
  219.   impressive especially given its size. I just wish that its key assignments
  220.   and basic operation weren't unique in all the world. -- And _I'm_ not going
  221.   to make another editor with a unique command set for a minor program!
  222.  
  223. -----------------------------------------------------------------------------
  224.  
  225. - FTP is surely the easiest way to file share with Windows or Linux systems,
  226.   and does all that I require. My router works nicely and simply using
  227.   FTPServer127 and NetDrive 3.0.4.
  228.   [ BTW, Linux pulls FTP 3-4 times as fast as Windows on same hardware. Just
  229.     TOO typical. Check out PCLinuxOS 2007 Final, HPFS built into the kernel! ]
  230.  
  231. -----------------------------------------------------------------------------
  232.  
  233. - At present recording is on a somewhat cranky 1997 Flytech point-of-sale box
  234.   having a P166 in 9x12x3" (225x300x75mm) into which I managed to wedge 3
  235.   cards in 2.5 slots (one shared ISA or PCI slot), by removing card bracket
  236.   and running wires for the network jack. Other cards are ISA ESS 1869 (having
  237.   speaker level output), and Adaptec 2906 with 25-pin SCSI connector (thought
  238.   would be handy for more storage). The box has no CD drive, so was originally
  239.   loaded from Adaptec APA-348 parallel port SCSI adapter. Boot drive is a 1G
  240.   Compact Flash; the thrash drive for daily recordings is a 2G WD that's spun
  241.   down except when copying or transferring files. System power is on a digital
  242.   timer, simply crashed when power goes off, but seems to not bother it. I use
  243.   FireFTP extension for Firefox to retrieve recordings for listening on main
  244.   OS/2 box, via FTPServer127. To cap off this oddity, have a matching Flytech
  245.   9" (225mm) black-and-white SVGA monitor, the only part of the system that I
  246.   bought new, and a Northgate Omnikey Ultra on which I've personally typed
  247.   upwards of 25 million keystrokes.
  248.  
  249.   WHY? When I have a dozen NICE boxes that'd be less trouble? ... Well, the
  250.   small box looks cute, and when an early test showed that with OS/2 the P166
  251.   could handle 10 download streams at 16K bytes/S each AND play MP3s while
  252.   remaining fairly responsive, in contrast to XP on a 2800+, I just resolved
  253.   to rescue the odd little thing from the dumpster, and make it a project to
  254.   show that good code doesn't need fast hardware.
  255.  
  256.   However, with two SCSI-1 boxes for CD and external HD, it's not exactly
  257.   convenient, nor smaller than a conventional box. And, since Compact Flash
  258.   seems fairly reliable, and the 850M free is adequate storage, I may remove
  259.   the internal 2G drive, and the SCSI board as well, simply not necessary.
  260.