Skip to content

Commit

Permalink
python2 and removed netifaces dependency for pi compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
reinzor committed Jan 13, 2019
1 parent 927763d commit 489d76d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
tqdm==4.26.0
pymediainfo==2.3.0
colorlog==3.1.4
netifaces==0.10.7
tornado==5.1.1
2 changes: 2 additions & 0 deletions src/videowall/networking/networking_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def receive_server_play_broadcast(self):
# May raise a socket.timeout exception
data, _ = self._server_play_broadcast_socket.recvfrom(self._buffer_size)

print(data)

try:
msg = ServerPlayBroadcastMessage(**json.loads(data.decode("utf-8")))
except Exception as e:
Expand Down
13 changes: 9 additions & 4 deletions src/videowall/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import argparse
import base64
import netifaces as ni
import fcntl
import os
import re
import socket
import string
import struct


def to_dict(obj):
Expand Down Expand Up @@ -70,11 +70,16 @@ def validate_positive_or_zero_int_argument(value):


def get_ifnames():
return ni.interfaces()
return os.listdir('/sys/class/net/')


def ip_from_ifname(ifname):
return ni.ifaddresses(ifname)[ni.AF_INET][0]['addr']
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])


def get_unique_filename(path):
Expand Down
2 changes: 1 addition & 1 deletion test/test_media_manager_server
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import logging
from argparse import ArgumentParser

Expand Down
2 changes: 1 addition & 1 deletion test/test_networking_client
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python

import logging
from argparse import ArgumentParser
Expand Down
2 changes: 1 addition & 1 deletion test/test_networking_server
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import json
import logging
import time
Expand Down

0 comments on commit 489d76d

Please sign in to comment.