Beispiel #1
0
        "dur": 60,
        "station": "QRR"
    }
    p = Process(target=radiko.rec, args=([program, 0, AuthToken, SAVEROOT, dbx],))
    p.start()
    t = 0
    while(True):
        print(t)
        t += 10
        time.sleep(10)

if __name__ == "__main__":
    ROOT = (__file__.replace("/radiko_test.py", ""))
    if (ROOT == __file__):
        ROOT = ROOT.replace("radiko_test.py", ".")
    config = f.load_configurations(ROOT + "/conf/config.json")
    if (config is None):
        exit(code=-1)
    f.line_token = config["all"]["line_token"]
    SAVEROOT = config.get("all").get("savedir")
    if (os.path.isfile(SAVEROOT) is None) or (SAVEROOT == ""):
        SAVEROOT = ROOT + "/savefile"
    print("SAVEROOT : " + SAVEROOT)
    dbx = dropbox.Dropbox(config["all"]["dbx_token"])
    dbx.users_get_current_account()
    res = dbx.files_list_folder('')
    db_list = [d.name for d in res.entries]
    if not "radio" in db_list:
        dbx.files_create_folder("radio")
    ps = [
        Process(target=main_radiko)
Beispiel #2
0
def main_onsen_hibiki():
    Onsen = onsen.onsen(keywords, SAVEROOT)
    Hibiki = hibiki.hibiki(keywords, SAVEROOT)
    while(True):
        now = DT.datetime.now()
        if (now.hour == 7 and now.minute <= 5 and Onsen.reload_date != DT.date.today()):
            titles = Onsen.rec()
            titles.extend(Hibiki.rec())
            if (bool(titles)):
                f.recording_successful_toline("、".join(titles))
            else:
                print("in onsen, hibiki. there aren't new title.")
        time.sleep(300)

if __name__ == "__main__":
    config = f.load_configurations()
    if (config is None):
        exit(code=-1)
    f.line_token = config["all"]["line_token"]
    SAVEROOT = f.createSaveDirPath(config["all"]["savedir"])
    print("SAVEROOT : " + SAVEROOT)
    keywords = config["all"]["keywords"]
    ps = [
        Process(target=main_radiko),
        Process(target=main_agqr),
        Process(target=main_onsen_hibiki)
    ]
    for i in ps:
        i.start()
    while(True):
        time.sleep(1000)
Beispiel #3
0
                    # フォルダの作成
                    dir_path = self.SAVEROOT + "/" + title.replace(" ", "_")
                    f.createSaveDir(dir_path)
                    # ファイル重複チェック
                    file_name = title.replace(" ", "_") + "#" + count + ".mp3"
                    file_path = dir_path + "/" + file_name
                    if not file_name in os.listdir(dir_path):
                        print(prog["update"], prog["title"],
                              prog["personality"])
                        returnData.append(title)
                        res3 = requests.get(movie_url)
                        fs = open(file_path, "wb")
                        fs.write(res3.content)
                        fs.close()
                        dbx_path = "/radio/" + title
                        res = self.dbx.files_list_folder('/radio')
                        db_list = [d.name for d in res.entries]
                        if not title in db_list:
                            self.dbx.files_create_folder(dbx_path)
                        dbx_path += "/" + title + "#" + count + ".mp3"
                        self.dbx.files_upload(res3.content, dbx_path)
        return returnData


import dropbox
if __name__ == "__main__":
    config = f.load_configurations("./conf/config.json")
    dbx = dropbox.Dropbox(config["all"]["dbx_token"])
    Onsen = onsen(config["Onsen"]["keywords"], "./savefile", dbx)
    a = Onsen.rec()