avatar
motd.py

Thomas 44 5th Nov, 2019

PYTHON 1.09 KB
                                           
                         #Imports

from time import sleep 		#Required for style
import getpass                             #Required to get username

#Defs

#Reading index file

f= open("/etc/asciigen/index.cfg","r")
if f.mode != "r":		#Verify if file is readable
	exit()
findex=f.readlines()
f.close()

#Variables
fontsize=int(findex[0])
charset=findex[1]
start=3
characters=list()
charstart=list()
output=""

# Get username & verification

i="Welcome " + getpass.getuser()
amount=len(i)	#Note! Variable starts from 1-end
for x in range(amount):							#Check if characters are available
	ver=charset.find(i[x])
	if ver < 0:
		print("Invalid character detected in username, cannot print.")
		exit()
	charstart.append(start+(6*ver))			#Calculate starting line

#Convertion
for y in range(fontsize):
	for x in range(amount):
		output=output+findex[charstart[x]-1].rstrip("\r\n")
		charstart[x]=charstart[x]+1

#Output printing

	print(output)
	sleep(0.2)
	output=""

print()
#input()
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data

Comments

Authentication required

You must log in to post a comment.

Log in
    There are no comments yet.