Here this is confusing so let me explain.. (btw, I am using windows 7 pc) I have 22 folders on my drive . In each folder contains X amount of shows from different seasons etc..
Is there a way to tell windows media player to play a random video just once in that folder, then move on to the next folder and play a random video in that one, and so forth?
I know it seems simple but I just haven't found anything on google, or on mirc, or on other forums.
Is there scripting required? or do i have to know c++?
I know the easiest way is to just load every single video onto windows media player playist and hit the shuffle button but if I do, every once in a while I get back to back episodes from the same show, which I don't want.
In the end, I want to know if there's a way to play one single random video in 1 folder, then move on to the next folder and play 1 single random video and just go like that and cycle through so basically I never see the same show again until all 22 shows are shown? I hope that makes sense...
For future info, these videos range from avi to mpeg to mp4 to mkv,
If you can help me out, thanks a TON, ive been searching for years LOL. ^_^
Sure, but future runs might select the same file a second time. Generating multiple lists with unique files is best done in one run, and it greatly increases complexity. SET extensionList=avi mp4 mkv SET cnt=0 :Loop SET /A cnt+=1 IF EXIST %cnt%.m3u GOTO Loop >%cnt%.m3u ECHO.#EXTM3U FOR /D %%a IN (c:\somePath\*) DO CALL :PickFile "%%a" GOTO :EOF :PickFile SET searchList= FOR %%b IN (%extensionList%) DO CALL SET searchList=%%searchList%% "%~1\*.%%b" FOR /F %%b IN ('2^>NUL DIR /A-D-H-S %searchList% ^| FIND "File(s)"') DO SET limit=%%b SET /A fileNum=(%random% %% limit) + 1 FOR /F "tokens=2 delims=:" %%b IN ('2^>NUL DIR /A-D-H-S/B %searchList% ^| FINDSTR /N ".*" ^| FINDSTR "^%fileNum%:"') DO ^ CALL :AddList %1 "%%b" >>%cnt%.m3u GOTO :EOF :AddList @ECHO.#EXTINF:-1,%~n2 @ECHO.%~f1\%~2 @GOTO :EOF
Well, so: you got 22 shows, and 22 folders? or "n" shows, 22 folders? I'm a bit confused. It is do-able, i think, with batch, but not sure of your layout. My inital approach: use attrib | find "A " /c to get count of "unwatched", do a random on that value, use that for a "skip" on ('attrib | find "A "'), then wmplay32 that file, then switch that file's "A" attribute off so it won't get played again. Then switch to next folder, lather, rinse, repeat. I just don't know how these (movies, videos, etc) are set up / arranged / organized. Your post not quite clear to me. Maybe post a (short) sample of a couple of folders, and a scenario how you want that to unfold.
Ok... I have 22 folders. Let's say it's basically 22 different shows. In each folder, there are X episodes. The X is determined by the number of seasons from that show.. for example, The simpsons (Folder) has 50+ episodes, Bill Nye the Science guy (Folder) has 100 episodes., Garfield and friends (Folder) has 30+ episodes etc...
I want to know if theres a way to tell Windows Media player.. to choose The simpsons but only play 1 Random file in that Simpsons folder... then after that's done, go on to Bill Nye, then play 1 random file in that folder, then after thats done play Garfield and friends again 1 random file in that folder.. and so forth.
I suppose it is kinda like a Television Scheduling program but no time stamps.
I just want to watch each 22 shows with a variety of random videos so that I never see the same show twice until all 22 shows are done,
Hope that clears it up nbrane, or respond again and I shall respond as well LOL. ^_^
Easiest would be to write a batch to make a M3U file. Harder would be to write a VBScript/PowerShell script to interface with the WMP's COM object. EDIT: Easy way might look like this:
SET extensionList=avi mp4 mkv >out.m3u ECHO.#EXTM3U FOR /D %%a IN (c:\somePath\*) DO CALL :AddList %%a GOTO :EOF :AddList SET searchList= FOR %%b IN (%extensionList%) DO CALL SET searchList=%%searchList%% "%*\*.%%b" FOR /F %%b IN ('2^>NUL DIR /A-D-H-S %searchList% ^| FIND "File(s)"') DO SET limit=%%b SET /A fileNum=(%random% %% limit) + 1 FOR /F "tokens=2 delims=:" %%b IN ('2^>NUL DIR /A-D-H-S/B %searchList% ^| FINDSTR /N ".*" ^| FINDSTR "^%fileNum%:"') DO ( ECHO.#EXTINF:-1,%%~Nb ECHO.%~f1\%%~b)>>out.m3u
Interesting... that was a quick response LOL. I'm not sure what to do with this, are you saying to create a file to *.m3u and copy paste this? Well, I will try to import it to Windows Media Player after editing the correct folder extensions.
Thanks again for the fast response. I hope it works hehe ^_^
I'm not entirely sure what you're asking, but assuming you update the "C:\somePath" correctly, it'll look though all top level subdirectories and generate a M3U file, with 1 file per directory.
@Razor2.3 Oh wow how did you figure that out with all those confusing commands and arguments? So far after creating the batch file and renaming the folder, it created an *.m3u file that did exactly what I explained. ^_^ However, when I loaded that to Windows Media, some files wouldn't play. ( A number of queued files cannot be played..) I'm assuming it's because some of the filenames are too long and contain spaces?
If I change the lengthy filenames of each episode to single words will that fix the problem?
Oh and for future reference, let's say I end up with more than 22 shows.. (My folder library keeps growing) what part of the command line in the bat file would I have to change? Or does it automatically search c:\somePath\* for available directorys in there regardless of 22 shows?
Again, I can't believe this works! I am actually getting somewhere after years of frustration. This is amazing thank you so much! You're the best! ^_^
aoneone: Oh wow how did you figure that out with all those confusing commands and arguments?
I'm not sure what you're asking, but I'm pretty sure the answer is mind altering substances.aoneone: So far after creating the batch file and renaming the folder, it created an *.m3u file that did exactly what I explained
I like you. While most people would modify the batch file to match the file system structure, you modify the file system to match the batch file.aoneone: However, when I loaded that to Windows Media, some files wouldn't play. ( A number of queued files cannot be played..)
I'd have to see the resulting M3U file to know what's going on. (It's a text file you can open in Notepad.)aoneone: Or does it automatically search c:\somePath\* for available directorys in there regardless of 22 shows?
Yes
@Razor2.3 Here is the resulting m3u file after renaming all of my files to simple words and this is what I get: #EXTM3U
#EXTINF:-1,batman13
G:\Test\Batman\batman13.mkv
#EXTINF:-1,beakman303
G:\Test\Beakman\beakman303.mp4
#EXTINF:-1,beetlejuice032
G:\Test\Beetlejuice\beetlejuice032.avi
#EXTINF:-1,Bill94
G:\Test\Bill\Bill94.avi
#EXTINF:-1,doug110a
G:\Test\doug\doug110a.avi
#EXTINF:-1,Garfield105
G:\Test\Garfield\Garfield105.avi
#EXTINF:-1,s03e08
G:\Test\In\s03e08.avi
#EXTINF:-1,Lamb3
G:\Test\iron_chef\Lamb3.avi
#EXTINF:-1,mythbusters307
G:\Test\Mythbusters.Season.1-4\mythbusters307.avi
#EXTINF:-1,e01
G:\Test\ren\e01.avi
#EXTINF:-1,Reno410
G:\Test\Reno911\Reno410.avi
#EXTINF:-1,Rocko307
G:\Test\rocko\Rocko307.avi
#EXTINF:-1,Rugrats216
G:\Test\Rugrats\Rugrats216.avi
#EXTINF:-1,SYS112
G:\Test\Salute\SYS112.avi
#EXTINF:-1,sbep2
G:\Test\Streetball\sbep2.mp4
#EXTINF:-1,TV
G:\Test\tex\TV.mp4
#EXTINF:-1,dcs2ep3
G:\Test\The\dcs2ep3.mp4
#EXTINF:-1,Critic205
G:\Test\The\Critic205.avi
#EXTINF:-1,Office16
G:\Test\The\Office16.avi
#EXTINF:-1,Ghostbusters112
G:\Test\The\Ghostbusters112.avi
#EXTINF:-1,Simpsons109
G:\Test\The\Simpsons109.avi
#EXTINF:-1,Simpsons212
G:\Test\The\Simpsons212.avi
#EXTINF:-1,Simpsons706
G:\Test\The\Simpsons706.avi
#EXTINF:-1,WonderYears5081
G:\Test\The\WonderYears5081.aviI can see that some folders have a '\' between the folder names that contain spaces such as "The simpsons" (folder) it shows as \The\simpsons\*.
Also, when I load the output out.m3u some files play, some get skipped with a blue exclamation point next to them, some don't play and have a red X next to them.
A blue exclamation means WMP can find the movie, but can't play it for some reason. I suggest you install the Combined Community Codec Pack. I have yet to find a video file it cannot play. A red X means WMP can't find the file, because I missed that bug.
Here's the new, more robust version. Now tested with directories that include spaces:
SET extensionList=avi mp4 mkv >out.m3u ECHO.#EXTM3U FOR /D %%a IN (c:\somePath\*) DO CALL :PickFile "%%a" GOTO :EOF :PickFile SET searchList= FOR %%b IN (%extensionList%) DO CALL SET searchList=%%searchList%% "%~1\*.%%b" FOR /F %%b IN ('2^>NUL DIR /A-D-H-S %searchList% ^| FIND "File(s)"') DO SET limit=%%b SET /A fileNum=(%random% %% limit) + 1 FOR /F "tokens=2 delims=:" %%b IN ('2^>NUL DIR /A-D-H-S/B %searchList% ^| FINDSTR /N ".*" ^| FINDSTR "^%fileNum%:"') DO ^ CALL :AddList %1 "%%b" >>out.m3u GOTO :EOF :AddList @ECHO.#EXTINF:-1,%~n2 @ECHO.%~f1\%~2 @GOTO :EOF
@Razor2.3 Oh my goodness gracious... You are such a genius! The output file out.m3u generated all random shows in my directory without any errors, nor blue exclamation points, nor red x's.
It found all my files cleanly and I am smiling beyond belief!
One more little tiny question and I promise I wont bother you for your time ^_^.
Is there a way I can click on this batch file the 2nd time, or 3rd time, or X amount of times, so that it can generate the next playlist without overwriting the 1st out.m3u? If I click it the 2nd time it seems to overwrite my previous output file.
For example, whenver I click X amount of times on the bat file, it will generate the next set of random shows and not overwrite the previous output file? That way, I can simply take X output files and move them to my Windows Media player and have all those cycled shows ready.
I hope I'm not asking for too much, again you are a life-saver! ^_^
Sure, but future runs might select the same file a second time. Generating multiple lists with unique files is best done in one run, and it greatly increases complexity. SET extensionList=avi mp4 mkv SET cnt=0 :Loop SET /A cnt+=1 IF EXIST %cnt%.m3u GOTO Loop >%cnt%.m3u ECHO.#EXTM3U FOR /D %%a IN (c:\somePath\*) DO CALL :PickFile "%%a" GOTO :EOF :PickFile SET searchList= FOR %%b IN (%extensionList%) DO CALL SET searchList=%%searchList%% "%~1\*.%%b" FOR /F %%b IN ('2^>NUL DIR /A-D-H-S %searchList% ^| FIND "File(s)"') DO SET limit=%%b SET /A fileNum=(%random% %% limit) + 1 FOR /F "tokens=2 delims=:" %%b IN ('2^>NUL DIR /A-D-H-S/B %searchList% ^| FINDSTR /N ".*" ^| FINDSTR "^%fileNum%:"') DO ^ CALL :AddList %1 "%%b" >>%cnt%.m3u GOTO :EOF :AddList @ECHO.#EXTINF:-1,%~n2 @ECHO.%~f1\%~2 @GOTO :EOF
@Razor2.3 Oh my... I am literally speechless. Thank you soo much for helping me! You have no idea how long I have been searching for this kind of answer. Every time I tried to explain this kind of problem, it was just dead-end after dead-end; yet you helped me with this within a day or so.
You should be a teacher or something! ^_^ I tried learning C++ years ago but it was such a complicated language to learn.
Anyways, I don't ask for much but I will definately consider this as my Christmas present! LOL. I will be using this for a VERY long time. I hope this thread and info is useful to others in the future as well.
Thanks again Razor2.3. It's very hard to find help these days but you came in SPADES! ^_^ ~Cheers and happy holidays!
