Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
keifufu committed May 10, 2023
1 parent 4c7a201 commit acc18b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# OBS Adapter for WebNowPlaying-Redux
A OBS script to display information from [WebNowPlaying-Redux](https://github.com/keifufu/WebNowPlaying-Redux)
A OBS script to display information from [WebNowPlaying-Redux](https://github.com/keifufu/WebNowPlaying-Redux)
It also supports a lot of desktop players! Read more [here](https://github.com/keifufu/WebNowPlaying-Redux/blob/main/NativeAPIs.md).

![widgets](./images/widgets.jpg)

Expand All @@ -23,5 +24,6 @@ If you delete a source, it will stay deleted until you click "Create Sources" ag
- Open cmd and run `pip install --upgrade pywnp`

# Known Issues
- Reloading the script will cause it to spam errors.
If you need to reload it for some reason, please restart OBS.
- Reloading the script might cause it to spam errors or not work at all.
If you need to reload it for some reason, restart OBS.
If you DID reload the script and it doesn't work anymore even after restarting OBS, restart your computer.
10 changes: 7 additions & 3 deletions wnp-obs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from threading import Thread
import urllib.request, json
from pywnp import WNPRedux
import obspython as obs
import urllib.request, json
import time

# WNP Variables
player_name = 'N/A'
Expand Down Expand Up @@ -63,11 +65,13 @@ def script_update(settings):
def script_load(settings):
def logger(type, message):
print(f'WNP - {type}: {message}')
WNPRedux.start(6534, 6535, '1.2.0', logger)
print('load')
WNPRedux.start(6534, '2.0.0', logger)
obs.timer_add(update, 250)

def script_unload():
WNPRedux.stop()
Thread(target=WNPRedux.stop).start()
time.sleep(1) # sorry but this at least prevents reloading the script breaking it
obs.timer_remove(update)

def update():
Expand Down

0 comments on commit acc18b1

Please sign in to comment.