Skip to content

Instantly share code, notes, and snippets.

@wrybread
wrybread / chromecast_keepawake.py
Last active October 2, 2023 01:14
Keeps a Chromecast from going into standby
#!/usr/bin/python
'''
Sends an ADB command to a Chromecast (or whatever) to keep it from going
into standby after 4 hours. Currently does that by simulating a
screen touch every 5 minutes with the command "input tap -20 0". That
simulates a screen touch off screen so it doesn't affect apps (if on screen
YouTube will get affected for example)
#!/usr/bin/python
'''
This script solves a problem with DJI drones where the file numbers never go above DJI_0999.MP4, and so the filenames aren't unique.
This adds the time and date the photo or video was taken at the start of the filename, preserving whatever text has already been added
but removing the "DJI_0999". So for example "DJI_0999 - mountains.MP4" created on May 5, 2023 at 11:05am becomes
"2023-05-23-110530 - mountains.MP4". And "DJI_0999.MP4" becomes "2023-05-23-110530.MP4".
#!/usr/bin/python
'''
This solves a problem in DJI drone cameras where the file numbers never go above DJI_0999.JPG.
This will prepend the creation date of each file and add some number to the file number (default 3,000,000). For example it'll change
DJI_0999.JPG to "2023-05-23 DJI_3000999.JPG"
It keeps track of the last number it added (in 0filename_fixer.dat), so run it on the card before importing the pics and vids. It processes
#!/usr/bin/python
'''
This solves a problem in DJI drone cameras where the file numbers never go above DJI_0999.JPG.
This will add 1,000,000 to the file number. For example it'll change DJI_0999.JPG to DJI_1000999.JPG
And it's smart enough to know that the file has already been processed (won't add 1,000,000 to the file
number if the number is already above 1,000,000).
@wrybread
wrybread / video_compressor.py
Created March 25, 2023 22:23
Video compressor for DJI drone videos (or anything else)
#!/usr/bin/python
'''
This takes a directory of video files and compresses them.
Made because my DJI Mini 3 Pro drone makes such gigantic raw files (about 1.5 gigs per 5 minutes), which wouldn't play on my Chromecast
To do:
- exclude target folder more intelligently