configdraw

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 [56]:
import os
import configparser
In [57]:
config = configparser.RawConfigParser()
In [58]:
config.read('/home/wcmckee/gotdrawn/config.cfg')
Out[58]:
['/home/wcmckee/gotdrawn/config.cfg']
In [59]:
config.add_section('subredinfo')
---------------------------------------------------------------------------
DuplicateSectionError                     Traceback (most recent call last)
<ipython-input-59-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 [60]:
whatsub = raw_input('What subreddit: ')
What subreddit: redditgetsdrawn
In [61]:
inputfol = raw_input('Dir where to save (/home/username/ + : ')
Dir where to save (/home/username/ + : testingdir
In [62]:
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 [63]:
outfilq = ''
outfilez = ''
In [64]:
if 'y' in outfilda:
    outfilq = True
else:
    print ('Not outputing folder')
    outfilq = False
    
if 'y' in outfilez:
    outfilez = True
else:
    outfilez = False
In [64]:
 
In [65]:
config.set('subredinfo', 'subbreddit', whatsub)
config.set('subredinfo', 'dirpath', inputfol)
config.set('subredinfo', 'outputfolder', outfilq)
config.set('subredinfo', 'outputfile', outfilez)
In [66]:
with open('/home/wcmckee/gotdrawn/config.cfg', 'wb') as configfile:
    config.write(configfile)
In [ ]:
 

Comments

Comments powered by Disqus