4 Commits
0.0.5 ... 0.0.7

Author SHA1 Message Date
ducoterra
3696da7ae4 fix instructions 2020-11-16 18:48:14 -05:00
ducoterra
d60a9f538d add start.sh 2020-11-09 21:21:40 -05:00
ducoterra
20fa53960d add day 2 to index 2020-11-09 21:21:05 -05:00
ducoterra
d58ebc1ebe add debug to convert 2020-11-09 21:20:58 -05:00
4 changed files with 27 additions and 14 deletions

View File

@@ -2,21 +2,27 @@ import subprocess
import os
import time
done_files = []
convert_dir = "/Users/ducoterra/Desktop/"
debug = False
while True:
# get a list of all .mov or .gif files
movs = list(filter(lambda item: item.endswith(".mov"), os.listdir()))
print(f"Found {len(movs)} .mov files.")
gifs = list(filter(lambda item: item.endswith(".gif"), os.listdir()))
print(f"Found {len(gifs)} .gif files.")
movs = list(filter(lambda item: item.endswith(".mov"), os.listdir(convert_dir)))
if debug:
print(f"Found {len(movs)} .mov files.")
gifs = list(filter(lambda item: item.endswith(".gif"), os.listdir(convert_dir)))
if debug:
print(f"Found {len(gifs)} .gif files.")
# find files that are not already gifs and aren't default
not_done = list(filter(lambda mov: mov.replace(".mov",".gif") not in gifs and not mov.startswith("Screen Recording"), movs))
print(f"Found {len(not_done)} to convert.")
if debug:
print(f"Found {len(not_done)} to convert.")
for mov in not_done:
print(f"converting {mov}. Ctrl + C to stop...")
subprocess.run(['/usr/local/bin/ffmpeg', '-i', mov, '-filter:v', 'setpts=0.5*PTS', mov.replace(".mov",".gif")], capture_output=True)
if debug:
time.sleep(5)
subprocess.run(['/usr/local/bin/ffmpeg', '-i', convert_dir + mov, '-filter:v', 'setpts=0.5*PTS', convert_dir + mov.replace(".mov",".gif")], capture_output=True)
time.sleep(1)

View File

@@ -81,8 +81,7 @@ Before we do anything more interesting we're going to have to cover our logical
![create_file](img/day2/create_file.gif)
2. We're going to create an app where the user has to guess the weather. We're going to need the python random module to generate random weather conditions.
3. Add the following to the top of the page:
2. We're going to create an app where the user has to guess the weather. We're going to need the python random module to generate random weather conditions. Add the following to the top of the page:
```python
import random
@@ -92,7 +91,7 @@ Before we do anything more interesting we're going to have to cover our logical
This tells python we intend to use the `random` package
4. We'll generate 4 weather conditions. Add the following after `import random`
3. We'll generate 4 weather conditions. Add the following after `import random`
```python
warm = random.choice([True, False])
@@ -105,7 +104,7 @@ Before we do anything more interesting we're going to have to cover our logical
random.choice([True, False]) selects either True or False randomly.
5. Let's print our weather conditions in a cryptic way. Add the following below our variables:
4. Let's print our weather conditions in a cryptic way. Add the following below our variables:
```python
if warm or cold:
@@ -125,7 +124,7 @@ Before we do anything more interesting we're going to have to cover our logical
This will print weather conditions in pairs to make it more challenging for our users to guess the weather.
6. Now let's get our user input. Since we have 4 possible weather conditions we'll need 4 "guessing modules". Let's build the first one:
5. Now let's get our user input. Since we have 4 possible weather conditions we'll need 4 "guessing modules". Let's build the first one:
```python
warm_guess = input("Is it warm? (y/n) ")
@@ -141,7 +140,7 @@ Before we do anything more interesting we're going to have to cover our logical
We ask the user if it's warm. If they say 'y' and it is warm we tell them they got it right! If they guess wrong we tell them they are wrong.
7. We'll just repeat the guess module 3 more times for cold, raining, and snowing.
6. We'll just repeat the guess module 3 more times for cold, raining, and snowing.
```python
cold_guess = input("Is it cold? (y/n) ")
@@ -171,7 +170,7 @@ Before we do anything more interesting we're going to have to cover our logical
![modules](img/day2/modules.png)
8. Save with ++ctrl++ + S and run your weather app by typing `python weather_app.py`. Try to guess the weather.
7. Save with ++ctrl++ + S and run your weather app by typing `python weather_app.py`. Try to guess the weather.
![run_app](img/day2/run_app.gif)

View File

@@ -15,3 +15,10 @@
- The Interactive Python Prompt
- A Python Program
- A Django Project
### [Day 2](day2.md): not, and, or, if
- Back to the basics: and, or, not, if
- Building a Terrible Weather App
- Pulling it all together with some Django

1
start.sh Executable file
View File

@@ -0,0 +1 @@
mkdocs serve -a localhost:8080