-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to set the (un)watched video status
- Loading branch information
1 parent
fe3d204
commit 58bf490
Showing
3 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json, sys | ||
import xbmc | ||
|
||
video_id = sys.argv[1] | ||
data_dir = sys.argv[2] | ||
|
||
if video_id is None or video_id in ("", "_TRAILER"): | ||
pass | ||
else: | ||
video_id = str(video_id) | ||
try: | ||
with open(f"{data_dir}/watched_list.json", "r", encoding="UTF-8") as file: | ||
f = json.loads(file.read()) | ||
except: | ||
f = [] | ||
|
||
if video_id in f: | ||
f.remove(video_id) | ||
else: | ||
f.append(video_id) | ||
|
||
try: | ||
with open(f"{data_dir}/watched_list.json", "w", encoding="UTF-8") as file: | ||
file.write(json.dumps(f)) | ||
except: | ||
pass | ||
|
||
xbmc.executebuiltin("Container.Refresh") |