PDA

View Full Version : Using Symbolic links in Video Library



7ore
2010-07-25, 10:06 AM
As I wrote about in this thread (http://forums.gbpvr.com//showthread.php?47034-I-would-love-a-Movie-Library-in-NextPVR) I have my movies scattered around my network. I have used Moviewiz for sorting and viewing. But I needed a new way to handle it in NPVRs Video Library and I couldn't get ordinary shortcuts to work.
The Windows 7 built in Library functionality did not work.
But I have found a way by using Symbol links (I tried Junction as well but the folder.jpg wouldn't show then). I used the tool Link shell extension (http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html) and when it is installed all I need is placed in the right click menu. Only thing to note is that the symbol links have to be placed in a local folder on the computer.
When all movie folders is added, they show up nicely in Videos Library, just as I wanted.
This far I have added folders manually by the tool above, but a .bat file like below can be run by a scheduled task:

@echo off
::-----------------------------------------------------------
::Usage: Save the file as a .bat and place it in the folder above where
::you want your Symbollinks (or change ".\" below)
::Change <Target> to the folder where the movies are.
::This script starts with deleting the shortcut folder
::(so no obsolete files or renamed files is lurking)
::Then it lists all folders to the file dirX.txt and adds these as symbol links in
::the folder "shortcuts" placed in the same folder as this .bat file
::Add the folder "Shortcuts" to the media library and set a scheduled
::task to update the folder as often as needed. make sure to do it when it is not used...
::Add as many "Set dir..." as needed.
::-----------------------------------------------------------

setlocal ENABLEDELAYEDEXPANSION
Set dirA=.\shortcuts
Set dirB=<Target1>
Set dirC=<Target2>

rd /Q /S "%dirA%"
mkdir "%dirA%"

dir /A:D /B /O "%dirB%" >dirX.txt

for /f "tokens=* delims= " %%A in (dirX.txt) do (
mklink /d "%dirA%\%%A" "%dirB%\%%A"
)

::------------------------------------------------------
:: Copy all code between the lines for each added target
::------------------------------------------------------

dir /A:D /B /O "%dirC%" >dirX.txt

for /f "tokens=* delims= " %%A in (dirX.txt) do (
mklink /d "%dirA%\%%A" "%dirC%\%%A"
)
::------------------------------------------------------



There is some issues and questions around this.
* NPVR crashes when you open the folder with links - if there is a bad folder.jpg file among the movies (it works to open the the "normal" folder. (I had a folder.jpg with 1kb in size in one folder)

* I would like the meta data to be shown when I browse the folders, not just for the files. I think it can show data already, but I am not sure what files NPVR would like to see in he folder path. I know that tvshow.nfo works, but what should the file be called for movies? movie.nfo?

And it would be nice if the movie starts when I press OK on the folder - if there is one movie in the folder.

sub
2010-07-25, 04:20 PM
And it would be nice if the movie starts when I press OK on the folder - if there is one movie in the folder.You cant do that, but for you record - pressing 'Play' (ctrl-p) on a folder will auto queue the contents of the folder and start playback, giving you effectively the same thing.

7ore
2010-07-25, 06:58 PM
OK, thanks. I always forget to use the Play button...

One more thing about Symbol links; the script need tweaking to support all movie folders and to remove links for renamed and deleted folders too. I will try and get that to work as well.

Reddwarf
2010-08-02, 05:05 PM
OK, thanks. I always forget to use the Play button...

One more thing about Symbol links; the script need tweaking to support all movie folders and to remove links for renamed and deleted folders too. I will try and get that to work as well.

Does it work on network folders too?

whurlston
2010-08-02, 05:18 PM
mklink will work on network folders.