artcgallery

artcontrol gallery

Create gallery for artcontrol artwork.

Uses Year / Month / Day format.

Create blog post for each day there is a post.

It will need to list the files for that day and create a markdown file in posts that contains the artwork. Name of art then followed by each pience of artwork -line, bw, color.

write a message about each piece of artwork.

need to read a config file which lists the blog to update.

In [52]:
import os
import arrow
import getpass
import configparser
import time
#import boto
In [53]:
myusr = getpass.getuser()
In [54]:
raw = arrow.now()
In [55]:
yraw = raw.strftime("%Y")
mntaw = raw.strftime("%m")
dytaw = raw.strftime("%d")
In [56]:
#dytaw = str(28)
In [57]:
fulda = yraw + '/' + mntaw + '/' + dytaw
In [58]:
fultim = fulda + ' ' + raw.strftime('%H:%M:%S')
In [59]:
arnow = arrow.now()
In [60]:
curyr = arnow.strftime('%Y')
In [61]:
curmon = arnow.strftime('%m')
In [62]:
curday = arnow.strftime('%d')
In [63]:
#curday = '28'
In [103]:
config = configparser.ConfigParser()
In [104]:
config.read('/home/{}/.config/artcgallery.ini'.format(myusr))
Out[104]:
['/home/pi/.config/artcgallery.ini']
In [105]:
config = configparser.RawConfigParser()
config.read('/home/{}/.config/artcgallery.ini'.format(myusr))

# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
defpath = (config.get('default', 'defaultpath'))
nameofblogpost = (config.get('default', 'postname'))
imgorigin = config.get('default', 'imgorigin')
In [108]:
#artctrlpath = '/home/{}/git/artctrl-stage'.format(myusr)
In [109]:
galerdir = ('{}/galleries/'.format(defpath))
In [110]:
pathdir = ('{}/posts/'.format(defpath))
In [111]:
oslispa = os.listdir(pathdir)
In [112]:
galdir = os.listdir(galerdir)
In [113]:
if curyr in galdir:
    pass
else:
    os.mkdir(galerdir + curyr)
In [114]:
mondir = os.listdir(galerdir + curyr)
In [115]:
if curmon in mondir:
    pass
else:
    os.mkdir(galerdir + curyr + '/' + curmon)
In [116]:
daydir = os.listdir(galerdir + curyr + '/' + curmon )
In [117]:
fridpath = ('{}{}/{}/{}').format(galerdir, curyr, curmon, curday)
In [118]:
fulldaypath = (galerdir + curyr + '/' + curmon + '/' + curday)
In [119]:
if curday in daydir:
    pass
else:
    os.mkdir(galerdir + curyr + '/' + curmon + '/' + curday)
In [125]:
daypost = ('{}/posts/{}.md'.format(defpath, nameofblogpost))
In [ ]:
 
In [126]:
daymetapost = ('{}/posts/{}.meta'.format(defpath, nameofblogpost))
In [127]:
daymdpost = ('{}/posts/{}.md'.format(defpath, nameofblogpost))
In [137]:
subprocess.call('scp -r {}/*.png {}'.format(imgorigin, fridpath), shell=True)
Out[137]:
0
In [145]:
todayart = os.listdir(fulldaypath)
In [146]:
todayart.sort()
In [147]:
gallerpath = ('/galleries/{}/{}/{}/'.format(curyr, curmon, curday))
In [148]:
urlpatz = 'http://artctrl.me'
In [149]:
patchurl = urlpatz + gallerpath
In [150]:
if nameofblogpost not in oslispa:
    tagblog = input('post tags: ')
    
    with open(daymetapost, 'w') as daympo: 
        daympo.write('.. title: {}\n.. slug: {}\n.. date: {}\n.. tags: {}\n.. link:\n.. description:\n.. type: text'.format(nameofblogpost, nameofblogpost, fultim, tagblog))
    
    with open(daymdpost, 'w') as daymark:
        for toar in todayart:
            thoughon = input('thoughts on: {} '.format(toar))
            daymark.write('![{}]({}{})\n\n{}\n\n'.format(toar.replace('.png', ''), gallerpath, toar, thoughon))
            
            #api.update_with_media('{}{}/{}'.format(gifpat, namofgifsea, ranlocgif), status='Started typing script {} {}'.format(blognam, jointag))
     
    
else:
    pass
post tags: gimp, rickmorty
thoughts on: wacomend-jesusmo.png Line drawing of webcomic Jesus and Mo. 
thoughts on: wacomend-rickmorty.png Rick and Morty
thoughts on: wacomend-spaceflight.png focus is the square head character in the center. Long neck, and circles attach the legs. squares, cicles, and wavy lines surrounding. 

check to see if that blog post name already excist, if so error and ask for something more unique!

input art piece writers. Shows the art then asks for input, appending the input below the artwork. Give a name for the art that is appended above.

In [151]:
os.chdir(defpath)
In [154]:
subprocess.call('nikola build', shell=True)
Out[154]:
0
In [139]:
#os.system('aws s3 sync {} s3://artctrl-staging'.format(defpath))
Out[139]:
256
In [ ]:
#subprocess.call('scp {} s3://artctrl-staging'.format(daypost), shell=True)
In [ ]:
#os.system('scp /media/pi/UNTITED/artcontrolme/posts/' + nameofblogpost + '.* wcmckee@artctrl.me:/home/wcmckee/artcontrolme/posts/')
In [ ]:
#os.system('scp /media/pi/UNTITED/artcontrolme/galleries/' + fridpath + ' ' + nameofblogpost + '.* wcmckee@artctrl.me:/home/wcmckee/artcontrolme/posts/')

Comments

Comments powered by Disqus