-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process uploads folder and imports every video and photo, able to dow…
…nload a single file with all videos joined and omre
- Loading branch information
1 parent
1749821
commit 41e0e16
Showing
51 changed files
with
656 additions
and
248 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
from config import UPLOAD_FOLDER | ||
from controller import create_app | ||
from flask_sqlalchemy import SQLAlchemy | ||
import db | ||
from controller.models.models import Wanderpi | ||
from controller import socketio | ||
from controller.utils.watcher import ImagesWatcher | ||
import threading | ||
|
||
app = create_app('dev') | ||
|
||
if __name__ == '__main__': | ||
#app.run(threaded=True, host="0.0.0.0") | ||
db.Base.metadata.create_all(db.engine) | ||
#app.run(threaded=True, host="0.0.0.0", port=5000) | ||
socketio.run(threaded=True, host="0.0.0.0", ssl_context='adhoc') | ||
|
||
app.run(threaded=True, host="0.0.0.0", ssl_context='adhoc') | ||
# w = threading.Thread(target=ImagesWatcher(UPLOAD_FOLDER).run()) | ||
|
||
# w.start() | ||
# t.start() |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os | ||
import exifread | ||
from datetime import datetime | ||
|
||
|
||
STATIC_FOLDER = '/static/wanderpis/' | ||
VIDEO_EXTENSIONS = set(['mp4']) | ||
IMAGE_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) | ||
# Allowed extension you can set your own | ||
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif', 'mp4']) | ||
|
||
def get_file_extension(filename): | ||
if '.' in filename: | ||
return filename.rsplit('.', 1)[1].lower() | ||
else: | ||
return 'mp4' | ||
|
||
def allowed_file(filename): | ||
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | ||
|
||
#convert degree minute second to degree decimal | ||
def dms_to_dd(dms): | ||
dd = float(dms[0]) + float(dms[1])/60 + float(dms[2])/3600 | ||
return float(dd) | ||
|
||
def get_lat_long_tags(path_name): | ||
f = open(path_name, 'rb') | ||
|
||
tags = exifread.process_file(f, stop_tag='GPS') | ||
|
||
lat = 0 | ||
long = 0 | ||
|
||
for tag in tags.keys(): | ||
if tag == 'GPS GPSLatitude': | ||
lat = dms_to_dd(tags[tag].values) | ||
elif tag == 'GPS GPSLongitude': | ||
long = dms_to_dd(tags[tag].values) | ||
|
||
if lat == 0 and long == 0: | ||
lat = 0 | ||
long = 0 | ||
|
||
return lat, long | ||
|
||
def create_folder(directory): | ||
try: | ||
if not os.path.exists(directory): | ||
os.makedirs(directory) | ||
except OSError: | ||
print('Error: Creating directory. ' + directory) |
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
Oops, something went wrong.