26
26
from zeroconf import IPVersion , ServiceInfo , Zeroconf
27
27
28
28
wserver = Flask (__name__ )
29
- dependencies = ["xrandr" ]
29
+ dependencies = []
30
30
stream_sources = ["static-images" , "v4l2" , "vnc-browser" ]
31
31
cmds = {"clock" : "humanbeans_clock" ,
32
32
"image_viewer" : "imv" ,
@@ -201,10 +201,10 @@ def create(self, uris):
201
201
item ["player" ] = "mediaplayer"
202
202
item ["play_time_s" ] = self .default_play_time_s
203
203
elif uri .endswith (".svg" ):
204
- download_file (uri .strip (), download_path )
204
+ download_file (uri .strip (), self . download_path )
205
205
file = uri .split ("/" )
206
206
item ["num" ] = n
207
- item ["uri" ] = "file:///" + download_path + file [- 1 ]
207
+ item ["uri" ] = "file:///" + self . download_path + file [- 1 ]
208
208
item ["player" ] = "imageviewer"
209
209
item ["play_time_s" ] = self .default_play_time_s
210
210
elif uri .startswith ("https://" ):
@@ -646,12 +646,12 @@ def show_image(self, file, fullscreen=False):
646
646
647
647
class Display :
648
648
649
- def __init__ (self , address , port ):
649
+ def __init__ (self , address , port , res_x = 1280 , res_y = 1024 ):
650
650
self .address = address
651
651
self .port = port
652
- res = self . get_resolution (). split ( "x" )
653
- self .res_x = int ( res [ 0 ])
654
- self .res_y = int ( res [ 1 ])
652
+ logging . info ( "Resolution: {}x{}" . format ( res_x , res_y ) )
653
+ self .res_x = res_x
654
+ self .res_y = res_y
655
655
self .start_time = time .time ()
656
656
self .switching_windows = list ()
657
657
self .window_blacklist = list ()
@@ -669,21 +669,6 @@ def __init__(self, address, port):
669
669
670
670
logging .info ("Blacklisted {} windows" .format (len (self .window_blacklist )))
671
671
672
- def get_resolution (self ):
673
- cmd = "xrandr -q | awk '/\*/ {print $1}' \
674
- | awk 'BEGIN{FS=\" x\" ;} NR==1 || \
675
- $1>max {line=$0; max=$1}; END {print line}'"
676
-
677
- p = subprocess .Popen (cmd ,
678
- shell = True ,
679
- stdout = subprocess .PIPE ,
680
- stderr = subprocess .PIPE ,
681
- encoding = "utf8" )
682
-
683
- res = p .communicate ()[0 ]
684
-
685
- return res
686
-
687
672
def get_windows_whitelist (self ):
688
673
windows = self .get_windows (self .window_blacklist )
689
674
logging .info ("display: {} windows in whitelist" .format (len (windows )))
@@ -837,8 +822,8 @@ def __init__(self, threads):
837
822
default = False )
838
823
parser .add_argument ('--uri' ,
839
824
dest = 'uris' ,
840
- env_var = 'URL ' ,
841
- help = "The URL to open in a browser , can be supplied multiple times" ,
825
+ env_var = 'URI ' ,
826
+ help = "The URIs to open, can be supplied multiple times" ,
842
827
type = str ,
843
828
action = 'append' ,
844
829
required = True )
0 commit comments