18 Commits

Author SHA1 Message Date
mcarlton00
569462f755 Merge pull request #177 from jellyfin/prepare-0.5.2
Some checks failed
Build JellyCon / build (py2) (push) Has been cancelled
Build JellyCon / build (py3) (push) Has been cancelled
Prepare for release v0.5.2
2022-06-20 09:32:07 -04:00
jellyfin-bot
658050548c bump version to 0.5.2 2022-06-20 13:25:17 +00:00
mcarlton00
4d635f6eb4 Merge pull request #176 from mcarlton00/external-subs-10.8
Download all external subs when playback starts
2022-06-20 09:24:14 -04:00
mcarlton00
a0b1e9177b Merge branch 'master' into external-subs-10.8 2022-06-19 16:01:12 -04:00
Matt
7a1a7843e6 Download all external subs when playback starts 2022-06-19 15:55:46 -04:00
mcarlton00
66d4e02024 Merge pull request #174 from jellyfin/prepare-0.5.1
Some checks failed
Build JellyCon / build (py2) (push) Has been cancelled
Build JellyCon / build (py3) (push) Has been cancelled
Prepare for release v0.5.1
2022-06-17 21:14:02 -04:00
jellyfin-bot
04a46f0cd9 bump version to 0.5.1 2022-06-18 01:11:55 +00:00
mcarlton00
4e0ac5330f Merge pull request #170 from nitschis/master
Update README.md
2022-06-17 19:03:45 -04:00
mcarlton00
32288aba97 Apply suggestions from code review 2022-06-17 19:03:32 -04:00
mcarlton00
801f119a5c Merge pull request #173 from mcarlton00/music-play-options
Add context menu play options for music
2022-06-16 21:39:30 -04:00
Matt
567a02872b Recursively play tracks of artists 2022-06-16 20:33:40 -04:00
Matt
cfc19cafc5 Add context menu play options for music 2022-06-16 19:47:11 -04:00
mcarlton00
44823f5043 Merge pull request #172 from mcarlton00/i-hate-dates
Do all date comparisons in UTC
2022-06-16 19:45:16 -04:00
Matt
bad5f8e561 Remove unnecessary import 2022-06-16 19:38:15 -04:00
Matt
075e1e8974 Move current date calculation to a function 2022-06-16 18:24:16 -04:00
Matt
06f78ce620 Do all date calculations in UTC 2022-06-16 18:15:40 -04:00
nitschis
cce9acb182 Update README.md 2022-06-15 23:01:17 +02:00
nitschis
048b8f0385 Update README.md 2022-06-15 06:04:00 +02:00
7 changed files with 107 additions and 80 deletions

View File

@@ -1,6 +1,47 @@
# JellyCon
JellyCon is a lightweight Kodi addon that lets you browse and play media files from your Jellyfin server directly within the Kodi interface.
JellyCon is a lightweight Kodi add-on that lets you browse and play media files directly from your Jellyfin server within the Kodi interface. It can be thought of as a thin frontend for a Jellyfin server.
JellyCon can be used with Movie, TV Show, Music Video, and Music libraries, in addition to viewing LiveTV from the server. It can easily switch between multiple user accounts at will. It's easy to integrate with any customizable Kodi skin with a large collection of custom menus. Media items are populated from the server dynamically, and menu speed will vary based on local device speed.
## Installation
#### 1. Adding the Jellyfin repository
https://jellyfin.org/docs/general/clients/kodi.html#install-add-on-repository
#### 2. Install JellyCon Add-on
- From within Kodi, navigate to "Add-on Browser"
- Select "Install from Repository"
- Choose "Kodi Jellyfin Add-ons", followed by "Video Add-ons"
- Select the JellyCon add-on and choose install
#### 3. Login
- Within a few seconds after the installation you should be prompted for your server details.
- If a Jellyfin server is detected on your local network, it will displayed in a dialog. Otherwise, you will be prompted to enter the URL of your Jellyfin server
- If Quick Connect is enabled in the server, a code will be displayed that you can use to log in via Quick Connect in the web UI or a mobile app.
- If Quick Connect is not enabled, or if you select the "Manual Login" button, you will be able to select a user from the list, or manually login using your username and password.
## Configuration
#### Configuring Home
Many Kodi skins allow for customizing of the home menu with custom nodes and widgets. However, all of these use slightly different layouts and terminology. Rather than a step by step guide, this section serves as an barebones introduction to customizing a skin.
Examples
If you would like a link on the home screen to open a library in your Jellyfin server called "Kid's Movies", you would point the menu item to the path: Add-On -> Video Add-On -> JellyCon -> Jellyfin Libraries -> Kid's Movies -> Create menu item to here.
Beyond just modifying where the home menu headers go, many skins also allow you to use widgets. Widgets help populate the home screen with data, often the posters of media in the selected image. If you would like to display the most recent movies across all of your Jellyfin libraries on the home screen, the path would be: Add-On -> Video Add-On -> JellyCon -> Global Lists -> Movies -> Movies - Recently Added (20) -> Use as widget
Another common use case of widgets would be to display the next available episodes of shows that you may be watching. As above, this can be done both with individual libraries or with all libraries combined:
Add-On -> Video Add-On -> JellyCon -> Jellyfin Libraries -> Anime -> Anime - Next Up (20) -> Use as widget
Add-On -> Video Add-On -> JellyCon -> Global Lists -> TV Shows -> TV Shows - Next Up (20) -> Use as widget
## License

View File

@@ -1,60 +1,8 @@
version: '0.5.0'
version: '0.5.2'
changelog: |-
New features and improvements
-----------------------------
+ Make sure manual login shows when connecting to a 10.7 server (#167) @mcarlton00
+ Add genres and alpha picker to music (#161) @mcarlton00
+ Add button to the bitrate selector (#160) @mcarlton00
+ Add quick connect authentication (#159) @mcarlton00
Bug Fixes
---------
+ Fix playing all files (#162) @mcarlton00
+ Ensure server is present in API requests (#157) @mcarlton00
+ Fix errors when stopping transcoded playback (#156) @mcarlton00
+ Fix content update checks (#155) @mcarlton00
+ Fix stale data after storage migration (#153) @mcarlton00
+ Fix legacy skin shortcuts (#150) @mcarlton00
+ Use timezone when calculating last activity date (#147) @mcarlton00
+ Fix live tv playback (#144) @mcarlton00
+ Fix browsing the Live TV programs menu (#145) @mcarlton00
+ Force login if no saved credentials (#139) @mcarlton00
+ Fix movie recommendations (#132) @mcarlton00
+ Fix remote control (#134) @mcarlton00
+ Don't throw errors when non-JellyCon content is playing (#135) @mcarlton00
+ Fallback to empty lists instead of failing (#136) @mcarlton00
+ Make widgets respect episode name format setting (#137) @mcarlton00
+ Make requests respect the verify certificate setting (#131) @mcarlton00
+ Fix manual user login (#123) @mcarlton00
+ Rework user data storage (#119) @mcarlton00
Code or Repo Maintenance
------------------------
+ Use offscreen option when generating all listitems (#168) @mcarlton00
+ Remove safe delete code (#166) @mcarlton00
+ Address flake8 warnings (#165) @mcarlton00
+ Simplify url param dict definitions (#164) @mcarlton00
+ Optimize loops while building menus (#163) @mcarlton00
+ Verify certificates by default (#154) @mcarlton00
+ Rework live tv playback (#148) @mcarlton00
+ Remove trakt integration (#133) @mcarlton00
+ Copy translate_path from Jf4Kodi, fix LazyLogger (#130) @oddstr13
+ Rework the network stack (#124) @mcarlton00
+ Rework user data storage (#119) @mcarlton00
+ Code reorganizing (#111) @mcarlton00
+ Remove unused and commented out code (#109) @mcarlton00
CI & build changes
------------------
+ Bump release-drafter/release-drafter from 5.19.0 to 5.20.0 (#152) @dependabot
+ Bump github/codeql-action from 1 to 2 (#143) @dependabot
+ Bump actions/upload-artifact from 2 to 3 (#141) @dependabot
+ Bump release-drafter/release-drafter from 5.18.1 to 5.19.0 (#138) @dependabot
+ Bump actions/checkout from 2 to 3 (#127) @dependabot
+ Bump actions/setup-python from 2 to 3 (#126) @dependabot
+ Bump release-drafter/release-drafter from 5.17.5 to 5.18.1 (#122) @dependabot
+ Bump release-drafter/release-drafter from 5.15.0 to 5.17.5 (#118) @dependabot
+ Bump burnett01/rsync-deployments from 5.1 to 5.2 (#113) @dependabot
+ Download all external subs when playback starts (#176) @mcarlton00
dependencies:
py2:
- addon: 'xbmc.python'

View File

@@ -348,7 +348,7 @@ def show_menu(params):
li.setProperty('menu_id', 'play')
action_items.append(li)
if result["Type"] in ["Season", "MusicAlbum", "Playlist"]:
if result["Type"] in ["Season", "MusicArtist", "MusicAlbum", "Playlist"]:
li = xbmcgui.ListItem(translate_string(30317), offscreen=True)
li.setProperty('menu_id', 'play_all')
action_items.append(li)
@@ -358,7 +358,7 @@ def show_menu(params):
li.setProperty('menu_id', 'transcode')
action_items.append(li)
if result["Type"] in ["Episode", "Movie", "Music", "Video", "Audio"]:
if result["Type"] in ["Episode", "Movie", "Music", "Video", "Audio", "MusicArtist", "MusicAlbum"]:
li = xbmcgui.ListItem(translate_string(30402), offscreen=True)
li.setProperty('menu_id', 'add_to_playlist')
action_items.append(li)

View File

@@ -4,10 +4,11 @@ import sys
from six.moves.urllib.parse import quote
from datetime import datetime
from dateutil import tz
import xbmcgui
from .utils import datetime_from_string, get_art_url, image_url, kodi_version
from .utils import datetime_from_string, get_art_url, image_url, get_current_datetime
from .lazylogger import LazyLogger
from six import ensure_text
@@ -402,12 +403,15 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F
end_time = datetime_from_string(item_details.program_end_date)
duration = (end_time - start_time).total_seconds()
time_done = (datetime.now().astimezone() - start_time).total_seconds()
now = get_current_datetime()
time_done = (now - start_time).total_seconds()
percentage_done = (float(time_done) / float(duration)) * 100.0
capped_percentage = int(percentage_done)
start_time_string = start_time.strftime("%H:%M")
end_time_string = end_time.strftime("%H:%M")
# Convert dates to local timezone for display
local = tz.tzlocal()
start_time_string = start_time.astimezone(local).strftime("%H:%M")
end_time_string = end_time.astimezone(local).strftime("%H:%M")
item_details.duration = int(duration)
item_details.resume_time = int(time_done)

View File

@@ -15,7 +15,7 @@ from six.moves.urllib.parse import urlencode
from .jellyfin import api
from .lazylogger import LazyLogger
from .dialogs import ResumeDialog
from .utils import send_event_notification, convert_size, get_device_id, translate_string, load_user_details, translate_path
from .utils import send_event_notification, convert_size, get_device_id, translate_string, load_user_details, translate_path, get_jellyfin_url, download_external_sub
from .kodi_utils import HomeWindow
from .datamanager import clear_old_cache_data
from .item_functions import extract_item_info, add_gui_item, get_art
@@ -254,13 +254,18 @@ def play_file(play_info):
return
# if this is a season, playlist or album then play all items in that parent
if result.get("Type") in ["Season", "MusicAlbum", "Playlist"]:
if result.get("Type") in ["Season", "MusicArtist", "MusicAlbum", "Playlist"]:
log.debug("PlayAllFiles for parent item id: {0}".format(item_id))
url = ('/Users/{}/items'.format(api.user_id) +
'?ParentId=%s' +
'&Fields=MediaSources' +
'&format=json')
url = url % (item_id,)
url_root = '/Users/{}/Items'.format(api.user_id)
# Look specifically for episodes or audio files
url_params = {
'ParentId': item_id,
'Fields': 'MediaSources',
'IncludeItemTypes': 'Episode,Audio',
'Recursive': True
}
url = get_jellyfin_url(url_root, url_params)
result = api.get(url)
log.debug("PlayAllFiles items: {0}".format(result))
@@ -838,12 +843,18 @@ def external_subs(media_source, list_item, item_id):
language = stream.get('Language', '')
codec = stream.get('Codec', '')
url_root = '{}/Videos/{}/{}/Subtitles/{}'.format(server, item_id, source_id, index)
url = '{}{}'.format(server, stream.get('DeliveryUrl'))
if language:
url = '{}/0/Stream.{}.{}?api_key={}'.format(
url_root, language, codec, token)
'''
Starting in 10.8, the server no longer provides language
specific download points. We have to download the file
and name it with the language code ourselves so Kodi
will parse it correctly
'''
subtitle_file = download_external_sub(language, codec, url)
else:
url = '{}/0/Stream.{}?api_key={}'.format(url_root, codec, token)
# If there is no language defined, we can go directly to the server
subtitle_file = url
default = ""
if stream['IsDefault']:
@@ -855,7 +866,7 @@ def external_subs(media_source, list_item, item_id):
sub_name = '{} ( {} ) {} {}'.format(language, codec, default, forced)
sub_names.append(sub_name)
externalsubs.append(url)
externalsubs.append(subtitle_file)
if len(externalsubs) == 0:
return

View File

@@ -13,7 +13,7 @@ import xbmc
from .kodi_utils import HomeWindow
from .jellyfin import API
from .lazylogger import LazyLogger
from .utils import datetime_from_string, translate_string, save_user_details, load_user_details
from .utils import datetime_from_string, translate_string, save_user_details, load_user_details, get_current_datetime
from .dialogs import QuickConnectDialog
log = LazyLogger(__name__)
@@ -368,6 +368,7 @@ def create_user_listitem(server, user):
Create a user listitem for the user selection screen
'''
config = user.get("Configuration")
now = get_current_datetime()
if config is not None:
name = user.get("Name")
time_ago = ""
@@ -375,7 +376,7 @@ def create_user_listitem(server, user):
# Calculate how long it's been since the user was last active
if last_active:
last_active_date = datetime_from_string(last_active)
ago = datetime.now().astimezone() - last_active_date
ago = now - last_active_date
# Check days
if ago.days > 0:
time_ago += ' {}d'.format(ago.days)

View File

@@ -15,6 +15,7 @@ import time
import math
import os
import hashlib
import requests
from datetime import datetime
from dateutil import tz
import re
@@ -104,14 +105,20 @@ def datetime_from_string(time_string):
# https://bugs.python.org/issue27400
dt = datetime(*(time.strptime(time_string, "%Y-%m-%dT%H:%M:%S.%f %Z")[0:6]))
# Convert server dates from UTC to local time
# Dates received from the server are in UTC, but parsing them results in naive objects
utc = tz.tzutc()
local = tz.tzlocal()
utc_dt = dt.replace(tzinfo=utc)
local_dt = utc_dt.astimezone(local)
return local_dt
return utc_dt
def get_current_datetime():
# Get current time in UTC
now = datetime.utcnow()
utc = tz.tzutc()
now_dt = now.replace(tzinfo=utc)
return now_dt
def convert_size(size_bytes):
@@ -357,3 +364,18 @@ def translate_path(path):
return xbmcvfs.translatePath(path)
else:
return xbmc.translatePath(path)
def download_external_sub(language, codec, url):
# Download the subtitle file
r = requests.get(url)
r.raise_for_status()
# Write the subtitle file to the local filesystem
file_name = 'Stream.{}.{}'.format(language, codec)
file_path = py2_decode(translate_path('special://temp/{}'.format(file_name)))
with open(file_path, 'wb') as f:
f.write(r.content)
return file_path