Skip to content

Commit

Permalink
initial comment
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianZ committed Jul 3, 2012
1 parent fe9dbe2 commit 4c474cc
Show file tree
Hide file tree
Showing 36 changed files with 2,913 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.py[co]
.DS_Store

# Packages
*.egg
Expand Down
24 changes: 23 additions & 1 deletion README.md
@@ -1,2 +1,24 @@
MartianZ-BLOG
=============
=============

MartianZ - BLOG 是 MartianZ 同学在折腾过程中学习Python的产物,是一款轻量级的博客系统。演示:<http://blog.4321.la>

依赖:

python 2.6 +

easy_install tornado
easy_install markdown

使用:

1. 将Markdown放在posts文件夹下,保证每个Markdown文件的开头有下面的标志区域

---
title: "[320kbps MusicDownloader]高清音乐下载助手 1.4"
date: 2010-12-05 22:16
---
2. python blog.py 即可,默认端口8888

详情请查看程序源代码即可

95 changes: 95 additions & 0 deletions blog.py
@@ -0,0 +1,95 @@
import tornado.ioloop
import tornado.web
import string, os, sys
import markdown
import codecs

site_config = {
"title" : "MartianZ!",
"url" : """http://blog.4321.la""",
"post_dir": os.getcwd() + os.sep + 'posts',
}

settings = {
"static_path": os.path.join(os.path.dirname(__file__), "static")
}

def SingleFileHandler(file_path):
f = codecs.open(file_path, mode='r', encoding='utf8')
lines = []
try:
lines = f.readlines()
except:
pass
f.close()

ret = {}
title = ''
date = ''
index = 1

for line in lines[1:]:
index += 1
if line.find('title: ') == 0:
title = line.replace('title: "','')[0:-2]
if line.find('date: ') == 0:
date = line.replace('date: ','')[0:-1]
if line.find('---') == 0:
break

content = u'';
for line in lines[index:]:
content += line

if title:
ret['title'] = title
ret['date'] = date
ret['content'] = markdown.markdown(content)
ret['name'] = file_path.split(os.sep)[-1].split('.')[0]
return ret

class MainHandler(tornado.web.RequestHandler):
def get(self):
articles = []
post_dir = site_config["post_dir"]
file_list = []
files = os.listdir(post_dir)

p = int(self.get_argument('p','0'))

This comment has been minimized.

Copy link
@GreenFaith

GreenFaith May 26, 2013

一直搞不懂这个p是哪里来的- -求解释


for f in files:
file_list.append(post_dir + os.sep + f)
file_list.sort(reverse=True)
for single_file in file_list[p:p+3]:
article = SingleFileHandler(single_file)
if article: articles.append(article)

if p > 2:
prev = True
else:
prev = False

if p + 4 < len(file_list):
pnext = True
else:
pnext = False


self.render("template/index.html", title=site_config['title'], url=site_config["url"], articles = articles, prev=prev, pnext=pnext, prevnum=p-3, nextnum=p+3)

class ArticleHandler(tornado.web.RequestHandler):
def get(self, article_id):
post_path = site_config["post_dir"] + os.sep + article_id.replace('.','') + '.markdown'
article = SingleFileHandler(post_path)

self.render("template/article.html", title=site_config['title'], url=site_config["url"], article = article)

application = tornado.web.Application([
(r"/", MainHandler),
(r"/article/(.*)", ArticleHandler),
], **settings)

if __name__ == "__main__":
application.listen(8888)
print "MartianZ Burogu Sutato!"
tornado.ioloop.IOLoop.instance().start()
50 changes: 50 additions & 0 deletions posts/2010-12-05-musicdownloader.markdown
@@ -0,0 +1,50 @@
---
layout: post
title: "[320kbps MusicDownloader]高清音乐下载助手 1.4"
date: 2010-12-05 22:16
comments: true
categories: ideas
---
![MusicDownloader](http://i.imgur.com/bDcY0.png)

软件名称:[320kbps MusicDownloader]高清音乐下载助手

软件版本:1.4

最后更新:2010年12月5日

####**MusicDownloader已经被MusicSeeker所替代,目前MusicDownloader已经停止开发,请下载更加完善的MusicSeeker!**

<!-- more -->
版本更新内容:

1、修正搜索算法,完美运行

2、添加试听功能,打开下载目录功能

软件说明:

1、程序采用众所周知的接口开发,下载高清320kbpsMP3音乐。

2、采用豆瓣音乐API,自动获取专辑图片并保存在音乐的ID3标签中。

截图与功能一览:

![MusicDownloader](http://i.imgur.com/h8AYa.png)

由于搜索算法问题,无法搜索除中文、英文之外的关键字。所以如果您搜索其他语言(如日文),可以尝试输入歌名中的中文字符而忽略假名等,同时输入歌手来精确定位,或者仅输入歌手。(如上图所示)

![MusicDownloader](http://i.imgur.com/6iC8l.png)

![MusicDownloader](http://i.imgur.com/ohftM.png)


**下载地址:(支持迅雷等下载工具)**

<http://down.4321.la/320kbps-MusicDownloader-1.4.rar>

MusicDownloader已经被MusicSeeker所替代,目前MusicDownloader已经停止开发,请下载更加完善的MusicSeeker!

软件基于.Net FrameWork3.5平台,如果您的系统是Windows7/Vista,则已经自带,如果是XP,您可以先下载软件试一下,如果不能运行,请到http://www.crsky.com/soft/21819.html下载.Net FrameWork3.5后安装!

如果您觉得软件不错的话,希望您能推荐给您的朋友,这对我们来说是最大的支持!
55 changes: 55 additions & 0 deletions posts/2011-01-03-lrc-is-a-must.markdown
@@ -0,0 +1,55 @@
---
layout: post
title: "LRC IS A MUST! —— LRC歌词下载器"
date: 2011-01-03 22:23
comments: true
categories: ideas
---
![LRC](http://i.imgur.com/dP4p5.png)

软件名称:Lrc is a must!
软件版本:1.0
最后更新:2011年1月3日10:58:56

**优点:相对于其它同类软件,方便易用不敢说,但是歌词库相当全!**

<!-- more -->

最近从某知名听歌软件换到了华丽的AirPlay……但是AirPlay的LRC歌词下载部分非常的不给力。

所以就分析了之前那个软件的LRC下载算法,然后开发了这款软件。

使用方法:

第一步:下载并启动软件
第二步:找到需要下载的歌曲所在目录,然后把歌曲选中,支持多选,拖拽到软件界面中。
(仅支持MP3格式)
![LRC](http://i.imgur.com/nHnab.png)

软件的三个区域分别是:

① 你拖拽进来的歌曲列表
② 双击一个歌曲,出来的搜索结果
③ 双击一个搜索结果,出来的歌词

拖拽进去歌曲后,软件会自动读取ID3标签,如果没有问题的话,双击歌曲就可以搜索

如果读取失败的话,可以在下面的Search区域进行相关修改后单击[Click]按钮

![LRC](http://i.imgur.com/zxhW0.png)

找到中意的歌词后,就可以单击SaveToFile按钮,LRC歌词将自动保存到与歌曲同文件夹的位置,并且与歌曲文件同文件名。效果如下:

![LRC](http://i.imgur.com/dtSjW.png)

**下载地址:**

<http://down.4321.la/LRC-Downloader.rar>

软件采用Delphi XE开发,所以不用装什么.net库了,软件制作的时候比较仓促,因为我还有其他的项目,所以界面比较搓,希望大家谅解。

有任何意见建议请在下面提出,您的支持是我们最大的鼓励

免责声明:
所有的代码、程序仅供研究学习用,没有任何盈利目的,请各位用户下载后及时删除。
开发者对软件的使用产生的任何法律问题及连带责任概不负责。

0 comments on commit 4c474cc

Please sign in to comment.