Browse Source

windows: fix cache mechanism

remotes/origin/HEAD
Romain Goffe 12 years ago
parent
commit
388c19ede6
  1. 6
      songbook.py
  2. 2
      windows/clean.bat

6
songbook.py

@ -10,6 +10,7 @@ import json
import locale
import shutil
import locale
import platform
reTitle = re.compile('(?<=beginsong\\{)(.(?<!\\}]))+')
reArtist = re.compile('(?<=by=)(.(?<![,\\]\\}]))+')
@ -24,8 +25,11 @@ class Song:
def __repr__(self):
return repr((self.title, self.artist, self.album, self.path))
if platform.system() == "Linux":
from xdg.BaseDirectory import *
cachePath = os.path.join(xdg_cache_home, 'songbook')
else:
cachePath = os.path.join('cache', 'songbook')
def makeCoverCache(library):
'''
@ -157,7 +161,7 @@ def makeTexFile(sb, library, output):
for index, line in enumerate(content):
if re.compile("getCacheDirectory").search(line):
line = line.replace("\\getCacheDirectory", cachePath + "/")
line = line.replace("\\getCacheDirectory", cachePath.replace("\\","/") + "/")
content[index] = line
if re.compile("getLibraryImgDirectory").search(line):
line = line.replace("\\getLibraryImgDirectory", library + "img/")

2
windows/clean.bat

@ -1,4 +1,4 @@
Rem manually performs "make clean"
FOR %%A IN (*.aux *.d *.toc *.out *.log *.nav *.snm *.sbx *.sxd) DO DEL %%A
Rem remove temporary covers
FOR %%A IN (covers\*.*) DO DEL %%A
FOR %%A IN (cache\songbook\*.jpg) DO DEL %%A

Loading…
Cancel
Save