Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Kruse
potify
Commits
07e650b8
Commit
07e650b8
authored
Sep 11, 2017
by
Andre Julius
👀
Browse files
Enque items based on http request. Return error codes when queue full
parent
cc75c7b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
07e650b8
import
logging
from
api.player
import
player
from
web
import
web
from
api.index
import
reload_index
reload_index
()
web
.
run
(
debug
=
True
,
host
=
"0.0.0.0"
,
port
=
80
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'%(asctime)s %(levelname)-5s %(name)-18s %(message)s'
,
datefmt
=
'%y-%m-%d %H:%M'
)
player
.
start
()
web
.
run
(
debug
=
True
,
host
=
"0.0.0.0"
,
port
=
80
)
\ No newline at end of file
web/views.py
View file @
07e650b8
...
...
@@ -2,6 +2,11 @@ from flask import redirect, abort, request, jsonify, Response
from
web
import
web
import
api.index
import
api.player
import
api.queue
import
logging
from
queue
import
Full
logger
=
logging
.
getLogger
(
"queue"
)
@
web
.
route
(
'/'
,
defaults
=
{
'path'
:
''
})
...
...
@@ -21,7 +26,11 @@ def index():
@
web
.
route
(
"/play/<file>"
)
def
play
(
file
):
if
api
.
index
.
is_indexed
(
file
):
api
.
player
.
play
(
file
)
try
:
api
.
queue
.
q
.
put
(
file
,
False
)
logger
.
info
(
api
.
queue
.
q
.
qsize
())
except
Full
:
return
abort
(
403
)
return
Response
(
200
)
else
:
return
abort
(
404
)
return
"done"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment