# -*- coding: utf-8 -*-
# YOU NEED TO COPY THIS FILE TO config.py so that the program uses those values here
from __future__ import print_function
import os


config = {}

def updateConfig(newConfig):
    global config
    for k in newConfig:
        config[k] = newConfig[k]

def loadConfig():
    # caches are only used temporarily - if a download fails, sometimes it can help to delete
    # all cachedata - the only negative point in deleting all cachedata is, that the program may be a bit slower on next start
    cache_dir = 'cache'             # here we write normal html-downloads
    cache_dir_for_flv = 'cache2'    # here we write flashdownloads

    flash_dir = 'flash' # all finished flashdownloads go in this directory and will be deleted from the cachedir


    dl_instances = 6  # how many parallel downloads you will start

    # VALUES below this aren't interesting for you

    # dl_* can be changed through config and use those values then as default
    dl_title = 'tmp'
    dl_name = 'tmp'

    link = None # you can set a default url as starturl.. but commandline-option will overwrite this var

    dir_list = {'cache_dir': cache_dir, 'flash_dir':flash_dir}
    error = 0
    for i in dir_list:
        path = dir_list[i]
        if os.path.isdir(path) is False:
            os.makedirs(path)
        if not os.access(path, os.W_OK):
            print(i + 'needs a writeable path, but your %s isn\'t writeable please edit config.py' % path)
            error = 1
    if error == 1:
        import sys
        sys.exit(1)

    extractStart = 0 # how many media files should be skipped when using extract all
    extractAmount = 999999 # how many media files should be extracted when using extract all

    cachePort = 0 #9123
    preferHypertable=False
    preferFileCache = False

    config = {
        'cache_dir': cache_dir,
        'cache_dir_for_flv': cache_dir_for_flv,
        'flash_dir': flash_dir,
        'dl_instances': dl_instances,
        'dl_title': dl_title,
        'dl_name': dl_name,
        'link': link,
        'extractStart': extractStart,
        'extractAmount': extractAmount,
        'cachePort': cachePort,
        'preferHypertable': preferHypertable,
        'preferFileCache': preferFileCache,
            }
    updateConfig(config)
    return config

@@ -270,16 +270,17 @@
 fig%5Bk%5D%0A%0A
+%0A
 def load
@@ -1117,435 +1117,8 @@
 ar%0A%0A
-    dir_list = %7B'cache_dir': cache_dir, 'flash_dir':flash_dir%7D%0A    error = 0%0A    for i in dir_list:%0A        path = dir_list%5Bi%5D%0A        if os.path.isdir(path) is False:%0A            os.makedirs(path)%0A        if not os.access(path, os.W_OK):%0A            print(i + 'needs a writeable path, but your %25s isn%5C't writeable please edit config.py' %25 path)%0A            error = 1%0A    if error == 1:%0A        import sys%0A        sys.exit(1)%0A%0A
     

simplify config.py