Skip to content

Instantly share code, notes, and snippets.

@henryjfry
henryjfry / player.py
Last active May 8, 2020 19:43
TMDB => Play4/get_collection_tv/build_details => /home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/player.py
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/player.py
def play(self, itemtype, tmdb_id, season=None, episode=None, force_dialog=False):
###########
# Attempt to play local file first
is_local = False
# if self.details and self.itemtype == 'movie':
# is_local = self.playmovie()
# if self.details and self.itemtype == 'episode':
# is_local = self.playepisode()
@henryjfry
henryjfry / container.py
Created February 19, 2020 18:40
Playlist/STRM better play command - TMDBHelper => /home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
##kodi-send --action='RunPlugin(plugin://plugin.video.themoviedb.helper?info=play2&type=episode&tmdb_id=95&season=1&episode=1)'
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
if self.params.get('info') == 'play2':
import os
addon_handle = self.handle
xbmc.log(str(xbmcgui.getCurrentWindowDialogId())+'===>TMDBHelper', level=xbmc.LOGNOTICE)
@henryjfry
henryjfry / play_base.py
Created February 18, 2020 17:52
OPENMETA - play_stream route ==> /home/osmc/.kodi/addons/plugin.video.openmeta/resources/lib/play_base.py
###
@plugin.route('/play_stream/<label>')
def play_stream(label):
import sys
import xbmcplugin
import xbmcgui
import os
addon_handle = int(sys.argv[1])
xbmc.log(str(xbmcgui.getCurrentWindowDialogId())+'===>OPENMETA', level=xbmc.LOGNOTICE)
@henryjfry
henryjfry / container.py
Last active February 17, 2020 09:25
TMDB => Container Alternate routes /home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/player.py
# return self.play_external(force_dialog=True) # Ask user to select a different player
###/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
elif self.params.get('info') == 'trakt_collection2':
items = TraktAPI(tmdb='tv', login=True).get_collection2('tv', utils.try_parse_int(self.params.get('page', 1)))
if self.params.get('info') == 'strm_pl':
# xbmc.log(str(xbmc.getInfoLabel('System.CurrentControl')) + 'CONTROL===>OPENINFO', level=xbmc.LOGNOTICE)
# xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
@henryjfry
henryjfry / kodi_sql.py
Last active February 13, 2024 19:49
KODI SQL
https://kodi.wiki/view/List_of_built-in_functions
https://kodi.wiki/view/Databases/MyVideos
https://www.reddit.com/r/Addons4Kodi/comments/c4szk4/next_playlist_next_up_episodes_playlist/
https://henryjfry.github.io/repository.nextup/repo/
import sqlite3
con = sqlite3.connect('/home/osmc/.kodi/userdata/Database/MyVideos116.db')
@henryjfry
henryjfry / TMDB.py
Last active February 26, 2020 02:27
get show id numbers = TMDB.py
import requests
import xml.etree.ElementTree as ET
import sys
_genreids = {
"Action": 28, "Adventure": 12, "Animation": 16, "Comedy": 35, "Crime": 80, "Documentary": 99, "Drama": 18,
"Family": 10751, "Fantasy": 14, "History": 36, "Horror": 27, "Kids": 10762, "Music": 10402, "Mystery": 9648,
"News": 10763, "Reality": 10764, "Romance": 10749, "Science Fiction": 878, "Sci-Fi & Fantasy": 10765, "Soap": 10766,
"Talk": 10767, "TV Movie": 10770, "Thriller": 53, "War": 10752, "War & Politics": 10768, "Western": 37}
@henryjfry
henryjfry / container.py
Last active September 15, 2021 20:36
TMDBHelper Library integration: ~/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
kodi-send --action='RunPlugin(plugin://plugin.video.themoviedb.helper?info=trakt_collection_tv)'
###~/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
def router(self):
# ROUTER LIST FUNCTIONS
if self.params.get('info') == 'stream':
from resources.lib.player import Player
xbmcplugin.setResolvedUrl(self.handle, True, xbmcgui.ListItem(path=str()))
params = self.params.copy()
@henryjfry
henryjfry / traktapi.py
Last active February 18, 2020 05:27
TMDBHelper Sync Trakt to library - /home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/traktapi.py
kodi-send --action='RunPlugin(plugin://plugin.video.themoviedb.helper?info=trakt_collection2)'
####/home/osmc/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py
def list_traktcollection2(self):
items = TraktAPI(tmdb='tv', login=True).get_collection2('tv', utils.try_parse_int(self.params.get('page', 1)))
###
def list_play(self):
if not self.params.get('type') or not self.params.get('tmdb_id'):
@clrung
clrung / clone_all_repos.sh
Last active December 11, 2023 14:34
Clones all repos in a GitHub organization
#!/bin/bash
# Usage: clone_all_repos.sh [organization] <output directory>
ORG=$1
PER_PAGE=100
GIT_OUTPUT_DIRECTORY=${2:-"/tmp/${ORG}_repos"}
if [ -z "$GITHUB_TOKEN" ]; then
echo -e "Variable GITHUB_TOKEN isn't set! Please specify your GitHub token.\n\nMore info: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/"
exit 1
@henryjfry
henryjfry / context3.py
Created January 19, 2020 13:07
Openmeta + Context menu - TMDB Helper ~/.kodi/addons/plugin.video.openmeta/context3.py
sudo systemctl stop mediacenter
##addon.xml
<item library="context3.py">
<label>TMDB Helper - Play</label>
<visible>String.IsEqual(ListItem.dbtype,movie) | String.IsEqual(ListItem.dbtype,episode)</visible>
</item>
##addon.xml