mirror of
https://github.com/KevinMidboe/Node-Com-Handler.git
synced 2026-02-10 03:19:10 +00:00
Got app.py ready for pull request
This commit is contained in:
28
v1/app.py
28
v1/app.py
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Flask auth with HTTP '$ pip install flask_httpauth'
|
# Flask auth with HTTP '$ pip install flask_httpauth'
|
||||||
# For https '$ pip install Flask-SSLify'
|
# For https '$ pip install Flask-SSLify'
|
||||||
|
|
||||||
@@ -11,11 +10,12 @@ import requests
|
|||||||
from werkzeug.security import generate_password_hash, \
|
from werkzeug.security import generate_password_hash, \
|
||||||
check_password_hash
|
check_password_hash
|
||||||
|
|
||||||
from diskusage import diskUsage
|
from status.diskusage import diskUsage
|
||||||
from uptime import timeSinceBoot
|
from status.uptime import timeSinceBoot
|
||||||
from cpuTemp import getCpuTemp
|
from status.cpuTemp import getCpuTemp
|
||||||
|
from plex.tmdb import tmdbSearch
|
||||||
|
|
||||||
from plexMovies import getSpecificMovieInfo
|
from plex.plexMovies import getSpecificMovieInfo
|
||||||
|
|
||||||
app = Flask(__name__, static_url_path = "")
|
app = Flask(__name__, static_url_path = "")
|
||||||
auth = HTTPBasicAuth()
|
auth = HTTPBasicAuth()
|
||||||
@@ -98,19 +98,10 @@ def get_temps():
|
|||||||
# Search, watching, +photo
|
# Search, watching, +photo
|
||||||
@app.route('/api/v1/plex/request', methods=['GET'])
|
@app.route('/api/v1/plex/request', methods=['GET'])
|
||||||
def get_movieRequest():
|
def get_movieRequest():
|
||||||
if (request.args.get("query") != None):
|
query = request.args.get("query")
|
||||||
requestType = "search/multi?"
|
if (query != None):
|
||||||
requestAPI = "api_key=" + "9fa154f5355c37a1b9b57ac06e7d6712"
|
# TODO if list is empty
|
||||||
requestQuery = "&query=" + str(request.args.get('query'))
|
return jsonify(tmdbSearch(query))
|
||||||
requestLanguage = "&language=en.US"
|
|
||||||
|
|
||||||
url = tmdbBaseURL + requestType + requestAPI + requestQuery + requestLanguage
|
|
||||||
# url = "https://api.themoviedb.org/3/search/multi?include_adult=false&query=home%20alone&language=en-US&api_key=9fa154f5355c37a1b9b57ac06e7d6712"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
print(response.json)
|
|
||||||
return response.json
|
|
||||||
|
|
||||||
else: return jsonify({ "Error": "Query not defined." })
|
else: return jsonify({ "Error": "Query not defined." })
|
||||||
|
|
||||||
@@ -158,3 +149,4 @@ def get_uptimesLoad():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host="0.0.0.0",port=63590, debug=True)
|
app.run(host="0.0.0.0",port=63590, debug=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user