From 29784eed4fb4eca1c3968ca57b70e5cd1a4db23d Mon Sep 17 00:00:00 2001 From: Neythen Date: Fri, 21 May 2021 11:20:39 +0100 Subject: [PATCH] image and gif upload and display working --- __pycache__/stockTicker.cpython-37.pyc | Bin 9267 -> 10006 bytes csv/crypto.csv | 4 +- csv/scroll_text.csv | 2 +- csv/settings.csv | 2 +- display_gif | Bin 0 -> 747 bytes display_image | Bin 0 -> 2202 bytes final.ppm | Bin 515727 -> 515727 bytes final1.ppm | Bin 515727 -> 515727 bytes gifs/close.gif | Bin 0 -> 821 bytes gifs/open.gif | Bin 0 -> 747 bytes scroll_text.ppm | Bin 18638 -> 22862 bytes server.py | 67 ++++++++++++++++++++----- stockTicker.py | 59 ++++++++++++++++++++-- stockTicker.pyc | Bin 10332 -> 11659 bytes templates/index.html | 14 +++++- 15 files changed, 127 insertions(+), 21 deletions(-) create mode 100644 display_gif create mode 100644 display_image create mode 100644 gifs/close.gif create mode 100644 gifs/open.gif diff --git a/__pycache__/stockTicker.cpython-37.pyc b/__pycache__/stockTicker.cpython-37.pyc index 82747a23361b96adb78b6d54fd7afb4b211eaed6..7f825192804ba296567f82a5057285290b898551 100644 GIT binary patch delta 1421 zcmaKrO>7%Q6vyYyuI=^uYxCu(ZkpOo33Z!GNfDROs0nEkC`l_SQoEouVK$Cq$E4$J zsbM1rwTe>lB|4>iMzXmexS(PQ5d>V25OC#!wjgnWBNtSm9uV(s3xxyhYJT(HoA+ik zyZ_goyfz&li^WWa&-mthXU>gXkKe=Zdly}s6+o~87a;g0R?vhdbewgO6Cq(-f7H)f-ilZ(j)1hZAJT!)fes<^3_;R9YQC=R` zPT`nkg5mu_(-QDHp0QY}mTF73kV$llIPm#tREBYqlMQ69LvnKV5)L3d-LWebPp{c_ z*)t|)j!a1Tw3PITWRCC;_c!Y3_@F*clm?q31asfGrQ^6>f7UvdA72D&b6%R_% zq73zTG%;q1Qf;*|Uq3o^WE+FEAq3;5t^ZYAM;rW1u#Y-}4l-&-5;EsH!h_p_%NZOwo)T-UU{hr$g1?t-(acT)3*h=7iiW0F?q5IgwuqV z2u~1RCcL6<>`K9_>gKL2yry>a?+#qX@Jjo^{&j$>>Wkf1;0<*meGooW8|i~_4HroO zzUptOuhabpJQsw9x*HO@%jS6XTl53ykBFe}e~Nwx{bR!L{SQ=cCezr&Xbhw4Bydt; z^*l!682JPvA;(w_H%*@rpHU}94ImONPA!Hx*ixkI>LIMNuHi|V)ENN{kTSclN zlvqE41xp{TSg7cspdf-S2%=Dr9@UdZ{1@V-Ck1g{1Ra>)zW4U)&CafjI79wHpHF9U zY+iXZI-7dwkMrJDnHHD@f>~UE;PcELD8hI~n?TUq)Wz{FEOwI?))=2^quDWyHc3Y%SjX?cLqOpVJ$-)!oaQYD_z9a`M}Hxk?-R zC)I{E#2WYXb~Ri26in`#v#2RBwXdXQ{)z=_*G(}gubeY+@$~lXb$x~TTUJe5xbr}L zZhv{rzIlh&9}n3XwYK=AyBf4B5oZHD!jM<>XOMub8hdRe81x1 zo7)%G4nv1w&3MWeoA7V>Kl`KJj8U9&S(@$pVaCT zwC#*>+@#VXtmd{N=H#Zs+&pT@$3iBcgf9_+*#r#K|MoKfw=*!T_|Ne5KPZsFU^I~N H1+p~&wK7U< literal 0 HcmV?d00001 diff --git a/display_image b/display_image new file mode 100644 index 0000000000000000000000000000000000000000..1b52aea8269857fb686f6c0c960a6a7887f26cc2 GIT binary patch literal 2202 zcmV;L2xa$)P)N-KG#1rf{<}>sA{btV9>63~>sNy<-qNswY9CX@7tTKUG z2b^>w6;SGphFoFS8w?N>k8_`(95X&tKIEV8Uou(njcN}$(M{i3RF>A~tMvb^b&i=0gfeZYVLWa7k$g8KIDE3ND6>uXdO z>d~Wz=KYFtEH-n{vB z==!520N_D2$V_tAA1$^q7xYDo7Lm`NKN~@ZO_?%9+6FEV-l4tFxt1(h(&5lIZro^? zpjyzUO`ArZK7IOi=yZU6sM4vL%)AxLb4xCEG8gnackZy4t*xzPQrh0Vd!=o9_wLQy z|F=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HbU=Z29Rx%aPxe3l2}>dX delta 1551 zcmY*ZZ)jUp6erue_Y#;S1cJfPv~h7^nPJZc>O#UAgT=aHO+^r=m4`TsSZEl?U`%#D zbPm64NyT@-Ptp3JDAveRM=@0Q$-lqzZqm&!;pN9&lJ{fQN(lM^!Ru32SrF3ItxuDbWhBKdz? zvov(YigUDJQhFC4uSR}n)RH^no8gdS)1UYvA=eW{t>IC`k8^nysIrxS^y@H6*@UpO% z{)qr!oO(CKlK0+gqEsU1Tal#7f|w@%xT-ewF3z*5)e{k_Es0rz05(-VL!HVNn3y_o z)@m}i3grS7v(#Njj;%$`;GbC$drQ>)3p4|?#%Y-%yC$;KI)QTav`kQISs+%~p~(M8 zjP_MRn5#Q)iLm=8&e7j=Q^!oS`<*D7+{T=orTU91%b*1hJzXfdoA5T80x~oPqhU1< zZz7y94x$Cd$nu52gyaA|2of~6o4GWyhGUoMG|Y%j4w#%&~iQxEkW)35xE;W2|PVL+W-UqT{XL%u)zJ5sdGe(nU`<2Qh`fnsg?v2J*^zJz?3dit%te9Nt(JV zDEL3PG~RizWSV+E6QGfT)$^V`qU=WvvuFmx>U^x=`>KF>*Dc3zK`#rz<|5|_RPLTq zDPB*Qy? zO+7@twVk<7^`21h5jfzrK2$%T1TRLri=o6W3+6aN(PIiO-H=JsGPdkt@}GzJ5IT#M V2E}<{8kWT%5NLzFRcz`9{sW^8L!STu diff --git a/gifs/close.gif b/gifs/close.gif new file mode 100644 index 0000000000000000000000000000000000000000..1eadae40c4dc16d28234c6cb4e150b88c535af93 GIT binary patch literal 821 zcmZ?wbhEHb3}R4V_{abTcCTk}KVj&5t@x9L(+DV{_@CR)H6+;CF~HSG&w!Z`BIKEy zn4apJn4X!O&6}Q>o118Bpl4!gVrt5u12P3<9s|?=mVQp9SNx0TOp)~7d~f#FqpgoB zYG*uBz30A7sC#a<@$z?X4}4Di`sUN&*04Py8zYz$n+~0OchbbL(Rbq6<-r%1g`{qs zv{#|qUF1D?+^Wf*vv<@wIj8J5F!d`x{XFrO1>1_P)7iE>-Rdl6{vxDe>yjN6%tys` za@-7^`Ljac!psYj4GdOXTCXytvK)5(+F8~0N!Vb*Da+HE))Q7+duw~I&f?y)`}Zx& zIlrYJ{+8r<@cPys9jUijcTS)7QjD#h`$pz2&zrRy_R1#xyX(t0FXrDVUi+pvIX$`h z{&{uvdETe?t;>sYXuPv2^R;=7!oI36dv;oX^NZXc_AK-LEBetm3q47Mo9TO1`%LHAR>f_&~F6B!e`n449));p8W^Mgx~OwI?))=2^quDWyHc3Y%SjX?cLqOpVJ$-)!oaQYD_z9a`M}Hxk?-R zC)I{E#2WYXb~Ri26in`#v#2RBwXdXQ{)z=_*G(}gubeY+@$~lXb$x~TTUJe5xbr}L zZhv{rzIlh&9}n3XwYK=AyBf4B5oZHD!jM<>XOMub8hdRe81x1 zo7)%G4nv1w&3MWeoA7V>Kl`KJj8U9&S(@$pVaCT zwC#*>+@#VXtmd{N=H#Zs+&pT@$3iBcgf9_+*#r#K|MoKfw=*!T_|Ne5KPZsFU^I~N H1+p~&wK7U< literal 0 HcmV?d00001 diff --git a/scroll_text.ppm b/scroll_text.ppm index cadb84d13690d3b7136f271116d9d039343d7fd6..9a254cf8c3aefc43a6e64428003626e5f9b350de 100755 GIT binary patch literal 22862 zcmeH@L2g(v2t>2aDSC!Psd9|o|1vEV3K}tZ%y$;?0_)2k505eC&+pf__s?JNZ?A73 zAFnU7W&$&TnZQh7CNLA23Csj$0yBY`z)WB!FcX*w%miivGl5$s@b~4#zU^|X+{@aI z?TSgau>YzMNoH6Srmi3Kj^oOWErQ&I+Mh7 zESb{WL|kPd0v0pFN-FVViMhyo>97*HJSk#p1$9MZgRz0b{_JE4Je*MFcPoIGF?^08a&327)PStn1D%%J{yM4R7!$fx47R*^{+v-&Sz7gZH$)~`Uw_6gEj@U*@ zr6ZCNGs8;27$htm1&Jw)g#%(9Gt5e-Di~2NQc-??;IFXV*Y;6Opl@jRCeL*IYOVNp zNM=|mtiRD!$E{?v*lAlZ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Go5+bF`ViYro+6dr{ z`lbajG%0`#z-1@_Qa;UOCF4E{-FrbgFpty-yoEoz1WSmNEJhjtcX#3HmhH(<0#pO^ mccm_50zj6gr6eo^W&^W<*}!aIHZU8Q4a^2+1G9mzxPkxQtM0u3 diff --git a/server.py b/server.py index 46c5dd9..bbb882e 100644 --- a/server.py +++ b/server.py @@ -137,15 +137,58 @@ def Brightness(): LastCommand = 'Change Brightness' return hello() -@app.route("/Display_text", methods=['POST']) -def Display_text(): +@app.route("/DisplayText", methods=['POST']) +def DisplayText(): text = request.form['text'] f = open('csv/scroll_text.csv', 'w+') f.write(text) f.close() + ticker.sendline('K') ticker.sendline('T') return hello() +@app.route("/DisplayImage", methods=['POST']) +def DisplayImage(): + if request.method == 'POST': + if 'file' not in request.files: + print('No file attached in request') + return hello() + fle = request.files['file'] + if fle.filename == '': + print('No file selected') + return hello() + if fle and allowed_file(fle.filename): + filename = 'display_image' + fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)) + global LastCommand + LastCommand = 'Add a new logo file' + ticker.sendline('K') + ticker.sendline('I') + return hello() + return hello() + +@app.route("/DisplayGIF", methods=['POST']) +def DisplayGIF(): + + if request.method == 'POST': + if 'file' not in request.files: + print('No file attached in request') + return hello() + fle = request.files['file'] + if fle.filename == '': + print('No file selected') + return hello() + if fle: + print('in') + filename = 'display_gif' + fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)) + global LastCommand + LastCommand = 'Add a new logo file' + ticker.sendline('K') + ticker.sendline('G') + return hello() + return hello() + @app.route("/Ticker", methods=['POST']) def Ticker(): @@ -153,13 +196,13 @@ def Ticker(): if 'file' not in request.files: print('No file attached in request') return hello() - file = request.files['file'] - if file.filename == '': + fle = request.files['file'] + if fle.filename == '': print('No file selected') return hello() - if file and allowed_file(file.filename): - filename = secure_filename(file.filename) - file.save(os.path.join(CSV_FOLDER, filename)) + if fle and allowed_file(fle.filename): + filename = secure_filename(fle.filename) + fle.save(os.path.join(CSV_FOLDER, filename)) process_file(os.path.join(CSV_FOLDER, filename), filename) global LastCommand LastCommand = 'Change CSV file' @@ -172,13 +215,13 @@ def AddLogo(): if 'file' not in request.files: print('No file attached in request') return hello() - file = request.files['file'] - if file.filename == '': + fle = request.files['file'] + if fle.filename == '': print('No file selected') return hello() - if file and allowed_file(file.filename): - filename = secure_filename(file.filename) - file.save(os.path.join(LOGO_FOLDER, filename)) + if fle and allowed_file(fle.filename): + filename = secure_filename(fle.filename) + fle.save(os.path.join(LOGO_FOLDER, filename)) global LastCommand LastCommand = 'Add a new logo file' return hello() diff --git a/stockTicker.py b/stockTicker.py index 659eef8..2acd89a 100644 --- a/stockTicker.py +++ b/stockTicker.py @@ -180,6 +180,37 @@ class StockTicker(): img.save('scroll_text.ppm') self.scrollImageTransition(['scroll_text.ppm', 'scroll_text.ppm'], offset_x = 128, offset_y = 0, stocks = False) + + + def displayGIF(self, gif_file): + + im = Image.open(gif_file) + + # To iterate through the entire gif + + i = 0 + while 1: + print(im.tell()) + try: + im.seek(i) + except EOFError: + print('finished') + i = 0 + im.seek(i) + # do something to im + self.setImage(im.convert('RGB')) + time.sleep(0.5) + i += 1 + try: + msg = getInput() + if msg == 'K': + self.resetMatrix() + break + + self.process_msg(msg) + except KeyboardInterrupt: + sys.stdout.flush() + pass @@ -406,11 +437,11 @@ class StockTicker(): def process_msg(self, msg): - if msg == 'S': + if msg == 'S': # stocks self.getFullStockImage(1) self.displayStocks() - + # speed settings elif msg == 's': self.delay = 0.03 @@ -420,16 +451,36 @@ class StockTicker(): elif msg == 'f': self.delay = 0.005 - elif msg in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: + + elif msg in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: # birghtness ettings self.brightness = min(1.0, float(msg)/10 + 0.1) - elif msg == 'T': + + + elif msg == 'T':# text + self.displayText() + + elif msg == 'I': # image + + image = self.openImage(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_image')) + self.setImage( image) + + elif msg == 'G': # gif + + self.displayGIF(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_gif')) + + + elif msg == 'K': # kill + self.resetMatrix() if __name__ == '__main__': #print(sys.stdin.readlines()) stock_ticker = StockTicker() + #stock_ticker.displayGIF('/home/pi/Desktop/stock_ticker/gifs/open.gif') + #stock_ticker.displayGIF('/home/pi/Desktop/stock_ticker/gifs/close.gif') + #stock_ticker.process_msg(brightness) #stock_ticker.process_msg(speed) diff --git a/stockTicker.pyc b/stockTicker.pyc index 0801bdaea4ffd3a89c26c32e83cf02e563b8c79d..26d88ce136050431c2acae012967537a1ad50980 100644 GIT binary patch delta 4812 zcmaJ^YiyfW89wLx9LJw8v7M{kw2jlGsae-_4c%I`S=X+m>wtFI=~%j~o#)z4YR9o% ze_z&=CGtj#CIpO)voRqMjQ(SqKq9PT7Z6AYAtC+&(ij&_{6Or-KmvXsF6DX7=O)o6 zE$#RCJ@<3o^SqbyyQ$AVJZS$t7XF9#jYkWj{b%F%Fg`c@?BMgQq7cP^sK&(ulsZH; zAr_KiCMjg8TNH!hsuVLlqSz^B(Hs(2g}5TbLo>ai)F+CLn72eTC`-Mpo#_`#8BrP# zO-q(~OifCZ`b8xzN-1$g3VHEQV!DQTq&S@oV+-XQ`Z+m0n3a${!Y#ho32~}fFO=NX zcV(B9efnS4gnUikYTw-|b#j|mZ7~xv`@^~p_lKR$gxg!3iEwYMiHc&_2r*HN7@c zL&1Vf=xf2O9M-=GmgF6)dpeh-Osu{Xib$E!*PU~T6ozGE05wb)(<9;Q@-F?`@PwSz zvB+?I>4;di#Bzs-%m+j>uTMlKTEk)*S93ZWz>rgAYDw)S+z!YFDeWNaB-{n?*wHI5 zl)MfIZnacus5GQ3wdyatozmJQYK+Bwg#CalJ|Em$A?X*xyYyHz-kL$djj~b3Wjv6O zVJj^QT!Sa#Mvmfhla{&Ql@8$vu@V$Z|C6}dX4Jx|aPcI}qFBc1J}Ep)6meQ1Dz+%% zzXQ%#E1hDwQ&a-vj|5rR+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IPUxAPWZ7!0Ha%v{ z>@*u3&?%Eyo-dR#8F>@Kko30YID8vv?xhB}LW0o}0w+(ar-lc;`qXc#tHY0P)|QW9 zdT#kMw)oM;UhtU7)M)&FWkIiiDW1XQUz3Md;YtC%3HTO6O$1gfE2l%O-%V0KbFk}k mdxp7ByB7GG%tPvU0YL diff --git a/templates/index.html b/templates/index.html index 54d4b58..0799a28 100644 --- a/templates/index.html +++ b/templates/index.html @@ -30,11 +30,23 @@

Display scrolling text. Enter the message followed by the rgb values seperated by commas. e.g. hello world!,255,255,0

-
+
+

Display an image

+
+

+ +

+ +

Display a gif

+
+

+ +

+

Tickers to display

To change the tickers displayed please upload a CSV (comma separated value) file with 11 tickers on each row e.g