Skip to content

Commit

Permalink
Merge pull request #3 from sun-yryr/fix/#2_path_delete_space
Browse files Browse the repository at this point in the history
パスの変更
  • Loading branch information
sun-yryr authored Jul 13, 2019
2 parents b466e3b + d2a8be5 commit 55ee2aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/agqr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def rec(data):
program_ft = data[2]
SAVEROOT = data[3]
dbx = data[4]
dir_path = SAVEROOT + "/" + program_data["title"]
dir_path = SAVEROOT + "/" + program_data["title"].replace(" ", "_")
f.createSaveDir(dir_path)
dbx_path = "/radio/" + program_data["title"]
res = dbx.files_list_folder('/radio')
Expand All @@ -19,7 +19,7 @@ def rec(data):
dbx.files_create_folder(dbx_path)
dbx_path += "/" +program_data["title"] + "_" + program_ft[:12]+ ".m4a"

file_path = dir_path + "/" + program_data["title"] + "_" + program_ft[:12]
file_path = dir_path + "/" + program_data["title"].replace(" ", "_") + "_" + program_ft[:12]
cwd = ('rtmpdump --rtmp "rtmpe://fms1.uniqueradio.jp/" ')
cwd += ('-a ?rtmp://fms-base1.mitene.ad.jp/agqr/ ')
cwd += ('-f "WIN 16,0,0,257" ')
Expand Down
8 changes: 3 additions & 5 deletions lib/hibiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ def rec(self):
if (self.keyword.search(title) or self.keyword.search(personality)):
title = title.replace(" ", "_")
# フォルダの作成
dir_path = self.SAVEROOT + "/" + title
dir_path = self.SAVEROOT + "/" + title.replace(" ", "_")
f.createSaveDir(dir_path)
# ファイル重複チェック
update_date = DT.datetime.strptime(episode["updated_at"].split(" ")[0], "%Y/%m/%d")
file_name = title + "_" + update_date.strftime("%Y%m%d") + ".m4a"
file_name = title.replace(" ", "_") + "_" + update_date.strftime("%Y%m%d") + ".m4a"
file_path = dir_path +"/"+ file_name
file_path = file_path.replace(" ", "_")
if file_name in os.listdir(dir_path):
continue
url2 = "https://vcms-api.hibiki-radio.jp/api/v1/programs/" + program.get("access_id")
Expand All @@ -58,7 +57,6 @@ def rec(self):
video_url = api_base + "videos/play_check?video_id=" + str(tmpjson["episode"]["video"]["id"])
res2 = requests.get(video_url, headers=headers)
tmpjson = json.loads(res2.text)
print(tmpjson)
print(title)
if (tmpjson.get("playlist_url") is None):
continue
Expand All @@ -70,7 +68,7 @@ def rec(self):
db_list = [d.name for d in res.entries]
if not title in db_list:
self.dbx.files_create_folder(dbx_path)
dbx_path += "/" + file_name
dbx_path += "/" + title + "_" + update_date.strftime("%Y%m%d") + ".m4a"
fs = open(file_path, "rb")
self.dbx.files_upload(fs.read(), dbx_path)
fs.close()
Expand Down
5 changes: 2 additions & 3 deletions lib/onsen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ def rec(self):
movie_url = prog["moviePath"]["pc"]
if (movie_url == ""):
continue
title = title.replace(" ", "_")
# フォルダの作成
dir_path = self.SAVEROOT + "/" + title
dir_path = self.SAVEROOT + "/" + title.replace(" ", "_")
f.createSaveDir(dir_path)
# ファイル重複チェック
file_name = title +"#"+ count + ".mp3"
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"])
Expand Down
3 changes: 2 additions & 1 deletion lib/radiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def rec(data):
SAVEROOT = data[3]
dbx = data[4]
#ディレクトリの作成
dir_path = SAVEROOT + "/" + program_data["title"]
dir_path = SAVEROOT + "/" + program_data["title"].replace(" ", "_")
f.createSaveDir(dir_path)
dbx_path = "/radio/" + program_data["title"]
res = dbx.files_list_folder('/radio')
Expand All @@ -125,6 +125,7 @@ def rec(data):
dbx.files_create_folder(dbx_path)
#保存先パスの作成
file_path = dir_path + "/" + program_data["title"]+"_"+program_data["ft"][:12]
file_path = file_path.replace(" ", "_")
dbx_path += "/" +program_data["title"]+"_"+program_data["ft"][:12]+ ".m4a"
#print(program_data["title"])
#stream urlの取得
Expand Down

0 comments on commit 55ee2aa

Please sign in to comment.