Skip to content

Instantly share code, notes, and snippets.

@spotco
Created August 20, 2022 06:01
Show Gist options
  • Save spotco/8b2d61d4bb53959d360220aa609f612c to your computer and use it in GitHub Desktop.
Save spotco/8b2d61d4bb53959d360220aa609f612c to your computer and use it in GitHub Desktop.
convert_m3u9.py
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