Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to create a batch file that does the following:

  1. Scan a folder's contents including subfolders for movie media

  2. Parse from the file name, the movie name and the year, since I am using theRenamer to rename all my movies in that format, it shouldn't be too hard.

  3. Then send the movie title and year to an api like http://www.deanclatworthy.com/imdb/ and retrieve the json data, and store it into variables.

  4. Then I will work with atomicparsely, to set the new data if populate to the movie file's metadata.

IF you can help with one part of this, I will appreciate it.

Thank you kindly.

share|improve this question
2  
Which OS are you using? –  Sathya Dec 2 '11 at 5:16
    
Windows XP. Thank you. –  crosenblum Dec 2 '11 at 10:02
add comment

1 Answer

What you are asking is a bit much for a simple batch file (i'm assuming you are using windows yes?) espectialy when you said that you want to be able to fetch data from the web. The easiest approach to this would probably be to use a a scripting language like python. Have the batch file simple kick off the program. Python has a lot of ready made libraries for helping you do exactly what you are asking for there.

But, and i'm not 100% certain on this as I'm not a windows batch guru, but I don't think what you are asking is even possible in windows batch. each line of a batch script is an entirely independent command and so it is hard to share information needed to do what you are describing. It could probably be done with Linux Bash files, but that would probably take far more effort than just using a language that is designed for that sort of thing. batch and bash really aren't.


some example code in python

import os
subs = os.listdir(path_to_your_files)

Then make some function that finds all the movies in that folder, and its sub folders recursively then it isn't hard to parse out the information from the name as you want to do.

An IMDB python api can be found here

I'm not familiar with atomicsparsely, but if worse came to worse you could make the commandline calls you need as python strings and then call them from python. not fantastic, but it would certainly get the job done.

share|improve this answer
    
Python is a great suggestion. I suspect PowerShell might also be a possibility if the OP has any .NET experience. –  user3463 Dec 2 '11 at 6:38
    
Unfortunately, I strongly prefer to stay as a standards windows batch file. This needs to stay as just a normal batch file. –  crosenblum Dec 2 '11 at 10:03
    
@crosenblum I'm pretty sure it's not going to be possible with a simple batch file, unless your batch file is going call other (Pything/.net) programs or other utilies such as curl/wget –  Sathya Dec 2 '11 at 10:19
    
I wouldn't mind using wget, since that is an executable. How would i use it? –  crosenblum Dec 2 '11 at 13:27
    
may I ask why it has to say as a batch file? I am quite certain you are going to be doing far more work than you need to accomplish this in batch. –  Narcolapser Dec 2 '11 at 14:16
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.