dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
909 stars 115 forks source link

call from a script in spyder #139

Closed daviddoji closed 6 years ago

daviddoji commented 7 years ago

First of all, thank you for this wonderful script man!

I'm trying to get it running from another script I'm writing to organize subtitles of different languages. The idea is to call it from a script within Spyder IDE:

do some other stuff
tvnamer .
continue doing stuff

When I try to use it, I get a

    tvnamer .
             ^
SyntaxError: invalid syntax

How can I do it?

Thanks in advance.

rustymyers commented 7 years ago

try calling it with python?

python tvnamer .

dbr commented 6 years ago

If you are calling tvnamer from a Python script, you would either need to use something like the subprocess module to run the tvnamer command like you would from a terminal https://docs.python.org/2/library/subprocess.html

Something like

import subprocess
args = ["tvnamer", "--batch", "."]
subprocess.call(args)