-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from barrucadu/restic
Switch from duplicity to restic for backups
- Loading branch information
Showing
22 changed files
with
510 additions
and
535 deletions.
There are no files selected for viewing
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Youtube "backup" script - generates a script to download videos. | ||
""" | ||
|
||
import os | ||
import shlex | ||
|
||
SOURCE_DIR = "/mnt/nas/misc/youtube" | ||
VIDEO_URL = "https://www.youtube.com/watch?v=" | ||
|
||
print("#!/bin/sh") | ||
print("") | ||
|
||
for dirpath, dirnames, filenames in os.walk(SOURCE_DIR, topdown=True): | ||
for dirname in dirnames: | ||
print(f"mkdir {shlex.quote(os.path.join(dirpath, dirname))}") | ||
for filename in filenames: | ||
# filenames are of the form "title [id].ext" | ||
name_pattern = filename.split("[")[-2] + "[%(id)s].%(ext)s" | ||
url = VIDEO_URL + filename.split("[")[-1].split("]")[0] | ||
print( | ||
f"yt-dlp -P {shlex.quote(dirpath)} -o {shlex.quote(name_pattern)} {shlex.quote(url)}", | ||
) |
Oops, something went wrong.