import com.google.code.sagetvaddons.sjq.network.ServerClient; import com.google.code.sagetvaddons.metadata.Factory; // What directory are we moving archives to? File dest = new File("\\\\nesoi\\movies"); // Queued tasks are marked with this metadata value String SJQ4_QUEUED = "SJQ4_ARCHIVED"; Object objAiring = null; String ChanName = ""; ServerClient clnt = new ServerClient(); for(Object mediaFile : MediaFileAPI.GetMediaFiles("T")) { objAiring = MediaFileAPI.GetMediaFileAiring(mediaFile); ChanName = AiringAPI.GetAiringChannelName(objAiring); // If the media file is already stored on the NAS then just skip it if(MediaFileAPI.GetFileForSegment(mediaFile, 0).getAbsolutePath().toLowerCase().startsWith(dest.toString().toLowerCase())) continue; // If we've already queued this media file for archiving then skip it if(MediaFileAPI.GetMediaFileMetadata(mediaFile, SJQ4_QUEUED).equals("1")) continue; // If the file is currently recording then skip it if(MediaFileAPI.IsFileCurrentlyRecording(mediaFile)) continue; // ADD YOUR SPECIFIC CRITERIA FOR ARCHIVING BELOW // If it is a TV File if(MediaFileAPI.IsTVFile(mediaFile) && // And if it's a movie ShowAPI.GetShowCategory(mediaFile).equals("Movie") && // And it was on Starz ChanName ==~ "STZ.*") { clnt.addTask("MVMEDIA", Factory.getMap(mediaFile)); MediaFileAPI.SetMediaFileMetadata(mediaFile, SJQ4_QUEUED, "1"); } } clnt.close(); return 0;