Page 1 of 1
command line open multiple folders - enqueue all files
Posted: 02 Jun 2013 03:43
by wim
Hi. I'm struggling to open VLC via batch with multiple folders - and have all files within those folders enqueued to play randomly. This is for my daughter so she can watch her favourite shows.
The closest I can get via Windows batch / command line is :
start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" --started-from-file --playlist-enqueue --random --fullscreen "K:\folder 1" "K:\folder 2" "K:\folder 3"
This works up to a point and that being that it'll add the folders, then choose one at random, expand all files within that one chosen, then play a random file within.
This would work fine if there were only one file within each folder but in my case there are many many files within each and I'm adding to them constantly. Probability kicks in and the next file VLC chooses 'at random' is most-likely to be one of the files from the first expanded folder.
What I'd like is to open VLC with multiple folders added to a playlist, expand all files within those folders enqueued, then start playing the whole list at random.
Any ideas ? I've scoured and searched to no avail.
Hoping what I've written is succinct enough to follow.
Any and all help gratefully received - thankyou.
Wim.
Re: command line open multiple folders - enqueue all files
Posted: 13 Jun 2013 01:55
by wim
Anybody?
I'm surprised that this hasn't been raised before. All that's required is for VLC to enqueue all files within folders added to a playlist prior to playing. This is essential when random is used as a parameter.
Do the VideoLAN developers read these posts?
Re: command line open multiple folders - enqueue all files
Posted: 13 Jun 2013 11:42
by mederi
You can have all files from subfolders of one main folder:
Code: Select all
start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" --started-from-file --playlist-enqueue --random --fullscreen --no-playlist-tree --recursive="expand" "K:\main folder"
"K:\main folder" contains subfolders "folder 1", "folder 2" and "folder 3".
Re: command line open multiple folders - enqueue all files
Posted: 07 Aug 2014 03:52
by The3
Hi all,
I know I'm rez'ing an old thread here, but I'm wondering if any workarounds to get this functionality has been implemented since the last post.
In my current situation, I too have three directories full of content. Since they are all within a main directory, I am able to use mederi's solution under certain circumstances. However, there are times when I only want the playlist to draw from two of the three directories, so using the parent folder isn't an option. But as the OP said, when you add multiple folders via commandline, all folders other than the one containing the first file to play remain unexpanded until the randomizer happens to select them, which can lead to some very wacky play probability for files.
Re: command line open multiple folders - enqueue all files
Posted: 07 Aug 2014 15:58
by kodela
Make a playlist for your folder and open the playlist with the command line.
Code: Select all
START "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --playlist-tree "D:\VLC\my_folders.xspf"
Re: command line open multiple folders - enqueue all files
Posted: 08 Aug 2014 02:05
by The3
Thanks for the suggestion, kodela. Unfortunately, listing the folders in a playlist file and then opening the playlist via the commandline is functionally identical to serially listing out the folders at the end of the VLC commandline call. In either case, only one of the folders gets expanded immediately, and the others remain collapsed until they happen to be landed on in the shuffle.
Is there really no option/parameter to explicitly force VLC to fully expand an entire playlist immediately before it begins playing it?
EDIT:
So I just happened to stumble across
this other thread (which was slightly confusingly named) that directly addresses this exact issue. Jean-Baptiste's solution, which is the final post in the thread, was to "force preparsing of items" in VLC's preferences. Perhaps I'm missing something, but the only relevant option I can find in the preferences menu is a checkbox to "automatically preparse files," which is already checked by default it seems. Theoretically, is that what this option is
supposed to do? Because if so, it definitely doesn't seem to work.
Re: command line open multiple folders - enqueue all files
Posted: 15 Sep 2014 08:57
by DiddiZ
Code: Select all
--auto-preparse, --no-auto-preparse
Automatically preparse files (default enabled)
Automatically preparse files added to the playlist (to retrieve some
metadata). (default enabled)
Auto-preparse will retrieve metadata from the files once the folders are expanded.
I, too, am looking for a solution to expand all added folders at once.
Re: command line open multiple folders - enqueue all files
Posted: 27 Jan 2018 19:31
by niblarto
Hi,
I'm facing the same issue.
Has anyone found out if there is a solution?
I'm using the following, but it still needs each folder to be hit by the random selection, for it to expand and the contents to become available for random selection.
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --playlist-tree --recursive=expand --auto-preparse --quiet -f -LZ "C:\Temp\Vids\Test B" "C:\Temp\Vids\Test A"
Cheers
Re: command line open multiple folders - enqueue all files
Posted: 16 Feb 2019 08:28
by Darkoshi
I had the same problem with VLC v2.2.6. I upgraded to the latest version, 3.0.6, but it also had the same problem.
After reading some other threads indicating that it did work earlier, I tried version 3.0.3, and in that version, it worked as desired, expanding all the folders included on the command line.
But in the mean time, I found a workaround for the versions where it wasn't working as desired:
On Windows, if your hard drive is formatted as NTFS, you can create a new folder, and in that folder, create "hard links" AKA "junctions" to the other music folders which you want to open in VLC. Then when starting VLC, specify only the new top-level folder. It will expand the linked-to subfolders.
Note: You have to open the Command Prompt with "Run as administrator" for the below mklink commands to work:
Example:
C:\music>md musicLinksFolder
C:\music>cd musicLinksFolder
C:\music\musicLinksFolder>mklink /j cassettes C:\music_cassettes
Junction created for cassettes <<===>> C:\music_cassettes
C:\music\musicLinksFolder>mklink /j cds C:\music_cds
Junction created for cds <<===>> C:\music_cds
C:\music\musicLinksFolder>mklink /j dnld C:\music_download
Junction created for dnld <<===>> C:\music_download
C:\music\musicLinksFolder>dir
Directory of C:\music\musicLinksFolder
02/14/2019 05:54 PM <DIR> .
02/14/2019 05:54 PM <DIR> ..
02/14/2019 05:53 PM <JUNCTION> cassettes [C:\music_cassettes]
02/14/2019 05:54 PM <JUNCTION> cds [C:\music_cds]
02/14/2019 05:54 PM <JUNCTION> dnld [C:\music_download]
start vlc "C:\music\musicLinksFolder" --random
Re: command line open multiple folders - enqueue all files
Posted: 19 Oct 2019 22:36
by LordLiverpool
Another option is to create a batch file that generates the playlist from the folders.
Example batch file:
Code: Select all
@echo off
dir "c:\Folder1\*.mp3" /s /b /a-d > "E:\Documents\Music\Playlist.m3u"
dir "c:\Folder2\*.mp3" /s /b /a-d >> "E:\Documents\Music\Playlist.m3u"
dir "c:\Folder3\*.mp3" /s /b /a-d >> "E:\Documents\Music\Playlist.m3u"
"D:\Programs\Video\VLC\vlc.exe" "E:\Documents\Music\Playlist.m3u" --random
I've just tried this and it works a treat (it will search all the subdirectories of the folders). Add more file types if needed. Where this may not work is with song paths containing special characters, since the batch command-line processor can't handle Unicode. The equivalent implemented in Powershell would do the trick though, since .m3u files can also be in Unicode format, as far as I know.
Re: command line open multiple folders - enqueue all files
Posted: 20 Oct 2019 15:01
by LordLiverpool
Here is the Powershell version. The contents of the "Classical" subfolder is filtered out of the first folder.
Code: Select all
$sPlaylistPath = 'E:\Documents\Music\Playlist.m3u'
$sMusicRoot = "D:\Music\"
$sMusicTypesSpec = "*.mp3", "*.wma"
# Generate Unicode playlist
$sExcludeSpec = ($sMusicRoot + "Folder1\Classical\*")
Get-ChildItem -Path ($sMusicRoot + "Folder1") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | where-object{$_.FullName -notlike $sExcludeSpec} | % { $_.FullName } > $sPlaylistPath
Get-ChildItem -Path ($sMusicRoot + "Folder2") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | % { $_.FullName } >> $sPlaylistPath
Get-ChildItem -Path ($sMusicRoot + "Folder3") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | % { $_.FullName } >> $sPlaylistPath
# Run VLC with playlist
& ("D:\Programs\Video\VLC\vlc.exe") $sPlaylistPath --random
Re: command line open multiple folders - enqueue all files
Posted: 18 Dec 2019 20:39
by LordLiverpool
Correction: m3u file should be UTF8 format
Code: Select all
$sPlaylistPath = 'E:\Documents\Music\Playlist.m3u'
$sMusicRoot = "D:\Music\"
$sMusicTypesSpec = "*.mp3", "*.wma"
# Generate UTF8 playlist
$sExcludeSpec = ($sMusicRoot + "Folder1\Classical\*")
Get-ChildItem -Path ($sMusicRoot + "Folder1") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | where-object{$_.FullName -notlike $sExcludeSpec} | % { $_.FullName } | out-file -encoding utf8 $sPlaylistPath
Get-ChildItem -Path ($sMusicRoot + "Folder2") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | % { $_.FullName } | out-file -encoding utf8 -Append $sPlaylistPath
Get-ChildItem -Path ($sMusicRoot + "Folder3") -Include $sMusicTypesSpec -Recurse -Attributes !Directory | % { $_.FullName } | out-file -encoding utf8 -Append $sPlaylistPath
# Run VLC with playlist
& ("D:\Programs\Video\VLC\vlc.exe") $sPlaylistPath --random
Re: command line open multiple folders - enqueue all files
Posted: 14 Jul 2020 12:50
by chickenfinger
I had the same problem with VLC v2.2.6. I upgraded to the latest version, 3.0.6, but it also had the same problem.
After reading some other threads indicating that it did work earlier, I tried version 3.0.3, and in that version, it worked as desired, expanding all the folders included on the command line.
But in the mean time, I found a workaround for the versions where it wasn't working as desired:
On Windows, if your hard drive is formatted as NTFS, you can create a new folder, and in that folder, create "hard links" AKA "junctions" to the other music folders which you want to open in VLC. Then when starting VLC, specify only the new top-level folder. It will expand the linked-to subfolders.
Note: You have to open the Command Prompt with "Run as administrator" for the below mklink commands to work:
Example:
C:\music>md musicLinksFolder
C:\music>cd musicLinksFolder
C:\music\musicLinksFolder>mklink /j cassettes C:\music_cassettes
Junction created for cassettes <<===>> C:\music_cassettes
C:\music\musicLinksFolder>mklink /j cds C:\music_cds
Junction created for cds <<===>> C:\music_cds
C:\music\musicLinksFolder>mklink /j dnld C:\music_download
Junction created for dnld <<===>> C:\music_download
C:\music\musicLinksFolder>dir
Directory of C:\music\musicLinksFolder
02/14/2019 05:54 PM <DIR> .
02/14/2019 05:54 PM <DIR> ..
02/14/2019 05:53 PM <JUNCTION> cassettes [C:\music_cassettes]
02/14/2019 05:54 PM <JUNCTION> cds [C:\music_cds]
02/14/2019 05:54 PM <JUNCTION> dnld [C:\music_download]
start vlc "C:\music\musicLinksFolder" --random
You can also use /D instead of /j for server folders and it works.
Example
mklink /D "TV Show" "\\Server\Folder\TV\Show"