google-code-export / fanficdownloader

Automatically exported from code.google.com/p/fanficdownloader
0 stars 0 forks source link

FEATURE REQUEST: return name of finished file or allow post-processing scripts #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

Yet another feature request:

I need to postprocess epubs after the download process to add them to my 
library. Currently (I'm on OS X) I dothis with a folder action, (basically a 
watched directory), but it would be nicer, if I could manage a closer 
integration into the toolchain.

There's two possibilities: 
One: would be that the downloader returns the full filepath, so I can take that 
output and stuff it into my script.

Even better would be a config option where an arbitrary script could be defined 
as postprocessing script, and the downloader would call that script after 
writing the file, eg:

post_process_cmd: /usr/local/bin/addbook -f %epub%

or something similar.

If that's already possible or easily hackable somehow, let me know, please.

Thanks. 

Original issue reported on code.google.com by grooving...@gmail.com on 2 Nov 2011 at 7:53

GoogleCodeExporter commented 9 years ago
Interesting idea.  I'll look into it.

(FYI, I don't get any alerts from code.google.com when a new issue is created.  
Best to drop us a note in the group, too.)

Original comment by retiefj...@gmail.com on 14 Dec 2011 at 4:16

GoogleCodeExporter commented 9 years ago
I've added this feature (as a post_process_cmd) to the more recent version. 
http://fanficdownloader.googlecode.com/files/fanficdownloader-4.1.1.zip

It works for me on Windows7, let me know if there's any issues with Mac.

Original comment by retiefj...@gmail.com on 14 Dec 2011 at 7:04

GoogleCodeExporter commented 9 years ago
Cool. I'll try it asap and let you know how it works on OS X

Original comment by grooving...@gmail.com on 15 Dec 2011 at 5:18

GoogleCodeExporter commented 9 years ago
Seems to have a problem:

Traceback (most recent call last):
  File "./downloader.py", line 210, in <module>
    main()
  File "./downloader.py", line 198, in main
    .substitute(metadata))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 486, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

I've tried the specified command manually and it works.

Original comment by grooving...@gmail.com on 16 Dec 2011 at 2:17

GoogleCodeExporter commented 9 years ago
Hmmm.  It's a problem that I thought of--and I was sure I tested for, but I 
guess not.  

It's treating the entire command as one argument.  Telling it to use a shell to 
run it lets the shell parse the args in the usual fashion.

Try the attached downloader.py file (it's a one-line change) and see if that 
fixes it.

Original comment by retiefj...@gmail.com on 16 Dec 2011 at 4:08

Attachments:

GoogleCodeExporter commented 9 years ago
Works.

Thanks!

Original comment by grooving...@gmail.com on 16 Dec 2011 at 4:15

GoogleCodeExporter commented 9 years ago
Excellent!  I'll check in the change.

Original comment by retiefj...@gmail.com on 16 Dec 2011 at 4:24