merged with commit from RAAM
This commit is contained in:
commit
91e0b5dc66
2 changed files with 9 additions and 2 deletions
|
@ -1,9 +1,14 @@
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
import sys
|
||||||
|
|
||||||
|
homedir = os.getenv("HOME")
|
||||||
|
if homedir is None:
|
||||||
|
homedir = os.path.dirname(sys.argv[0])
|
||||||
|
|
||||||
class _Configuration(object):
|
class _Configuration(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.filename = os.path.join(os.path.join(os.getenv("HOME"), ".4grab"), "config.cfg")
|
self.filename = os.path.join(os.path.join(homedir, ".4grab"), "config.cfg")
|
||||||
self.configparser = ConfigParser.RawConfigParser()
|
self.configparser = ConfigParser.RawConfigParser()
|
||||||
if not os.path.exists(self.filename):
|
if not os.path.exists(self.filename):
|
||||||
self.create_new()
|
self.create_new()
|
||||||
|
@ -15,7 +20,7 @@ class _Configuration(object):
|
||||||
self.set_category(self.raw_input_with_default("w", "Please enter which category you would like to download from: "))
|
self.set_category(self.raw_input_with_default("w", "Please enter which category you would like to download from: "))
|
||||||
|
|
||||||
self.configparser.add_section("locations")
|
self.configparser.add_section("locations")
|
||||||
self.configparser.set("locations", "download", self.raw_input_with_default(os.path.join(os.getenv("HOME"), "Pictures"), "Please enter where you would like the downloads to go: "))
|
self.configparser.set("locations", "download", self.raw_input_with_default(os.path.join(homedir, "Pictures"), "Please enter where you would like the downloads to go: "))
|
||||||
|
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import progressbar
|
||||||
import config
|
import config
|
||||||
|
|
||||||
savedir = config.Configuration().get_download_location()
|
savedir = config.Configuration().get_download_location()
|
||||||
|
if not os.path.exists(savedir):
|
||||||
|
os.makedirs(savedir)
|
||||||
|
|
||||||
def get_thread_links(baseurl):
|
def get_thread_links(baseurl):
|
||||||
myparser = htmlparser.MyParser()
|
myparser = htmlparser.MyParser()
|
||||||
|
|
Loading…
Reference in a new issue