nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
18 changed files with 47 additions and 42 deletions
Showing only changes of commit 33945f865f - Show all commits

View file

@ -1,11 +1,12 @@
#!/usr/bin/env python3
import argparse
import coloredlogs
import logging
import os
import sys
import coloredlogs
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s")
log = logging.getLogger()
@ -155,7 +156,6 @@ def archive(docdir):
# If the directory doesn't exist, create the directories under it and move all the folder
else:
if args.dry:
print("mkdir -p", parentArcdir)
else:
@ -177,7 +177,6 @@ def unarchive(arcdir):
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Place a folder in ~/Documents in ~/Documents/Archives and symlink it"
)

View file

@ -1,18 +1,19 @@
#!/usr/bin/env python3
import datetime
import hashlib
import json
import logging
import os
import shutil
import statistics
import subprocess
import sys
import logging
import tempfile
import time
import coloredlogs
import progressbar
import time
import hashlib
import tempfile
import json
import statistics
import datetime
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s")
log = logging.getLogger()
@ -161,6 +162,7 @@ log.info(
)
)
# From https://stackoverflow.com/a/3431838
def sha256(fname):
hash_sha256 = hashlib.sha256()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
import random
import sys
for line in sys.stdin:
nl = ""

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
import random
import sys
for line in sys.stdin:
nl = ""

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import os
import sys
import subprocess
import logging
import os
import subprocess
import sys
import coloredlogs

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python3
import sys
import logging
import os
import shutil
import logging
import sys
import coloredlogs
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s")

View file

@ -1,14 +1,15 @@
#!/usr/bin/env python3
import os
import ovh
import xdg.BaseDirectory
import urllib.request
from pprint import pprint
import argparse
import json
import logging
import os
import urllib.request
from pprint import pprint
import coloredlogs
import argparse
import ovh
import xdg.BaseDirectory
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s")
log = logging.getLogger()

View file

@ -39,7 +39,7 @@ def main(args: argparse.Namespace) -> None:
log.warning("Processing files...")
for full_path in get_pictures(**kwargs):
# Find date
with open(full_path, 'rb') as fd:
with open(full_path, "rb") as fd:
exif_data = exifread.process_file(fd)
if not exif_data:
log.warning(f"{full_path} does not have EXIF data")
@ -54,8 +54,8 @@ def main(args: argparse.Namespace) -> None:
# Determine new filename
ext = os.path.splitext(full_path)[1].lower()
if ext == '.jpeg':
ext = '.jpg'
if ext == ".jpeg":
ext = ".jpg"
new_name = date.isoformat().replace(":", "-").replace("T", "_") + args.suffix
# First substitution is to allow images being sent to a NTFS filesystem
# Second substitution is for esthetics

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import sys
import pulsectl
from Xlib import X, XK, display
import pulsectl
from Xlib import XK, X, display
from Xlib.ext import record
from Xlib.protocol import rq

View file

@ -3,14 +3,15 @@
# Handles sync-conflict files
import argparse
import logging
import os
import pickle
import re
import sys
import zlib
import coloredlogs
import progressbar
import logging
progressbar.streams.wrap_stderr()
coloredlogs.install(level="INFO", fmt="%(levelname)s %(message)s")
@ -425,7 +426,6 @@ class DatabaseFile:
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Handle Syncthing's .sync-conflict files "
)

View file

@ -9,21 +9,21 @@ with the unread items (non-video links are ignored).
"""
import datetime
import filelock
import functools
import logging
import os
import pickle
import random
import requests
import re
import subprocess
import sys
import time
import typing
import sys
import coloredlogs
import configargparse
import filelock
import requests
import yt_dlp
log = logging.getLogger(__name__)

View file

@ -1,8 +1,6 @@
#!/usr/bin/env python3
import base64
import colorama
import configargparse
import datetime
import email.utils
import io
@ -10,6 +8,8 @@ import pprint
import subprocess
import sys
import colorama
import configargparse
if __name__ == "__main__":
parser = configargparse.ArgParser(

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
import random
import sys
# maj = True

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python3
import sys
import os
import sys
import piexif
assert len(sys.argv) >= 3, "Usage {} CREATOR FILENAMES...".format(sys.argv[0])

View file

@ -1,12 +1,13 @@
#!/usr/bin/env python3
import logging
import os
import subprocess
import sys
import logging
import magic
import typing
import coloredlogs
import magic
# TODO Able to ignore extensions everywhere

View file

@ -3,9 +3,9 @@
import logging
import os
import re
import subprocess
import typing
import re
import coloredlogs
import progressbar

View file

@ -4,8 +4,8 @@
# FFMPEG's reasonable default settings
import os
import sys
import subprocess
import sys
files = sys.argv[1:]

View file

@ -8,8 +8,8 @@
# Example: videoQuota 20971520 source.mov dest.mp4
# To make a ~20 MiB MP4 of a MOV video
import sys
import subprocess
import sys
def duration_file(path: str) -> float: