Closed teeedubb closed 5 years ago
note for ya..
before pasting any kind of output like this you will want to add ```python on the line before the data you paste and ``` on the line after the data
those are back ticks (key above the tab)
as far as the error is concerned. it appears as tho this issue was reported several months ago. and the author of the library stated several months ago that they reverted the change that caused this issue and that the next release would have this working again.several releases have passed since then. and apparently this issue was not fixed. It was actually only fixed 7 days ago. and has not been included in a release as of yet.
I am going to work around the problem. I will have a fixed version up by the end of the day today.
Thank You for reporting this problem to me.
Hi Kevin,
Thanks for the quick reply and the pointers about formatting posts... Unfortunately I'm posting error logs, but it looks a lot better this time :) I have pulled your commits with the latest master and I am now getting another error. There is no authorization prompt on the tv.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/samsungctl/samsungctl/remote_websocket.py", line 82, in do
if self.sock is not None:
AttributeError: 'RemoteWebsocket' object has no attribute 'sock'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/samsungctl/samsungctl/__main__.py", line 206, in <module>
main()
File "/samsungctl/samsungctl/__main__.py", line 181, in main
with Remote(config) as remote:
File "/samsungctl/samsungctl/remote.py", line 13, in __init__
self.remote = RemoteWebsocket(config)
File "/samsungctl/samsungctl/remote_websocket.py", line 49, in __init__
self.open()
File "/samsungctl/samsungctl/remote_websocket.py", line 116, in open
raise RuntimeError('Connection Failure')
RuntimeError: Connection Failure
I'm a dum dum....
This is my boo boo. It is because I am checking for the sock object before i even initialized the WebsocketApp.
This will be repaired in a jif.
all fixed. well it should be.
nice little tip about posting the errors like that huh?? there is a whole slew of them
apache
# rewrite`s rules for wordpress pretty url
LoadModule rewrite_module modules/mod_rewrite.so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]
ExpiresActive On
ExpiresByType application/x-javascript "access plus 1 days"
Order Deny,Allow
Allow from All
<Location /maps/>
RewriteMap map txt:map.txt
RewriteMap lower int:tolower
RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
</Location>
bash
#!/bin/bash
###### CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
if [ "$UID" -ne 0 ]
then
echo "Superuser rights required"
exit 2
fi
genApacheConf(){
echo -e "# Host ${HOME_DIR}$1/$2 :"
}
coffeescript
grade = (student, period=(if b? then 7 else 6)) ->
if student.excellentWork
"A+"
else if student.okayStuff
if student.triedHard then "B" else "B-"
else
"C"
class Animal extends Being
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
c++
#include <iostream>
int main(int argc, char *argv[]) {
/* An annoying "Hello World" example */
for (auto i = 0; i < 0xFFFF; i++)
cout << "Hello, World!" << endl;
char c = '\n';
unordered_map <string, vector<string> > m;
m["key"] = "\\\\"; // this is an error
return -2e3 + 12l;
}
c#
using System.IO.Compression;
#pragma warning disable 414, 3021
namespace MyApplication
{
[Obsolete("...")]
class Program : IInterface
{
public static List<int> JustDoIt(int count)
{
Console.WriteLine($"Hello {Name}!");
return new List<int>(new int[] { 1, 2, 3 })
}
}
}
css
@font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}
body, .usertext {
color: #F0F0F0; background: #600;
font-family: Chunkfive, sans;
}
@import url(print.css);
@media print {
a[href^=http]::after {
content: attr(href)
}
}
diff
Index: languages/ini.js
===================================================================
--- languages/ini.js (revision 199)
+++ languages/ini.js (revision 200)
@@ -1,8 +1,7 @@
hljs.LANGUAGES.ini =
{
case_insensitive: true,
- defaultMode:
- {
+ defaultMode: {
contains: ['comment', 'title', 'setting'],
illegal: '[^\\s]'
},
*** /path/to/original timestamp
--- /path/to/new timestamp
***************
*** 1,3 ****
--- 1,9 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!
! compress the size of the
! changes.
It is important to spell
http
POST /task?id=1 HTTP/1.1
Host: example.org
Content-Type: application/json; charset=utf-8
Content-Length: 137
{
"status": "ok",
"extended": true,
"results": [
{"value": 0, "type": "int64"},
{"value": 1.0e+3, "type": "decimal"}
]
}
ini
; boilerplate
[package]
name = "some_name"
authors = ["Author"]
description = "This is \
a description"
[[lib]]
name = ${NAME}
default = True
auto = no
counter = 1_000
toml
; boilerplate
[package]
name = "some_name"
authors = ["Author"]
description = "This is \
a description"
[[lib]]
name = ${NAME}
default = True
auto = no
counter = 1_000
java
/**
* @author John Smith <john.smith@example.com>
*/
package l2f.gameserver.model;
public abstract class L2Char extends L2Object {
public static final Short ERROR = 0x0001;
public void moveTo(int x, int y, int z) {
_ai = null;
log("Should not be called");
if (1 > 5) { // wtf!?
return;
}
}
}
javascript
function $initHighlight(block, cls) {
try {
if (cls.search(/\bno\-highlight\b/) != -1)
return process(block, true, 0x0F) +
` class="${cls}"`;
} catch (e) {
/* handle exception */
}
for (var i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined)
console.log('undefined');
}
}
export $initHighlight;
json
[
{
"title": "apples",
"count": [12000, 20000],
"description": {"text": "...", "sensitive": false}
},
{
"title": "oranges",
"count": [17500, null],
"description": {"text": "...", "sensitive": false}
}
]
makefile
# Makefile
BUILDDIR = _build
EXTRAS ?= $(BUILDDIR)/extras
.PHONY: main clean
main:
@echo "Building main facility..."
build_main $(BUILDDIR)
clean:
rm -rf $(BUILDDIR)/*
markdown
# hello world
you can write text [with links](http://example.com) inline or [link references][1].
* one _thing_ has *em*phasis
* two __things__ are **bold**
[1]: http://example.com
---
hello world
===========
<this_is inline="xml"></this_is>
> markdown is so cool
so are code segments
1. one thing (yeah!)
2. two thing `i can write code`, and `more` wipee!
nginx
user www www;
worker_processes 2;
pid /var/run/nginx.pid;
error_log /var/log/nginx.error_log debug | info | notice | warn | error | crit;
events {
connections 2000;
use kqueue | rtsig | epoll | /dev/poll | select | poll;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
send_timeout 3m;
client_header_buffer_size 1k;
}
objective-c
#import <UIKit/UIKit.h>
#import "Dependency.h"
@protocol WorldDataSource
@optional
- (NSString*)worldName;
@required
- (BOOL)allowsToLive;
@end
@property (nonatomic, readonly) NSString *title;
- (IBAction) show;
@end
perl
# loads object
sub load
{
my $flds = $c->db_load($id,@_) || do {
Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef
};
my $o = $c->_perl_new();
$id12 = $id / 24 / 3600;
$o->{'ID'} = $id12 + 123;
#$o->{'SHCUT'} = $flds->{'SHCUT'};
my $p = $o->props;
my $vt;
$string =~ m/^sought_text$/;
$items = split //, 'abc';
$string //= "bar";
for my $key (keys %$p)
{
if(${$vt.'::property'}) {
$o->{$key . '_real'} = $flds->{$key};
tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
}
}
php
require_once 'Zend/Uri/Http.php';
namespace Location\Web;
interface Factory
{
static function _factory();
}
abstract class URI extends BaseURI implements Factory
{
abstract function test();
public static $st1 = 1;
const ME = "Yo";
var $list = NULL;
private $var;
/**
* Returns a URI
*
* @return URI
*/
powershell (ps)
if ( $HOME[0] -eq '/' ) {
# Linux: lshw/smartctl/df commands
Write-Host "Volume `tStatus`tCapacity`tModel" -ForegroundColor White
Write-Host "====== `t======`t========`t=====`n" -ForegroundColor White
( . lshw -short -class disk ) -match "/dev/" | ForEach-Object {
$disk = ( $_.trim( ) -split '\s+', 3 )[1]
$name = ( $_.trim( ) -split 'disk', 2 )[1].trim( )
if ( $disk -notmatch "(/cd|/dvd|/sr)" ) {
try {
$size = 0
$size = ( ( ( . df -l --output=source,size ) -match $disk ) -split '\s+', 2 )[1] / 1MB
if ( $size -gt 0 ) {
$test = ( ( ( . smartctl -H $disk ) -match "SMART [^\n\r]+: ([A-Z]+)" ) -split ":" )[1].trim( )
Write-Host "$disk`t" -ForegroundColor White -NoNewline
if ( $test -eq "PASSED" ) {
$fgc = "Green"
} else {
$fgc = "Red"
$rc = 1
}
Write-Host "$test`t" -ForegroundColor $fgc -NoNewline
Write-Host ( "{0,5:N0} GB`t$name" -f $size ) -ForegroundColor White
}
}
catch {
# ignore errors from USB sticks etc.
}
}
}
}
properties
# .properties
! Exclamation mark = comments, too
key1 = value1
key2 : value2
key3 value3
key\ spaces multiline\
value4
empty_key
! Key can contain escaped chars
\:\= = value5
python
@requires_authorization
def somefunc(param1='', param2=0):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
return (param2 - param1 + 1 + 0b10l) or None
class SomeClass:
pass
>>> message = '''interpreter
... prompt'''
ruby
# The Greeter class
class Greeter
def initialize(name)
@name = name.capitalize
end
def salute
puts "Hello #{@name}!"
end
end
g = Greeter.new("world")
g.salute
shell
$ echo $EDITOR
vim
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ git push
Everything up-to-date
$ echo 'All
> done!'
All
done!
sql
CREATE TABLE "topic" (
"id" serial NOT NULL PRIMARY KEY,
"forum_id" integer NOT NULL,
"subject" varchar(255) NOT NULL
);
ALTER TABLE "topic"
ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")
REFERENCES "forum" ("id");
-- Initials
insert into "topic" ("forum_id", "subject")
values (2, 'D''artagnian');
html
<!DOCTYPE html>
<title>Title</title>
<style>body {width: 500px;}</style>
<script type="application/javascript">
function $init() {return true;}
</script>
<body>
<p checked class="title" id='title'>Title</p>
<!-- here goes the rest of the page -->
</body>
xml
<!DOCTYPE html>
<title>Title</title>
<style>body {width: 500px;}</style>
<script type="application/javascript">
function $init() {return true;}
</script>
<body>
<p checked class="title" id='title'>Title</p>
<!-- here goes the rest of the page -->
</body>
yml
# Employee records
- martin:
name: Martin D'vloper
job: Developer
skills:
- python
- perl
- pascal
- tabitha:
name: Tabitha Bitumen
job: Developer
skills:
- lisp
- fortran
- erlang
and I am sure there are more i just can't think of them off hand
ahh I found a complete list
ActionScript
Ada
ANTLR
AppleScript
Assembly (various)
Asymptote
Awk
Befunge
Boo
BrainFuck
C, C++
C#
Clojure
CoffeeScript
ColdFusion
Common Lisp
Coq
Cryptol (incl. Literate Cryptol)
Crystal
Cython
D
Dart
Delphi
Dylan
Elm
Erlang
Ezhil Ezhil - A Tamil programming language
Factor
Fancy
Fennel
Fortran
F#
GAP
Gherkin (Cucumber)
GL shaders
Groovy
Haskell (incl. Literate Haskell)
HLSL
IDL
Io
Java
JavaScript
Lasso
LLVM
Logtalk
Lua
Matlab
MiniD
Modelica
Modula-2
MuPad
Nemerle
Nimrod
Objective-C
Objective-J
Octave
OCaml
PHP
Perl
PovRay
PostScript
PowerShell
Prolog
Python 2.x and 3.x (incl. console sessions and tracebacks)
REBOL
Red
Redcode
Ruby (incl. irb sessions)
Rust
S, S-Plus, R
Scala
Scheme
Scilab
Smalltalk
SNOBOL
Tcl
Vala
Verilog
VHDL
Visual Basic.NET
Visual FoxPro
XQuery
Zephir
ok so only because the name caught my eye. I wanted to know what it was.
i guess there is a programming language called brainfuck. and it is literal in it's name. there has been a version of the compiler less then 100 bytes in size.. LOL
here is a code example and then you will understand why the language is names like it is. this code example is to print out Hello World
[ This program prints "Hello World!" and a newline to the screen, its
length is 106 active command characters. [It is not the shortest.]
This loop is an "initial comment loop", a simple way of adding a comment
to a BF program such that you don't have to worry about any command
characters. Any ".", ",", "+", "-", "<" and ">" characters are simply
ignored, the "[" and "]" characters just have to be balanced. This
loop and the commands it contains are ignored because the current cell
defaults to a value of 0; the 0 value causes this loop to be skipped.
]
++++++++ Set Cell #0 to 8
[
>++++ Add 4 to Cell #1; this will always set Cell #1 to 4
[ as the cell will be cleared by the loop
>++ Add 2 to Cell #2
>+++ Add 3 to Cell #3
>+++ Add 3 to Cell #4
>+ Add 1 to Cell #5
<<<<- Decrement the loop counter in Cell #1
] Loop till Cell #1 is zero; number of iterations is 4
>+ Add 1 to Cell #2
>+ Add 1 to Cell #3
>- Subtract 1 from Cell #4
>>+ Add 1 to Cell #6
[<] Move back to the first zero cell you find; this will
be Cell #1 which was cleared by the previous loop
<- Decrement the loop Counter in Cell #0
] Loop till Cell #0 is zero; number of iterations is 8
The result of this is:
Cell No : 0 1 2 3 4 5 6
Contents: 0 0 72 104 88 32 8
Pointer : ^
>>. Cell #2 has value 72 which is 'H'
>---. Subtract 3 from Cell #3 to get 101 which is 'e'
+++++++..+++. Likewise for 'llo' from Cell #3
>>. Cell #5 is 32 for the space
<-. Subtract 1 from Cell #4 for 87 to give a 'W'
<. Cell #3 was set to 'o' from the end of 'Hello'
+++.------.--------. Cell #3 for 'rl' and 'd'
>>+. Add 1 to Cell #5 gives us an exclamation point
>++. And finally a newline from Cell #6
and if you ditch all of the comments
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
the language only has 8 commands. + - < > [ ] . ,
Damn, I can see why they call it BrainFuck haha Ive tried with your latest commits and am getting a different error. This seems to happen after a certain amount of time, regardless if I allow to device or let it sit. Nothing is written to token.txt and I need to re-authorize the device each time I run the command.
root@e128636a1014:/samsungctl# python -m samsungctl --host 192.168.123.203 --port 8002 --method websocket KEY_HDMI1
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/samsungctl/samsungctl/__main__.py", line 206, in <module>
main()
File "/samsungctl/samsungctl/__main__.py", line 181, in main
with Remote(config) as remote:
File "/samsungctl/samsungctl/remote.py", line 13, in __init__
self.remote = RemoteWebsocket(config)
File "/samsungctl/samsungctl/remote_websocket.py", line 50, in __init__
self.open()
File "/samsungctl/samsungctl/remote_websocket.py", line 117, in open
raise RuntimeError('Connection Failure')
RuntimeError: Connection Failure
^CException ignored in: <module 'threading' from '/usr/local/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/local/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
root@e128636a1014:/samsungctl# cat ~/.samsungctl/token.txt
root@e128636a1014:/samsungctl#
Yeah I thought that rather amusing for the name as well. but you can technically do everything with it that you can with any other programming language. it is just doing it at the byte level.
Do me a favor. run samsungctl with -vvvv in the command line switches. and report back the output
root@9ad316f0f05a:/samsungctl# python -m samsungctl -vvvv --host 192.168.123.203 --port 8002 --method websocket KEY_HDMI
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/samsungctl/samsungctl/__main__.py", line 206, in <module>
main()
File "/samsungctl/samsungctl/__main__.py", line 181, in main
with Remote(config) as remote:
File "/samsungctl/samsungctl/remote.py", line 13, in __init__
self.remote = RemoteWebsocket(config)
File "/samsungctl/samsungctl/remote_websocket.py", line 50, in __init__
self.open()
File "/samsungctl/samsungctl/remote_websocket.py", line 117, in open
raise RuntimeError('Connection Failure')
RuntimeError: Connection Failure
^CException ignored in: <module 'threading' from '/usr/local/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/local/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
It hangs at RuntimeError: Connection Failure where I need to crtl+c to regain control.
Working wonderfully with the latest batch of commits. Thanks!
no worries m8.
Hi, Thanks for continuing and improving samsungctl - I'm looking forward to the increased number of available keys. I am currently getting this error when running the c611b77 commit of master:
python -m samsungctl --host 192.168.123.203 --port 8002 --method websocket KEY_HDMI error from callback <bound method RemoteWebsocket.on_open of <samsungctl.remote_websocket.RemoteWebsocket object at 0xf68872b0>>: on_open() missing 1 required positional argument: 'ws' Traceback (most recent call last): File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/samsungctl/samsungctl/__main__.py", line 206, in <module> main() File "/samsungctl/samsungctl/__main__.py", line 181, in main with Remote(config) as remote: File "/samsungctl/samsungctl/remote.py", line 13, in __init__ self.remote = RemoteWebsocket(config) File "/samsungctl/samsungctl/remote_websocket.py", line 50, in __init__ self.open() File "/samsungctl/samsungctl/remote_websocket.py", line 124, in open raise RuntimeError('Connection Failure') RuntimeError: Connection Failure error from callback <bound method RemoteWebsocket.on_message of <samsungctl.remote_websocket.RemoteWebsocket object at 0xf68872b0>>: on_message() missing 1 required positional argument: 'message' ^CException ignored in: <module 'threading' from '/usr/local/lib/python3.6/threading.py'> Traceback (most recent call last): File "/usr/local/lib/python3.6/threading.py", line 1294, in _shutdown t.join() File "/usr/local/lib/python3.6/threading.py", line 1056, in join self._wait_for_tstate_lock() File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt root@4ac25b2493d0:/samsungctl# cat ~/.samsungctl/token.txt root@4ac25b2493d0:/samsungctl#
The "error from callback <bound method RemoteWebsocket.on_open of <samsungctl.remote_websocket.RemoteWebsocket object at 0xf68872b0>>: on_open() missing 1 required positional argument: 'ws'" error appears before allowing the device on the TV. The "error from callback <bound method RemoteWebsocket.on_message of <samsungctl.remote_websocket.RemoteWebsocket object at 0xf68872b0>>: on_message() missing 1 required positional argument: 'message'" error appears after allowng the device on the TV. Nothing is being written to token.txt. I have tried with both python 2 and 3 and both exhibit the same issue, with 3 handling the crashes better.
TV info:
{"device":{"FrameTVSupport":"false","GamePadSupport":"true","ImeSyncedSupport":"true","OS":"Tizen","TokenAuthSupport":"true","VoiceSupport":"true","countryCode":"AU","description":"Samsung DTV RCR","developerIP":"0.0.0.0","developerMode":"0","duid":"uuid:f3955515-4088-483a-b1e5-d11a95d2a1a7","firmwareVersion":"Unknown","id":"uuid:f3955515-4088-483a-b1e5-d11a95d2a1a7","ip":"192.168.123.203","model":"17_KANTM_UHD","modelName":"UA65MU7000","name":"[TV] Samsung 7 Series (65)","networkType":"wired","resolution":"3840x2160","smartHubAgreement":"true","type":"Samsung SmartTV","udn":"uuid:f3955515-4088-483a-b1e5-d11a95d2a1a7","wifiMac":"68:27:37:e9:f9:02"},"id":"uuid:f3955515-4088-483a-b1e5-d11a95d2a1a7","isSupport":"{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"TokenAuthSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n","name":"[TV] Samsung 7 Series (65)","remote":"1.0","type":"Samsung SmartTV","uri":"http://192.168.123.203:8001/api/v2/","version":"2.0.25"}
Any help with this is greatly appreciated
EDIT for readability, pastebin link to info above