Skip to content
This repository has been archived by the owner on Mar 6, 2021. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeng753 committed Sep 24, 2019
1 parent 1a5845f commit e04e5fc
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions Waifu2x-Extension-Start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import os
import time
import psutil
import json

def judgeprocess(processname):
pl = psutil.pids()
for pid in pl:
if psutil.Process(pid).name() == processname:
return False
break
else:
return True

def Read_config():
config_path = 'Waifu2x-Extension\\config_waifu2xEX_start'
config = {}
if os.path.exists(config_path):
with open(config_path,'r+') as f:
config = json.load(f)
return config['language']
else:
while True:
print('----------------------------------')
print(' Choose language(选择语言):')
print(' 1. 中文')
print(' 2. English')
print('----------------------------------')
print('(1/2) : ')
c_language = input().strip(' ')
if c_language == '1':
config = {'language':'cn'}
with open(config_path,'w+') as f:
json.dump(config,f)
break
elif c_language == '2':
config = {'language':'en'}
with open(config_path,'w+') as f:
json.dump(config,f)
break
else:
os.system('cls')
print('Wrong input, try again.')
print('')
input('Press Enter to continue....')
os.system('cls')

if os.path.exists(config_path):
with open(config_path,'r+') as f:
config = json.load(f)
return config['language']

os.system('mode con cols=35 lines=15')
os.system('color f0')
os.system('title = Waifu2x-Extension')
language = Read_config()
os.system('cls')
print(' =============')
print(' |Starting...|')
print(' =============')
os.chdir('Waifu2x-Extension\\')
if language == 'cn':
os.system('start Waifu2x-Extension-CN.exe')
while judgeprocess('Waifu2x-Extension-CN.exe'):
time.sleep(0.01)
elif language == 'en':
os.system('start Waifu2x-Extension-EN.exe')
while judgeprocess('Waifu2x-Extension-EN.exe'):
time.sleep(0.01)
time.sleep(0.5)

0 comments on commit e04e5fc

Please sign in to comment.