Skip to content

Instantly share code, notes, and snippets.

@spotco
Created June 7, 2020 04:04
Show Gist options
  • Save spotco/74beac8028a11c59db526a81496888b8 to your computer and use it in GitHub Desktop.
Save spotco/74beac8028a11c59db526a81496888b8 to your computer and use it in GitHub Desktop.
playlist m3u8 copy
import os
import io
import subprocess
from os import path
list = io.open("betty.m3u8", mode="r", encoding="utf-8").read().split("\n")
for itr in list:
if len(itr) == 0:
continue
source_path = itr.replace("/storage/3734-3234/","/Volumes/NO NAME/")
dest_path = itr.replace("/storage/3734-3234/Music/","")
dest_dir = os.path.dirname(dest_path)
if len(dest_dir) > 0:
try:
os.makedirs(dest_dir)
except OSError:
pass
command = "cp \"" + source_path + "\" \"" + dest_path +"\""
command = command.encode('utf-8')
print(command)
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment