import os
import simplejson
+import codecs
import logging
os.makedirs(self.path)
try:
- with open(self.books_path, "r") as settingsFile:
+ with codecs.open(self.books_path, "r", "utf-8") as settingsFile:
settings = simplejson.load(settingsFile)
except IOError, e:
_moduleLogger.info("No settings")
"selected": self.selected,
"books": self._books,
}
- with open(self.books_path, "w") as settingsFile:
+ with codecs.open(self.books_path, "w", "utf-8") as settingsFile:
simplejson.dump(settings, settingsFile)
def get_selected(self):
def select_book(self, bookName):
""" Sets the book as the currently playing, and adds it to the
database if it is not already there"""
- book_file = os.path.join(self.books_path, bookName)
if bookName not in self._books:
self._books[bookName] = {
"chapter": 0,