Compare commits
7 commits
95faa0c0ff
...
0d86e537d1
Author | SHA1 | Date | |
---|---|---|---|
Geoffrey Frogeye | 0d86e537d1 | ||
Geoffrey Frogeye | eddb48e461 | ||
Geoffrey Frogeye | 9fac2c3701 | ||
Geoffrey Frogeye | d5e9cc2273 | ||
Geoffrey Frogeye | 4030606ec8 | ||
Geoffrey Frogeye | 060e9db995 | ||
Geoffrey Frogeye | ceaa2d1671 |
|
@ -1,5 +1,5 @@
|
||||||
Section "Device"
|
Section "Device"
|
||||||
Identifier "intel"
|
Identifier "Intel Graphics"
|
||||||
Driver "intel"
|
Driver "intel"
|
||||||
Option "Backlight" "intel_backlight"
|
Option "Backlight" "intel_backlight"
|
||||||
EndSection
|
EndSection
|
||||||
|
|
|
@ -39,3 +39,8 @@
|
||||||
debug:
|
debug:
|
||||||
msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied."
|
msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied."
|
||||||
listen: panfrost config changed
|
listen: panfrost config changed
|
||||||
|
|
||||||
|
- name: Reload systemd-logind
|
||||||
|
command: systemctl kill -s HUP systemd-logind
|
||||||
|
become: yes
|
||||||
|
listen: systemd-logind config changed
|
||||||
|
|
|
@ -356,6 +356,19 @@
|
||||||
- etc changed
|
- etc changed
|
||||||
- systemd changed
|
- systemd changed
|
||||||
|
|
||||||
|
- name: Disable power button
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/systemd/logind.conf
|
||||||
|
line: 'HandlePowerKey=ignore'
|
||||||
|
regexp: '^#? *HandlePowerKey='
|
||||||
|
insertafter: '^\[Login\]$'
|
||||||
|
become: yes
|
||||||
|
notify: systemd-logind config changed
|
||||||
|
# Reason: I sometimes press it accidentally
|
||||||
|
# (hoping to start it when it's already started,
|
||||||
|
# or really accidentally on the Pinebook).
|
||||||
|
# Suspend would be nice, but it doesn't have the locker then
|
||||||
|
|
||||||
# TODO Hibernation, if that's relevant
|
# TODO Hibernation, if that's relevant
|
||||||
# $ sudo blkid | grep 'TYPE="swap"'
|
# $ sudo blkid | grep 'TYPE="swap"'
|
||||||
# $ sudoedit /etc/default/grub
|
# $ sudoedit /etc/default/grub
|
||||||
|
|
|
@ -19,7 +19,7 @@ chmod 700 "$BASEDIR"
|
||||||
name_base64="$(echo "$name" | base64)"
|
name_base64="$(echo "$name" | base64)"
|
||||||
file="${BASEDIR}/${name_base64}"
|
file="${BASEDIR}/${name_base64}"
|
||||||
|
|
||||||
if [ ! -f "${file}" ]
|
if [ ! -s "${file}" ]
|
||||||
then
|
then
|
||||||
notify-send -u low "cached_pass" "Asking to cache: ${name}"
|
notify-send -u low "cached_pass" "Asking to cache: ${name}"
|
||||||
pass ${name} > "${file}"
|
pass ${name} > "${file}"
|
||||||
|
|
|
@ -67,8 +67,8 @@ def main(args: argparse.Namespace) -> None:
|
||||||
new_filename = (
|
new_filename = (
|
||||||
f"{m['Y']}-{m['M']}-{m['D']}_"
|
f"{m['Y']}-{m['M']}-{m['D']}_"
|
||||||
f"{m['h']}-{m['m']}-{m['s']}"
|
f"{m['h']}-{m['m']}-{m['s']}"
|
||||||
f"{m.get('dup', '')}"
|
f"{m.get('dup') or ''}"
|
||||||
f"{m.get('spec', '')}"
|
f"{m.get('spec') or ''}"
|
||||||
f"{args.suffix}"
|
f"{args.suffix}"
|
||||||
f".{m['ext']}"
|
f".{m['ext']}"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# TODO De-hardcode
|
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
|
||||||
|
then
|
||||||
echo 30000 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
echo 10000 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
||||||
xrandr --output HDMI-0 --brightness 1
|
fi
|
||||||
automatrop -e base16_scheme=solarized-dark --tags color
|
automatrop -e base16_scheme=solarized-dark --tags color
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# TODO De-hardcode
|
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
|
||||||
|
then
|
||||||
echo 30000 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
echo 40000 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
||||||
xrandr --output HDMI-0 --brightness 1
|
fi
|
||||||
automatrop -e base16_scheme=solarized-light --tags color
|
automatrop -e base16_scheme=solarized-light --tags color
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# TODO De-hardcode
|
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
|
||||||
|
then
|
||||||
echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness
|
||||||
xrandr --output HDMI-0 --brightness 0.5
|
fi
|
||||||
automatrop -e base16_scheme=solarized-dark --tags color
|
automatrop -e base16_scheme=solarized-dark --tags color
|
||||||
|
|
|
@ -9,7 +9,6 @@ import typing
|
||||||
|
|
||||||
import coloredlogs
|
import coloredlogs
|
||||||
import exifread
|
import exifread
|
||||||
import progressbar
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s", logger=log)
|
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s", logger=log)
|
||||||
|
@ -38,12 +37,7 @@ def main(args: argparse.Namespace) -> None:
|
||||||
log.warning("Counting files...")
|
log.warning("Counting files...")
|
||||||
kwargs = {"directory": args.dir, "skip_renamed": args.skip_renamed}
|
kwargs = {"directory": args.dir, "skip_renamed": args.skip_renamed}
|
||||||
log.warning("Processing files...")
|
log.warning("Processing files...")
|
||||||
if args.hide_bar:
|
for full_path in get_pictures(**kwargs):
|
||||||
iterator = get_pictures(**kwargs)
|
|
||||||
else:
|
|
||||||
nb_imgs = len(list(get_pictures(**kwargs)))
|
|
||||||
iterator = progressbar.progressbar(get_pictures(**kwargs), max_value=nb_imgs)
|
|
||||||
for full_path in iterator:
|
|
||||||
# Find date
|
# Find date
|
||||||
with open(full_path, 'rb') as fd:
|
with open(full_path, 'rb') as fd:
|
||||||
exif_data = exifread.process_file(fd)
|
exif_data = exifread.process_file(fd)
|
||||||
|
@ -62,7 +56,7 @@ def main(args: argparse.Namespace) -> None:
|
||||||
ext = os.path.splitext(full_path)[1].lower()
|
ext = os.path.splitext(full_path)[1].lower()
|
||||||
if ext == '.jpeg':
|
if ext == '.jpeg':
|
||||||
ext = '.jpg'
|
ext = '.jpg'
|
||||||
new_name = date.isoformat().replace(":", "-").replace("T", "_")
|
new_name = date.isoformat().replace(":", "-").replace("T", "_") + args.suffix
|
||||||
# First substitution is to allow images being sent to a NTFS filesystem
|
# First substitution is to allow images being sent to a NTFS filesystem
|
||||||
# Second substitution is for esthetics
|
# Second substitution is for esthetics
|
||||||
new_path = os.path.join(args.dir, f"{new_name}{ext}")
|
new_path = os.path.join(args.dir, f"{new_name}{ext}")
|
||||||
|
@ -71,7 +65,7 @@ def main(args: argparse.Namespace) -> None:
|
||||||
while os.path.exists(new_path):
|
while os.path.exists(new_path):
|
||||||
if full_path == new_path:
|
if full_path == new_path:
|
||||||
break
|
break
|
||||||
log.debug(f"{full_path} already exists, incrementing")
|
log.debug(f"{new_path} already exists, incrementing")
|
||||||
i += 1
|
i += 1
|
||||||
new_path = os.path.join(args.dir, f"{new_name}_{i}{ext}")
|
new_path = os.path.join(args.dir, f"{new_name}_{i}{ext}")
|
||||||
|
|
||||||
|
@ -103,16 +97,16 @@ if __name__ == "__main__":
|
||||||
help="Do not actually rename, just show old and new path",
|
help="Do not actually rename, just show old and new path",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s",
|
"-r",
|
||||||
"--skip-renamed",
|
"--skip-renamed",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Skip images whose filename doesn't match usual camera output filenames.",
|
help="Skip images whose filename doesn't match usual camera output filenames.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-b",
|
"-s",
|
||||||
"--hide-bar",
|
"--suffix",
|
||||||
action="store_true",
|
default="",
|
||||||
help="Do not show a progress bar. Also skip counting images",
|
help="Text to add before the extension",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
|
|
@ -148,7 +148,12 @@ class RVElement:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date(self) -> datetime.datetime:
|
def date(self) -> datetime.datetime:
|
||||||
return datetime.datetime.fromtimestamp(self.item["published"])
|
timestamp = (
|
||||||
|
int(self.item.get("timestampUsec", "0")) / 1000000
|
||||||
|
or int(self.item.get("crawlTimeMsec", "0")) / 1000
|
||||||
|
or self.item["published"]
|
||||||
|
)
|
||||||
|
return datetime.datetime.fromtimestamp(timestamp)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_researched(self) -> bool:
|
def is_researched(self) -> bool:
|
||||||
|
@ -475,7 +480,7 @@ class RVDatabase:
|
||||||
def ytdl_opts(self) -> dict:
|
def ytdl_opts(self) -> dict:
|
||||||
# Get user/system options
|
# Get user/system options
|
||||||
prev_argv = sys.argv
|
prev_argv = sys.argv
|
||||||
sys.argv = ['yt-dlp']
|
sys.argv = ["yt-dlp"]
|
||||||
_, _, _, ydl_opts = yt_dlp.parse_options()
|
_, _, _, ydl_opts = yt_dlp.parse_options()
|
||||||
sys.argv = prev_argv
|
sys.argv = prev_argv
|
||||||
return ydl_opts
|
return ydl_opts
|
||||||
|
|
Loading…
Reference in a new issue