Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #22

Merged
merged 3 commits into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Ebook-Publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ def MakeClass(url):
parser.add_argument('-o','--output-type', help='The file type you want', choices=['txt', 'epub'])
parser.add_argument('-f','--file', help="Use text file containing a list of URLs instead of single URL", action='store_true')
parser.add_argument('-d','--directory', help="Directory to place output files. Default ./")
parser.add_argument('-q','--quiet', help="Turns off most terminal output", action='store_true')
args=parser.parse_args()

if args.quiet:
sys.stdout=open(os.devnull, 'w')
#print('quiet enabled')

stdin=False
if not sys.stdin.isatty():
args.file=True
Expand All @@ -123,8 +128,8 @@ def MakeClass(url):
f.close()
else:
urls=[]
for line in sys.stdin:
urls.append(line)
stdinput=sys.stdin.read()
urls=stdinput.split()
for i in urls:
#site=MakeClass(i)
if ftype=='epub':
Expand Down
11 changes: 9 additions & 2 deletions Site/Chyoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
import sys
from Site import Progress
#from subprocess import Popen, PIPE
import os

class Chyoa:

Expand Down Expand Up @@ -46,6 +46,11 @@ def __init__(self, url):
if soup.find('form', attrs={'id':'immersion-form'}) is not None:
inputs=soup.find('form', attrs={'id': 'immersion-form'}).find_all('input', attrs={'value':''})
for i in range(len(inputs)):
if not sys.stdout.isatty():
q=True
sys.stdout=open('/dev/tty', 'w')
else:
q=False
print('Input immersion variable '+str(i)+' '+soup.find('label', attrs={'for':'c'+str(i)}).get_text()+' ('+inputs[i].get('placeholder')+') (Leave blank to keep placeholder name)')
try:
sys.stdin = open('/dev/tty')
Expand All @@ -56,8 +61,10 @@ def __init__(self, url):
self.oldnames.append(inputs[i].get('placeholder'))
if self.renames[i]=='':
self.renames[i]=self.oldnames[i]
if q:
sys.stdout=open(os.devnull, 'w')


#if args.quiet:
print(self.title+'\n'+str(self.authors)+'\n'+self.summary)
#print(self.chapters)

Expand Down