Created
June 7, 2020 04:04
-
-
Save spotco/74beac8028a11c59db526a81496888b8 to your computer and use it in GitHub Desktop.
playlist m3u8 copy
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 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