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

2
windows/clean.bat

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

Loading…
Cancel
Save