So i modified the sorty script to fit my setup and it seems to work fine..it renames, moves my files and updates XBMC. No the only thing missing is cleaning up any clutter left over in my download directory and delete the folder containing the clutter. I was looking at the Cleaner script but im unclear on how i can add it to my script and hardcode the directory i want it to check for clutter. What i would like is to ether ignore the clutter first, transfer the movie and then delete everything that is left including the directory or delete the clutter right away, transfer the movie and delete the folder. Here is my script if it can help:
Code: Select all
// PERSONALIZED SETTINGS
def movieDir = "I:/test3"
def movieFormat = "D:/Videos/Movies/{movie}/{movie}"
// XBMC ON LOCAL MACHINE
def xbmc = ['htpc-saitoh'] // (use [] to not notify any XBMC instances about updates)
/*
* Sort into folders
*/
movieDir.getFolders{ it.hasFile{ it.isVideo() } }.each{ dir ->
println "Processing $dir"
def files = dir.listFiles{ it.isVideo() }
// sort movies
def paths = '/' + rename(file:files, db:'imdb', format:movieFormat) + '/'
def Film = paths.split("\\\\")
println Film + "this is Film Value"
println Film[3] + "This is Film Array value"
def fullpath = 'smb://SRV-saitoh/videos/Movies/' + Film[3]
xbmc.each { host ->
telnet(host, 9090) { writer, reader ->
// API call for latest XBMC release
def msg = '{"id":1,"jsonrpc":"2.0","method":"VideoLibrary.Scan","params":{"directory":"'+ fullpath +'/"}}'
println(msg)
writer.println(msg)
}
}
}