Hope you can help with that... Kodi (former XBMC) needs to automatically identify the correct movie. The best way is to have a file called "movie.nfo" in the same folder as the video file(s). It simply contains the unique IMDB link to the movie. In most movie folders are already movie.nfo files with several information in xml format (sadly not successfully interpreted by KODI).
The information to extract from there is the unique movie ID. With this ID it is possible to generate a IMDB link and save it as movie.nfo (replace the old).
Example / How it should work:
- content of movie.nfo: " < id >tt0133093< / id >" (without spaces)
- get ID -> tt0133093
- generate link -> http://www.imdb.com/title/tt0133093/
- save the link in the new movie.nfo.
1. Snippet
REM Search DIR (current DIR/location)
set location=%cd%
REM For every DIR with a movie.nfo file look for the String "<id>"
FOR /F "delims=" "tokens=*" %%a in ('DIR %location% /AD /S /B') DO (IF EXIST "%%a\movie.nfo" (findstr "<id>" "%%a\movie.nfo")))
2. Snippet
REM This script snippet is from Aacini - https://stackoverflow.com/revisions/366c73ac-17b4-453e-b098-b78246c0184a/view-source - Thanks.
REM This script only works for one movie.nfo file, when executed in a folder with a movie.nfo file in it.
REM The Goal is to make it work for ALL folders, containing a movie.nfo file (without a empty ID <- optional)
for /F "delims=" %%b in ('findstr "<id>" "movie.nfo"') do set "line=%%b"
rem Change left delimiter by {
set "line=%line:<id>={%"
rem Change right delimiter by }
set "line=%line:</id>=}%"
rem Get second token delimited by { and }
for /F "tokens=2 delims={}" %%b in ("%line%") do set string=%%b
echo http://imdb.com/title/%STRING% >> movie-2.nfo