Created
August 20, 2022 06:01
-
-
Save spotco/8b2d61d4bb53959d360220aa609f612c to your computer and use it in GitHub Desktop.
convert_m3u9.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import re | |
#OLD: | |
#/storage/3161-6236/ | |
#NEW: | |
#/storage/3935-3838/ | |
in_folder = sys.argv[1] | |
out_folder = sys.argv[2] | |
for filename in os.listdir(in_folder): | |
in_filepath = os.path.join(in_folder, filename) | |
in_fh = open(in_filepath,'r') | |
out_str = "" | |
for line in in_fh.read().split("\n"): | |
if len(line) == 0: | |
continue | |
split = line.split("Music/") | |
if len(split) == 1: | |
raise "fail" | |
out_str += "/storage/3935-3838/Music/" + split[1] + "\n" | |
out_filepath = os.path.join(out_folder, filename) | |
print(out_filepath) | |
out_fh = open(out_filepath,"w") | |
out_fh.write(out_str) | |
out_fh.close() | |
in_fh.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment