diff --git a/gitmark.py b/gitmark.py index d65062aa..ef3fb2f7 100644 --- a/gitmark.py +++ b/gitmark.py @@ -67,7 +67,11 @@ def gitCommit(self, msg): subprocess.call(['git', 'commit', '-m', msg], shell=USE_SHELL) def gitPush(self): - pipe = subprocess.Popen("git push origin master", shell=True) + # pipe = subprocess.Popen("git push origin master", shell=True) + # I'm using a separate branch of gitmarks to store my data. + # The active "data" branch is defined in settings.py (defaults to "master") + command = "git push origin %s" % GIT_BRANCH + pipe = subprocess.Popen(command, shell=True) pipe.wait() def saveContent(self, filename, content): @@ -83,13 +87,14 @@ def saveContent(self, filename, content): def saveTagData(self, tag, url, title, content_filename): try: - tag_writer = csv.writer(open('%s%s' % (TAG_PATH, tag), 'a')) + f = open('%s%s.markdown' % (TAG_PATH, tag), 'a') except IOError: os.mkdir(TAG_PATH,0755) - tag_writer = csv.writer(open('%s%s' % (TAG_PATH, tag), 'a')) - - tag_writer.writerow([url, title, content_filename]) - return '%s%s' % (TAG_PATH, tag) + f = open('%s%s.markdown' % (TAG_PATH, tag), 'a') + + line = '[%s](%s), %s \n' % (title.decode('utf-8'), url, content_filename) + f.write(line.encode('utf-8')) + return '%s%s.markdown' % (TAG_PATH, tag) def parseTitle(self, content): re_htmltitle = re.compile(".*(.*).*") diff --git a/settings.py b/settings.py index 11df11f9..f6edf6bb 100644 --- a/settings.py +++ b/settings.py @@ -2,4 +2,6 @@ CONTENT_PATH = 'content/' -GITMARKS_WEB_PORT = 44865 \ No newline at end of file +GITMARKS_WEB_PORT = 44865 + +GIT_BRANCH = 'mydata'