PCigales / DLNAPlayOn

A script in Python 3 to play, with control through a web interface, local and remote contents to a DLNA / UPnP renderer
GNU General Public License v3.0
16 stars 3 forks source link

No module named 'msvcrt' #3

Closed zoreu closed 2 years ago

zoreu commented 2 years ago

it's me again, is there a way to make playon.py for windows and linux? my kodi addon is not mirroring to tv because a module called: "msvcrt" is missing on android I need it to work on windows, linux and android

PCigales commented 2 years ago

The whole script would need to be ported to each other operating system as it relies on Windows specific modules or functions, but several classes can probably work on any platform. It therefore depends on what parts of the code you use. You can always try to remove, at the beginning of the file, the "import" instructions that make the execution fail.

To be more accurate in my answer, I would need to know how your addon makes use of the module. You could maybe publish it in your repository.

zoreu commented 2 years ago

I'm using the dlnacontroler class when I'm using the computer I send the addon

DLNARenderer Controller Instance = PlayOn.DLNAController()

zoreu commented 2 years ago

my addon - https://github.com/zoreu/developer my log - https://paste.kodi.tv/gewibapija

i have thid error: Error Type: <class 'ValueError'> Error Contents: _type_ 'v' not supported Traceback (most recent call last): File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.OnePlay.Matrix/default.py", line 3, in <module> plugin.run() File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.OnePlay.Matrix/libs/plugin.py", line 1865, in run start_dlna(url_dlna) File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.OnePlay.Matrix/libs/plugin.py", line 1541, in start_dlna from libs.dlna import PlayOn File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.OnePlay.Matrix/libs/dlna/PlayOn.py", line 35, in <module> import ctypes, ctypes.wintypes File "/data/user/0/org.xbmc.kodi/cache/apk/assets/python3.8/lib/python3.8/ctypes/wintypes.py", line 20, in <module> class VARIANT_BOOL(ctypes._SimpleCData): ValueError: _type_ 'v' not supported -->End of Python script error report<--

in plugin.py has:

https://pastecode.io/s/owvpf1cm

i already added getch module, but now i have problem with ctypes

on windows it works perfect but it doesn't work on kodi on the cell phone

https://i.imgur.com/gVzoM3h.jpg https://i.imgur.com/6965NVn.jpg https://i.imgur.com/oithnVK.jpg

to test go to oneplay -> TV AO VIVO -> SERVIDOR 1 -> select SEXY KPOP TV and press on the channel or select the right to show the mirror option (Espelhar na TV) only works on windows but not on mobile kodi

PCigales commented 2 years ago

As far as I remember, the class you instantiate needs Windows only if you request the controller to run on all interfaces (which is if you set ip to '0.0.0.0'). Otherwise, you should be able to remove the import wintypes at line 32, and also probably ctypes if needed. I have made some tests, if you stick to this class, you should not face any issue because of the removal of these modules. But CPython on Android has a lot of limitations, so you need to go on trying.

zoreu commented 2 years ago

I got it, removing the ctypes.wintypes dependency, instead I put it in the function

_ def retrieve_ips(): st = socket.socket(socket.AF_INET, socket.SOCKDGRAM) try: st.connect(('10.255.255.255', 1)) IP = st.getsockname()[0] except Exception: IP = '127.0.0.1' finally: st.close() IP = str(IP) IP = (IP,) return IP

my modified dlna with portable getch module - https://github.com/zoreu/pydlna