31 lines
888 B
Python
31 lines
888 B
Python
import subprocess
|
|
import os
|
|
from pathlib import Path
|
|
from urllib.parse import unquote
|
|
|
|
if __name__ == "__main__":
|
|
cwd = Path.cwd()
|
|
|
|
success_paths = []
|
|
failed_paths = []
|
|
|
|
with open("./paths.txt", "r") as f:
|
|
for path in f:
|
|
path = unquote(path.strip())
|
|
output_path = os.path.join(str(cwd), "playlists/", os.path.basename(path))
|
|
res = subprocess.run(["adb", "pull", path.strip(), str(output_path)], capture_output=True)
|
|
if res.returncode != 0:
|
|
print(f"WARN: Failed to pull {path} into {str(output_path)}")
|
|
failed_paths.append(path)
|
|
else:
|
|
success_paths.append(path)
|
|
|
|
print("Finished pulling files.")
|
|
|
|
print("Success:", len(success_paths), "Failed:", len(failed_paths))
|
|
|
|
print("Failed copying following items:")
|
|
for p in failed_paths: print(p)
|
|
|
|
|