Needed to do some small fixes for new request response from plex. Look in plexSearch.py for TODO

This commit is contained in:
2017-02-10 01:34:30 +01:00
parent d4f1dc5b9a
commit d5b28a3bd0
12 changed files with 64 additions and 46 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
v1/flask plex/__pycache__/
status/__pycache__/

View File

@@ -1,45 +1,58 @@
.onoffswitch { /* The switch - the box around the slider */
position: relative; width: 85px; .switch {
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; position: relative;
display: inline-block;
width: 60px;
height: 34px;
} }
.onoffswitch-checkbox {
display: none; /* Hide default HTML checkbox */
.switch input {display:none;}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
} }
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer; .slider:before {
border: 2px solid #FFFFFF; border-radius: 20px; position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
} }
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%; input:checked + .slider {
transition: margin 0.3s ease-in 0s; background-color: #2196F3;
} }
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 32px; padding: 0; line-height: 32px; input:focus + .slider {
font-size: 12px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; box-shadow: 0 0 1px #2196F3;
box-sizing: border-box;
} }
.onoffswitch-inner:before {
content: "Movies"; input:checked + .slider:before {
padding-left: 9px; -webkit-transform: translateX(26px);
background-color: #21D278; color: #FFFFFF; -ms-transform: translateX(26px);
transform: translateX(26px);
} }
.onoffswitch-inner:after {
content: "Shows"; /* Rounded sliders */
padding-right: 9px; .slider.round {
background-color: #EEEEEE; color: #999999; border-radius: 34px;
text-align: right;
} }
.onoffswitch-switch {
display: block; width: 23px; margin: 4.5px; .slider.round:before {
background: #FFFFFF; border-radius: 50%;
position: absolute; top: 0; bottom: 0;
right: 49px;
border: 2px solid #FFFFFF; border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
} }

View File

@@ -8,13 +8,10 @@
<input type='text' id='link_id'> <input type='text' id='link_id'>
<input type='button' id='btnSearch' value='Search' onClick="search(this)"'> <input type='button' id='btnSearch' value='Search' onClick="search(this)"'>
<div class="onoffswitch"> <label class="switch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" value="movies" onClick="toggle(this)" checked> <input type="checkbox">
<label class="onoffswitch-label" for="myonoffswitch"> <div class="slider square"></div>
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label> </label>
</div>
<p id="display"></p> <p id="display"></p>
</body> </body>

Binary file not shown.

View File

@@ -3,7 +3,7 @@
# @Author: KevinMidboe # @Author: KevinMidboe
# @Date: 2017-02-08 14:00:04 # @Date: 2017-02-08 14:00:04
# @Last Modified by: KevinMidboe # @Last Modified by: KevinMidboe
# @Last Modified time: 2017-02-08 22:50:17 # @Last Modified time: 2017-02-10 01:31:43
from requests import get from requests import get
@@ -42,6 +42,12 @@ def getShowInfo(item):
return {"title":title, "year":year, "seasons":seasons, "episodes":episodes, "rating":rating, return {"title":title, "year":year, "seasons":seasons, "episodes":episodes, "rating":rating,
"art":art, "thumb":thumb} "art":art, "thumb":thumb}
## MAJOR TODO
# Seems to be a change in the return obj.
# This looks way more like json. Need to re-write all this.
# IDEA: Send the size and resolution for comaprison
# No this is for a admin page. OR maybe a github project for
# people wanting to update movies. MAJOR IDEA HERE NOW! :D
def plexSearch(query): def plexSearch(query):
requestType = "search?" requestType = "search?"
requestQuery = "query=" + str(query) requestQuery = "query=" + str(query)
@@ -49,6 +55,7 @@ def plexSearch(query):
url = plexBaseURL + requestType + requestQuery url = plexBaseURL + requestType + requestQuery
response = get(url, headers=header) response = get(url, headers=header)
print(response.json())
if response.status_code == 200: if response.status_code == 200:
resContent = response.json() resContent = response.json()