Config Draw

Configuration file Getsdrawn

Script to create and edit the getsdrawndotcom config file.

Things this config file does:

Change the folder where the files saved.

Change folder date system (/home/wcmckee/blah/2015/02/20/username.png) or file date system (/home/wcmckee/blah/username-2015-02-20.png)

Specify which subreddit (or multi) to download from

ANYMORE CONFIGS NEEDED?

Config max/min size of files downloaded?

Config how often to run the script.

Configfig where logo is, use multi logos (switch hour etc)

Config css. Background color etc.

Need to write another script that will open up this config file and use it to run gotdrawn script.


In [39]:
import os
import configparser

In [40]:
config = configparser.RawConfigParser()

In [41]:
config.read('/home/wcmckee/gotdrawn/config.cfg')


Out[41]:
['/home/wcmckee/gotdrawn/config.cfg']

In [42]:
config.add_section('subredinfo')


---------------------------------------------------------------------------
DuplicateSectionError                     Traceback (most recent call last)
<ipython-input-42-b2645fc4635c> in <module>()
----> 1 config.add_section('subredinfo')

/usr/lib/python2.7/dist-packages/configparser.pyc in add_section(self, section)
    669 
    670         if section in self._sections:
--> 671             raise DuplicateSectionError(section)
    672         self._sections[section] = self._dict()
    673         self._proxies[section] = SectionProxy(self, section)

DuplicateSectionError: Section 'subredinfo' already exists

In [ ]:
whatsub = raw_input('What subreddit: ')

In [31]:
inputfol = raw_input('Dir where to save: ')


Dir where to save: /home/wcmckee/getsdrawndotcom

In [32]:
outfilda = raw_input('Output folder date y/n: ')

outfilez = raw_input('Output file date y/n: ')


Output folder date y/n: y
Output file date y/n: y

In [33]:
outfilq = ''
outfilez = ''

In [34]:
if 'y' in outfilda:
    outfilq = True
else:
    print ('Not outputing folder')
    outfilq = False
    
if 'y' in outfilez:
    outfilez = True
else:
    outfilez = False

In [36]:


In [37]:
config.set('subredinfo', 'subbreddit', whatsub)
config.set('subredinfo', 'dirpath', inputfol)
config.set('subredinfo', 'outputfolder', outfilq)
config.set('subredinfo', 'outputfile', outfilez)

In [38]:
with open('/home/wcmckee/gotdrawn/config.cfg', 'wb') as configfile:
    config.write(configfile)

In [ ]: