Exemplo n.º 1
0
def que(_path):
    try:
        q = Queue()
    except:
        q = queue.Queue()

    path = r"D:\Python\WorkSpace\PyBiu\test"
    for filename in os.listdir(_path):
        # print filename.decode('gbk')
        suffix = os.path.splitext(filename)[1]  # .decode('gbk')
        # print suffix
        if suffix[1:] in ["mp3", "aac", "flac", "ape", "wav", "tta", "tak", "alac"]:
            logging.info(filename.decode('gbk'))  #.decode('gbk')
            logging.info(_path + os.sep + filename.decode('gbk'))  # .decode('gbk')
            string = "\""+_path + os.sep + filename+"\""
            flag, token, title = post_biu(string)  #日文曲出错 .decode('gbk')
            if flag:
                q.put([token, title, string.decode('gbk')])
                # info = q.get()
                # # print "Queue is ----------->" + info[1]
                logging.info(filename.decode('gbk'))

    return q
Exemplo n.º 2
0
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hvf:d:", ["update"])
    except getopt.GetoptError:
        sys.exit()

    for argv, value in opts:
        if argv in "-f":
            file = value
            if not os.path.exists(file):
                file = os.path.split(os.path.realpath(__file__))[0] + file
                logging.info(file)
                if not os.path.exists(file):
                    logging.info("找不到文件.请尝试用双引号将文件绝对路径包括起来.")
                else:
                    logging.info("test")
                    flag, token, title = post_biu(file)
                    sys.exit() if not flag else confirm(
                        title, file, md5(file, "file"), token)
                    pass
            else:
                if file[0] != "\"":
                    file = "\"" + file + "\""
                flag, token, title = post_biu(file)
                if not flag == 1:
                    sys.exit()
                else:
                    confirm(title, file, md5(file, "file"), token)
                pass

        elif argv in "-d":  #上传文件夹
            path = value
Exemplo n.º 3
0
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hvf:d:", ["update"])
    except getopt.GetoptError:
        sys.exit()

    for argv, value in opts:
        if argv in "-f":
            file = value
            if not os.path.exists(file):
                file = os.path.split(os.path.realpath(__file__))[0] + file
                logging.info(file)
                if not os.path.exists(file):
                    logging.info("找不到文件.请尝试用双引号将文件绝对路径包括起来.")
                else:
                    logging.info("test")
                    flag, token, title = post_biu(file)
                    sys.exit() if not flag else confirm(title, file, md5(file, "file"), token)
                    pass
            else:
                if file[0] != '"':
                    file = '"' + file + '"'
                flag, token, title = post_biu(file)
                if not flag == 1:
                    sys.exit()
                else:
                    confirm(title, file, md5(file, "file"), token)
                pass

        elif argv in "-d":  # 上传文件夹
            path = value
            if os.path.isdir(path):