Skip to content

Commit

Permalink
Merge pull request #2621 from realcopacetic/script.copacetic.helper-1…
Browse files Browse the repository at this point in the history
….0.18

[script.copacetic.helper] 1.1.1
  • Loading branch information
basrieter authored Jun 14, 2024
2 parents 1853cf9 + 067769a commit 819625e
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 136 deletions.
14 changes: 13 additions & 1 deletion script.copacetic.helper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ All code contained in this project is licensed under GPL 3.0.
* __jurialmunkey__ for all the best-practice code examples from [plugin.video.themoviedb.helper](https://github.com/jurialmunkey/plugin.video.themoviedb.helper) and forum support.

### Changelog
**.1.1.1**
- Fixed bug in previous version causing dark cropped clearlogos to always be served in certain scenarios

**.1.1.0**
- Cropper automatically disabled if animation transitions are disabled in Copacetic skin.
- Clearlogo cropper will resize larger crops to 1600x620 max, this is 2x the Kodi standard clearlogo requirement https://kodi.wiki/view/Artwork_types#clearlogo
- SlideshowMonitor() will now check for cropped clearlogos or crop them if no cropped version present
- Additional error handling for images

**1.0.18**
- Added subtitle_limiter() script, which sets subtitles to the first stream in the desired language if it's available and then toggles between this subtitle stream and 'off'. If the preferred language stream is not available it will toggle through all available subtitles instead.

**1.0.17**
- Parse args for script actions to enable values with special characters to be properly escaped from Kodi using '"$INFO[ListItem.Title]"'

Expand Down Expand Up @@ -41,7 +53,7 @@ All code contained in this project is licensed under GPL 3.0.
- Enhanced Slideshow_Monitor class so that it can now fetch fanarts from containers with plugin sources when they are available then use these fanarts in the custom background slideshow. In this way, you can use a custom path to populate a global custom fanart slideshow even without any content in your local library

**1.0.10**
- read_fanart() method added in 1.0.10 now triggers on services monitor initialise rather than the first time that the SlideShow monitor is run so it should display backgrounds slightly quicker
- fanart_read() method added in 1.0.10 now triggers on services monitor initialise rather than the first time that the SlideShow monitor is run so it should display backgrounds slightly quicker

**1.0.10**
- Custom path for Global slideshows can now be refreshed on first entry or on change of path without needing Kodi to restart https://github.com/realcopacetic/script.copacetic.helper/issues/6
Expand Down
2 changes: 1 addition & 1 deletion script.copacetic.helper/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<addon id="script.copacetic.helper" name="Copacetic Helper" version="1.0.17" provider-name="realcopacetic">
<addon id="script.copacetic.helper" name="Copacetic Helper" version="1.1.1" provider-name="realcopacetic">
<requires>
<import addon="xbmc.python" version="3.0.1" />
<import addon="script.module.pil" version="5.1.0" />
Expand Down
22 changes: 22 additions & 0 deletions script.copacetic.helper/resources/lib/script/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,28 @@ def shuffle_artist(**kwargs):
parent='shuffle_artist')


def subtitle_limiter(lang,**kwargs):
if condition('VideoPlayer.HasSubtitles'):
player = xbmc.Player()
subtitles = []
current_subtitle = player.getSubtitles()
subtitles = player.getAvailableSubtitleStreams()
if lang not in current_subtitle or condition('!VideoPlayer.SubtitlesEnabled'):
try:
index = subtitles.index(lang)
except ValueError as error:
log(
f'Subtitle Limiter: Error - Preferred subtitle stream ({lang}) not available, toggling through available streams instead --> {error}', force=True)
log_and_execute('Action(NextSubtitle)')
else:
player.setSubtitleStream(index)
log(f'Subtitle Limiter: Switching to subtitle stream {index} in preferred language: {lang}', force=True)
elif condition('VideoPlayer.SubtitlesEnabled'):
log_and_execute('Action(ShowSubtitles)')
else:
log('Subtitle Limiter: Error - Playing video has no subtitles', force=True)


def toggle_addon(id, **kwargs):
if condition(f'System.AddonIsEnabled({id})'):
json_call('Addons.SetAddonEnabled',
Expand Down
Loading

0 comments on commit 819625e

Please sign in to comment.