• 大小: 90.85MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-19
  • 语言: 其他
  • 标签: Kindle  

资源简介

Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。Kindle刷机工具。

资源截图

代码片段和文件信息

#!/usr/bin/python
#coding=utf-8
‘‘‘
# 20120531
#=============================================================================
#     FileName:         pop_imap_recv_mail.py
#     Desc:                 Fetch mail by POP and IMAP
#     Author:           forrest
#     Email:            hongsun924@gmail.com
#     HomePage:         NULL
#     Version:          0.0.1
#     LastChange:       2011-08-09 17:51:49
#     History:          
#=============================================================================
‘‘‘

import os sys re string getpass email poplib imaplib
import logging traceback


# 如果get_charsets()查找不到编码信息 则采用下面方式:
def check_code(msg):
    #print “check_code(msg) start:“
    for code in (‘gb2312‘ ‘gb18030‘ ‘gbk‘ ‘big5‘ ‘utf-8‘ ‘utf16‘ ‘utf32‘ ‘jp‘ ‘euc_kr‘):
        try:
            #print “code = “ code
            return unicode(msg code ‘ignore‘ )
        except:
            pass
    return msg

# 检查编码信息
def check_sub(sub code msg):
    #print “check_sub(msg) start :“
    if code != None:
        logging.info(“code: %s“ % code)
        f = open(‘/tmp/filename.txt‘ ‘wb‘)
        f.write(sub)
        f.close()
        cmd= ‘LD_LIBRARY_PATH=/DuoKan/lib /mnt/us/DK_System/xKindle/python/bin/iconv  -f ‘+ code +‘ -t UTF-8 /tmp/filename.txt  >  /tmp/filename2.txt ‘
        os.system(cmd)
        f = open(‘/tmp/filename2.txt‘ ‘r‘)        
        filename = f.read()
        f.close()
        subject = filename
        logging.info(“return in check_sub #1“)
        return subject
    elif msg.get_charsets()[0] !=None:
        subject = unicode(sub msg.get_charsets()[0] ‘ignore‘)
        logging.info(“code: %s“ % msg.get_charsets()[0])
        logging.info(“return in check_sub #2“)
        return subject


# 解析邮件头以及附件名称
def mail_parser(msg obj):
    logging.info(“mail_parser(msg) start:“)
    obj = ‘ ‘.join(obj.split())
    logging.info(“obj: %s“ % obj)
    obj = obj.replace(“?=“ “?= “)
    reobj = re.compile(r‘q\?= ‘ re.I)
    obj = reobj.sub(r‘Q?=‘ obj)
    try:
        decode_obj = email.Header.decode_header(obj)
        obj_list = []
        for decode_obj_item in decode_obj:
            #obj_sub obj_code = decode_obj_item
            obj_sub obj_code = decode_obj_item
            test_obj = check_sub(obj_sub obj_code msg)
            obj_list.append(test_obj)

        logging.info(“return in mail_parser #1“)
        return ‘‘.join(obj_list)
    except:
        exc_type exc_value exc_traceback = sys.exc_info()
        #print dir(exc_traceback)
        logging.info(“%s“ % traceback.format_exc(exc_traceback))
        logging.info(“return in mail_parser #2“)
        return obj


# 解析text/plain信息 如果 part.get_charsets()不能获取编码信息 则使用check_content_code来检测编码
def text_plain_msg(part):
    text_plain = part.get_payload(decode=True)
    charset = part.get_charsets()[0]
    if charset == “x-gbk“:
        charset = “gbk“

    if len(text_plain):
        if charset != None:
            try:
                return unico

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\4bit\
     文件      240000  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\4bit\dk2system.bin
     文件      240002  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\4bit\dkswitch.bin
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\8bit\
     文件      480000  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\8bit\dk2system.bin
     文件      480000  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\8bit\dkswitch.bin
     文件       11492  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\rundk.sh
     文件        2042  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\UnInstall.sh
     文件        2518  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\update.sh
     文件       70067  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\bin\WaiteAKey
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\
     文件       15793  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\DK_run
     文件        6659  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\DK_switch
     文件        2701  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\DK_update
     文件       25998  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\DuoKanInstall.sh
     文件        1650  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\DuoKanUninstall.sh
     文件          52  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\liteinstall.sh
     文件        1021  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\screensaver_md5.txt
     文件         125  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\install\UninstallLite.sh
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\
     文件        8967  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\alsa.conf
     目录           0  2014-09-11 14:37  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\
     文件         669  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\AACI.conf
     文件         687  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\aliases.alisp
     文件        1322  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\aliases.conf
     文件         302  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\ATIIXP-MODEM.conf
     文件        2207  2014-09-11 11:21  K3(xKindle_2014-09-11.36203.rtm)\DK_System\xKindle\alsa\cards\ATIIXP-SPDMA.conf
............此处省略1232个文件信息

评论

共有 条评论