Create a link to IMDb site for each movie, at movie's folder
Create a link to IMDb site for each movie, at movie's folder
Hello,
I wonder if it is possible a new feature for the program.
The movie data are placed in the file .Nfo, which contains the code IMDb inclusive of each film.
I like to vote in the movies, and put them into lists, after seeing them.
It would be a very interesting feature where, after doing the fetch and rename the movie, it would create a file .lnk, a link pointing directly to the site of the movie on IMDb, because the link structure of IMDb is pretty simple.
Any questions I am available to exchange ideas.
Ty
I wonder if it is possible a new feature for the program.
The movie data are placed in the file .Nfo, which contains the code IMDb inclusive of each film.
I like to vote in the movies, and put them into lists, after seeing them.
It would be a very interesting feature where, after doing the fetch and rename the movie, it would create a file .lnk, a link pointing directly to the site of the movie on IMDb, because the link structure of IMDb is pretty simple.
Any questions I am available to exchange ideas.
Ty
Re: Create a link to IMDb site for each movie, at movie's fo
I already put the imdb and TMDb links into the nfo file. Its a one-liner to go through all nfos and write the urls into extra files.
(writing code from the back of my head without any testing whatsoever)
(writing code from the back of my head without any testing whatsoever)
Code: Select all
args.getFiles{ it.extension == 'nfo' }.each{
it.xml.imdb.text.saveAs(new File(it.dir, 'imdb.url'))
}
Re: Create a link to IMDb site for each movie, at movie's fo
Hello,
Thanks for the prompt reply.
However, I am very beginner ... How should I proceed to apply the above code? There is a way through the command line (Script .Bat)?
grateful
Thanks for the prompt reply.
However, I am very beginner ... How should I proceed to apply the above code? There is a way through the command line (Script .Bat)?
grateful
Re: Create a link to IMDb site for each movie, at movie's fo
You'll have to make a text file (e.g. makeurls.groovy) and then copy & paste that piece of code. Then you'll need to open the cmdline and run it with filebot.
e.g.
e.g.
Code: Select all
filebot -script makeurls.groovy /path/to/movies
Re: Create a link to IMDb site for each movie, at movie's fo
Hello,
Thanks for the reply.
When I run thiscode:
this is the line that returns:
And the file the link is not created.
grateful
Thanks for the reply.
When I run thiscode:
Code: Select all
E:\Comp>filebot -script E:\Comp\makeurls.groovy E:\Comp\MovieFolder
Code: Select all
MissingPropertyException: No such property: xml for class: java.io.File
Possible solutions: file, dir, name
groovy.lang.MissingPropertyException: No such property: xml for class: java.io.F
ile
Possible solutions: file, dir, name
at Script3$_run_closure2.doCall(Script3.groovy:2)
at Script3.run(Script3.groovy:1)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (░_░)
grateful
Re: Create a link to IMDb site for each movie, at movie's fo
This should work:
EDIT: Updated the script to generate imdb and tmdb links.
Code: Select all
args.getFiles{ it.extension == 'nfo' }.each{ nfo ->
def xml = nfo.text.xml
['imdb', 'tmdb'].each{ db ->
def url = xml."$db".text()
if (url) {
def urlFile = new File(nfo.dir, "${db}.url")
def content = "[InternetShortcut]\nURL=${url}\n"
println content.saveAs(urlFile)
}
}
}
Re: Create a link to IMDb site for each movie, at movie's fo
Works like a charm!
Thank you!
Thank you!
Re: Create a link to IMDb site for each movie, at movie's fo
Hello,
I saw you updated the script postprocess of uTorrent with this idea, and added TMDB. I thought great.
hugs
I saw you updated the script postprocess of uTorrent with this idea, and added TMDB. I thought great.

hugs
Re: Create a link to IMDb site for each movie, at movie's fo
the imdb url file was abit broken atleast at my part... (in the htpc.groovy script)
the original line was
i replaced it and added ability to set custom icon for these shortcuts just set the icon folder and call the icons imdb.ico and tmdb.ico
so just replace these additional lines in the htpc.groovy file in the fetchMovieArtworkAndNfo function
the original line was
Code: Select all
[[db:'imdb', id:movieInfo.imdbId, url:"http://www.imdb.com/title/tt{movieInfo.imdbId?.pad(7)}"], [db:'tmdb', id:movieInfo.id, url:"http://www.themoviedb.org/movie/${movieInfo.id}"]].each{
so just replace these additional lines in the htpc.groovy file in the fetchMovieArtworkAndNfo function
Code: Select all
[[db:'imdb', id:movieInfo.imdbId, url:"http://www.imdb.com/title/tt" + (movieInfo.imdbId ?: 0).pad(7)], [db:'tmdb', id:movieInfo.id, url:"http://www.themoviedb.org/movie/${movieInfo.id}"]].each{
if (it.id > 0) {
location = "C:\\Program Files\\FileBot\\"
def content = "[InternetShortcut]\nURL=${it.url}\nIconIndex=0\nIconFile=${location}${it.db}.ico"
content.saveAs(new File(movieDir, "${it.db}.url"))
}
}
Last edited by maortal on 12 Feb 2013, 22:09, edited 1 time in total.
Re: Create a link to IMDb site for each movie, at movie's fo
Hello,
Nice Update.
In fact, I noticed that some links actually had a bug in imdb, but not in TVDB.
I've seen the new version and it was great!
Congratulations!
Nice Update.
In fact, I noticed that some links actually had a bug in imdb, but not in TVDB.
I've seen the new version and it was great!
Congratulations!
-
- Posts: 4
- Joined: 02 Mar 2015, 22:53
Re: Create a link to IMDb site for each movie, at movie's fo
Hi,
This is not working anymore for FileBot version 4.5.6 (r2818)
Can someone please help me ?
I found only http://filebot.net/scripts/artwork.tmdb.groovy but it's too much for me.
I need only links for IMDB and TMDB inside .nfo file.
Thanks in advance for help
This is not working anymore for FileBot version 4.5.6 (r2818)
Can someone please help me ?
I found only http://filebot.net/scripts/artwork.tmdb.groovy but it's too much for me.
I need only links for IMDB and TMDB inside .nfo file.
Thanks in advance for help
Re: Create a link to IMDb site for each movie, at movie's fo
The fn:artwork.tmdb will always create .nfo files, and that .nfo file will always contain a TheMovieDB and IMDb link.
-
- Posts: 4
- Joined: 02 Mar 2015, 22:53
Re: Create a link to IMDb site for each movie, at movie's fo
but is there any way to remove everything from .nfo file except two lines:
Code: Select all
<imdb id='tt0425743'>http://www.imdb.com/title/tt0425743</imdb>
<tmdb id='41497'>http://www.themoviedb.org/movie/41497</tmdb>
-
- Posts: 4
- Joined: 02 Mar 2015, 22:53
Re: Create a link to IMDb site for each movie, at movie's fo
I've modified and merged two fiels htpc.groovy and artwork.tmdb.groovy
In results I created nfo.groovy script which create .nfo file which contains only IMDB and TMDB links
How to use:
Source code of nfo.groovy
Currently .nfo file is saved as "movie.nfo".
I want to save is as movie_name.nfo, but I don't know how to do it.
Also how to get rid of XML style from this script ?
My knowledge of scripting is vere weak and I need your help.
Thanks in advance.
In results I created nfo.groovy script which create .nfo file which contains only IMDB and TMDB links
How to use:
Code: Select all
filebot -script nfo.groovy /path/to/movies
Code: Select all
import static groovy.json.StringEscapeUtils.*
def override = _args.conflict == 'override'
args.eachMediaFolder{ dir ->
// fetch only missing artwork by default
if (!override && dir.hasFile{it.name == 'movie.nfo'}) {
println "Skipping $dir"
return
}
def videos = dir.listFiles{ it.isVideo() } as List
def query = _args.query
def options = []
if (query) {
// manual search & sort by relevance
options = TheMovieDB.searchMovie(query, _args.locale).sortBySimilarity(query, { it.name })
} else if (videos?.size() > 0) {
// run movie auto-detection for video files
options = MediaDetection.detectMovie(videos[0], TheMovieDB, _args.locale, true)
}
if (options.isEmpty()) {
println "$dir => movie not found"
return
}
// auto-select movie
def movie = options[0]
// maybe require user input
if (options.size() != 1 && !_args.nonStrict && !java.awt.GraphicsEnvironment.headless) {
movie = javax.swing.JOptionPane.showInputDialog(null, 'Please select Movie:', dir.path, 3, null, options.toArray(), movie)
if (movie == null) return null
}
println "$dir => $movie"
try {
fetchMovieArtworkAndNfo(dir, movie, dir.getFiles{ it.isVideo() }.sort{ it.length() }.reverse().findResult{ it }, true, override, _args.locale ?: Locale.ENGLISH)
} catch(e) {
println "${e.class.simpleName}: ${e.message}"
}
}
def fetchMovieNfo(outputFile, movieInfo, movieFile, override) {
def i = movieInfo
def mi = tryLogCatch{ movieFile?.isFile() ? MediaInfo.snapshot(movieFile) : null }
XML {
imdb("http://www.imdb.com/title/tt" + (i.imdbId ?: 0).pad(7))
tmdb("http://www.themoviedb.org/movie/${i.id}")
}
.saveAs(outputFile)
}
def fetchMovieArtworkAndNfo(movieDir, movie, movieFile = null, extras = false, override = false, locale = Locale.ENGLISH) {
tryLogCatch {
def movieInfo = TheMovieDB.getMovieInfo(movie, locale, true)
// fetch nfo
fetchMovieNfo(movieDir.resolve('movie.nfo'), movieInfo, movieFile, override)
}
}
I want to save is as movie_name.nfo, but I don't know how to do it.
Also how to get rid of XML style from this script ?
My knowledge of scripting is vere weak and I need your help.
Thanks in advance.
Re: Create a link to IMDb site for each movie, at movie's fo
I wouldn't mess with the existing script. Just use my unmodified scripts, and then run your own very simple script that greps the links you want from movie.nfo and write it to your own file however you like.
-
- Posts: 4
- Joined: 02 Mar 2015, 22:53
Re: Create a link to IMDb site for each movie, at movie's fo
but I have no idea how to scriptingrednoah wrote:I wouldn't mess with the existing script. Just use my unmodified scripts, and then run your own very simple script that greps the links you want from movie.nfo and write it to your own file however you like.

Based on my test I think that something shoul dbe change in this part of code
something with XML code and saveAs
Code: Select all
def fetchMovieNfo(outputFile, movieInfo, movieFile, override) {
def i = movieInfo
def mi = tryLogCatch{ movieFile?.isFile() ? MediaInfo.snapshot(movieFile) : null }
XML {
imdb("http://www.imdb.com/title/tt" + (i.imdbId ?: 0).pad(7))
tmdb("http://www.themoviedb.org/movie/${i.id}")
}
.saveAs(outputFile)
}
def fetchMovieArtworkAndNfo(movieDir, movie, movieFile = null, extras = false, override = false, locale = Locale.ENGLISH) {
tryLogCatch {
def movieInfo = TheMovieDB.getMovieInfo(movie, locale, true)
// fetch nfo
fetchMovieNfo(movieDir.resolve('movie.nfo'), movieInfo, movieFile, override)
}
}
Re: Create a link to IMDb site for each movie, at movie's folder
Here's an example for using existing xattr metadata to generate URL / NFO files:
viewtopic.php?f=3&t=324
xattr2url.groovy
viewtopic.php?f=3&t=324
Code: Select all
filebot -script /path/to/xattr2url.groovy /path/to/input
Code: Select all
args.files.findAll{ it.video }.each {
def link = getMediaInfo(it, "https://www.imdb.com/title/{imdbId}/")
def file = getMediaInfo(it, "{folder}/[IMDb] {n}.url")
println "$link => $file"
link.saveAs(file)
}