applescript to get imdb nfo file
#1
I was fooling around in applescript for the first time and made a small script to make a nfo file with the imdb link to the movie

only works if your file structure is as follows

movies
--movie1 (year)
----movie1.avi/mkv/mp4/etc
--movie2 (year)
----movie2.avi/mkv/mp4/etc
--movie3 (year)
----movie3.avi/mkv/mp4/etc

it uses the folder containing each movie to name the nfo and it deletes the last 8 chars (year) to get just the movie name

feel free to modify it to your liking -- probably not the best way to do it but it works


-------------------------script code--------------------------------

property imdburl : ""
property newurl : ""
property FolderPath1 : ""
property FolderPath : ""
property Foldername : ""


tell application "Finder"
activate
set theFolder to choose folder with prompt "Select the Movie Folder."
set theList to every folder of theFolder
repeat with i from 1 to count the theList
set thisItem to item i of theList as alias
set currentName to name of thisItem
set aList to name of files of thisItem as list
set currentnfo to text 1 thru -(7 + 1) of currentName
if (currentnfo & ".nfo" is in (aList)) then
i = i + 1
else
--set currentfolder to get the POSIX path of thisItem


tell application "Finder"

set FolderPath1 to thisItem -- sets file path to folder you select
set ParentFolder to container of FolderPath1 -- sets the parent folder of the folder you select
set Foldername to name of folder FolderPath1 -- sets the folder name as text
set FolderPath to get the POSIX path of FolderPath1



set newurl to "http://google.com/search?q=" & Foldername & "+imdb&btnI=I%27m+Feeling+Lucky"
--set the clipboard to newurl -- sets foldername to the clipboard
end tell

tell application "Safari"
open location newurl
activate
delay 7
set imdburl to URL of current tab of window 1
set the clipboard to FolderPath
close window 1
end tell

tell application "TextEdit"
activate
make new document
set text of document 1 to imdburl
set Foldername to text 1 thru -(7 + 1) of Foldername
save document 1 in FolderPath & "/" & Foldername
close document 1
end tell


tell application "Finder" to set name extension of (files of FolderPath1 whose name extension is "rtf") to "nfo"


end if




end repeat
end tell


----------------------end script code-----------------------
Reply

Logout Mark Read Team Forum Stats Members Help
applescript to get imdb nfo file0