This thread evolved from a previous one on the subject of random/shuffle play. However, this takes the topic in a new direction, namely that of an actual solution. Some will find it inferior to what they hope will someday be included in the firmware of the Patriot Box Office, but it does offer a few advantages that firmware cannot match. In any case, you're welcome to use my program.
I wrote this in Visual Basic Scripting language, so you'll be able to read it yourself and verify that it contains no malicious content. You will also be able to make minor changes or even major additions to the program without access to any compiler or other programs.
The solution I devised is a simple randomized playlist creator that takes into account the special requirements of a network media player like the Patriot Box Office. Once you do a little minor setup, this program can be invoked from your Windows Explorer context menu, specifically as a "Send To" target. There are only two types of objects it will perform an operation with (ignoring all others):
A) With an existing playlist file, it will simply read the playlist into memory, shuffle the order of the songs, and then overwrite the original playlist file, retaining all the original contents. There is a dialog to confirm the operation.
B) With any folder object (selected via Explorer), the playlist maker will find all the music files it contains and optionally recurse all subdirectories and find any music within that entire structure. Then it will randomize this list and write a playlist file in the root of the folder that was selected in Explorer. The playlist entries do not use absolute paths, but rather just the path relative to the location of the playlist file itself. Thus, as long as the playlist file isn't moved to another folder, it will play just fine in the Patriot Box Office over a network connection.
Here is a link to the text file for browser viewing:
http://garymarks.com/pbo/Randomized_Playlist_Maker.txt
Download the zipped .VBS file with this link:
http://garymarks.com/pbo/Randomized_Playlist_Maker.zip
Here's how to set this program up for use in Windows Explorer:
1) Unzip and move the script file to the location where you want it to reside.
2) Create a shortcut to the script file. When naming the shortcut, remember that this is the label that will appear on the "Send To" submenu. If you like, you can even assign a special icon for the shortcut that will replace the standard drab VBS icon.
3) Locate your user "SendTo" folder and move the shortcut file to this folder.
In Windows XP, it is "C:\Documents and Settings\(user name)\SendTo."
Windows 7 uses "C:\Users\(user name)\AppData\Roaming\Microsoft\Windows\SendTo."
That's it! Now you can right-click on any folder or existing playlist in Explorer that is within the network share structure accessible to Patriot Box Office, mouse to the "Send To" menu item and send it to "Randomized Playlist Maker," and the appropriate action will be performed. I included a line in the script that opens the finished playlist in NotePad for your inspection, but you may want to disable that command after using it a few times. Maybe this will help a few people get slightly better use from the Patriot Box Office. I know I'm rather fond of mine.
New feature added 4/20/2010: "Silent Mode" for scripting and other forms of automated execution, so dialogs can be suppressed for an automated context without altering the way the program behaves when invoked manually in Windows Explorer. For an automated context, a shortcut can be created and added to your Windows startup folder that will reshuffle your favorite playlist every time you reboot. Or this can be done on a more regular or frequent basis by creating a Windows Scheduled Task. In most usage, I think you can safely omit the reference to "Wscript.exe" below, but it seems to be necessary with the Windows Task Scheduler, so I've included it.
Here's the command line syntax for scripted or shortcut execution (including Silent Mode switch):
Wscript.exe Randomized_Playlist_Maker.vbs [/s [/nr]] (target)
For example...
Wscript.exe "C:\Program Files\_MiscScripts\Randomized_Playlist_Maker.vbs" /s "D:\Music\_MyPlayList.m3u"
(this command shuffles the lines in "_MyPlayList.m3u" while displaying no dialogs or finished playlist)
-OR-
Wscript.exe "C:\Program Files\_MiscScripts\Randomized_Playlist_Maker.vbs" /s /nr "D:\Music"
(generates a randomized playlist of the "D:\Music" folder, and the optional "/nr" switch suppresses recursion)
New feature added 5/1/2010: Playlist Naming Dialog, which not only allows you to give the playlist file a custom name at the time it is compiled, but it allows you to specify a path further upstream (toward the root) where the playlist file will be created. The significance of this is that when you create the playlist in another directory, the pathnames of the entries inside the playlist need to reflect the correct relative paths to the files from the location of the playlist, which isn't the case if you simply move the playlist file. Also, the default name for the playlist file is now based on the name of the target folder from which the playlist is compiled (this affects silent mode as well). This should make it easier to create multiple playlists without name collisions that might result in one playlist overwriting another.
Minor bug-fix added on 5/10/2010: When creating a new playlist using command-line syntax (such as from a batch file), text case (capitalization) in the specified path had to match Windows' folder names exactly, or else the pathnames in the playlist would be incorrect. Sloppiness is now tolerated![]()


Reply With Quote
