~lsr.sid.team/lsr.sid/trunk

« back to all changes in this revision

Viewing changes to lsrsidmodules/helpers.py

  • Committer: daniel at xn--ngel-5qa
  • Date: 2010-10-21 12:26:28 UTC
  • Revision ID: daniel@xn--ngel-5qa.de-20101021122628-dzd6j2pe4uh3t7ch
first steps for selecting subsongs

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import gettext
22
22
import hashlib
23
23
import distutils
 
24
import logging
24
25
import tempfile
25
26
from distutils import dir_util
26
27
from xdg import BaseDirectory
27
28
 
 
29
if "vanilla" in sys.argv:
 
30
    tempdir = tempfile.mkdtemp()
 
31
 
28
32
def md5(file):
29
33
    hash = hashlib.md5()
30
34
    with open(file, "rb") as fh:
62
66
## @todo Return another dir on windows
63
67
def get_config_dir():
64
68
    if "vanilla" in sys.argv:
65
 
        return tempfile.mkdtemp()
 
69
        return tempdir
66
70
    d = os.path.join(BaseDirectory.xdg_config_home, "lsrsid")
67
71
    if not os.path.exists(d):
68
72
        dir_util.mkpath(d)
 
73
    logging.debug("Config dir: {0}".format(d))
69
74
    return d
70
75
 
71
76
## @todo Return another dir on windows
72
77
def get_data_dir():
73
78
    if "vanilla" in sys.argv:
74
 
        return tempfile.mkdtemp()
 
79
        return tempdir
75
80
    d = os.path.join(BaseDirectory.xdg_data_home, "lsrsid")
76
81
    if not os.path.exists(d):
77
82
        dir_util.mkpath(d)
 
83
    logging.debug("Config dir: {0}".format(d))
78
84
    return d
79
85
 
80
86
def check_dirs(*args):