Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin.video.pt] v0.1.2 #4567

Open
wants to merge 1 commit into
base: matrix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugin.video.pt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This is an addon for [Kodi](http://kodi.tv) mediacenter to play and browse Peertube servers, channels and files.

**Changes**
- v0.1.2 Add error correction for raspberry pi based systems to make app usable.

**Installation**
An installable .zip can be downloaded from releases tab.
Do **not** try to install a .zip generated by GitHub. You need the plugin folder in the zip file (plugin.video.pt) for it to work. Otherwise Kodi will tell you the file structure is wrong and the install will fail.

Expand All @@ -14,4 +18,4 @@ Source: This plugin was inspired by this tutorial plugin: https://github.com/rom
## Licenses:

* Code: [GPL v.3](http://www.gnu.org/copyleft/gpl.html)
* Images: [Creative Commons Attribution-Share Alike 3.0](http://creativecommons.org/licenses/by-sa/3.0/us/).
* Images: [Creative Commons Attribution-Share Alike 3.0](http://creativecommons.org/licenses/by-sa/3.0/us/).
2 changes: 1 addition & 1 deletion plugin.video.pt/addon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.pt"
version="0.1.0"
version="0.1.2"
name="Next Gen Peertube Addon"
provider-name="Haui111">
<requires>
Expand Down
12 changes: 9 additions & 3 deletions plugin.video.pt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ def get_url(**kwargs):
def get_instances():
filename = "instances.json"
if not os.path.exists(USERDATA_PATH):
os.makedirs(USERDATA_PATH)
try:
os.makedirs(USERDATA_PATH)
except:
print("Could not write %s" % USERDATA_PATH)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use print functions. Use xbmc.log instead

FILE_PATH = os.path.join(USERDATA_PATH, filename)
if not xbmcvfs.exists(FILE_PATH):
print("No file, requesting new data!")
request = requests.get('https://instances.joinpeertube.org/api/v1/instances/hosts?count=1000&start=0&sort=createdAt')
r = request.json()
with xbmcvfs.File(FILE_PATH) as instances_file:
instances_file.write(json.dumps(r, ensure_ascii=False, indent=4))
try:
with xbmcvfs.File(FILE_PATH) as instances_file:
instances_file.write(json.dumps(r, ensure_ascii=False, indent=4))
except:
print("Could not write %s" % FILE_PATH)
else:
with xbmcvfs.File(FILE_PATH) as instances_file:
r = json.load(instances_file)
Expand Down
Loading