Skip to content

Commit

Permalink
Add config option and ability to shrink subtitle time (#10)
Browse files Browse the repository at this point in the history
* Add configuration option to prevent opening YesNo dialog
* Add ability to shrink subtitle time if it overlaps the next line
  • Loading branch information
bkiziuk authored Jan 18, 2019
1 parent a257cd7 commit f66840d
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 80 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ It allows:
- support subtitles input formats: microDVD, SubRip, MPL2 and TMP
- allows to filter subtitle contents based on various Regular Expression type criteria, which gives ability to remove unwanted texts, such as Hearing Impaired tags, advertisements, credits, etc.
- allows to increase subtitle display time to match at least minimum calculated time based on subtitle text length, taking into account start time of the next subtitle line
- allows to shrink subtitle display time to avoid overlapping the next subtitle line

3) detecting if video was removed from local storage and removing any related subtitle files
7 changes: 5 additions & 2 deletions 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="service.subsmangler" name="Subtitles Mangler" version="1.1.0" provider-name="bkiziuk">
<addon id="service.subsmangler" name="Subtitles Mangler" version="1.2.0" provider-name="bkiziuk">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
</requires>
Expand Down Expand Up @@ -31,7 +31,10 @@
<disclaimer lang="hu_HU">Egy teljeskörű felirat asszisztens</disclaimer>
<disclaimer lang="pl_PL">Wszechstronny asystent napisów</disclaimer>
<disclaimer lang="sk_SK">Kompletný sprievodca titukly</disclaimer>
<news>v1.1.0 (2018-10-27)
<news>v1.2.0 (2019-01-18)
- add configuration option to prevent showing confirmation dialog if no subtitles file was downloaded
- add ability to shrink subtitle time if it overlaps the next subtitle
v1.1.0 (2018-10-27)
- implement context menu for easier management of 'noautosubs' file/extension
- change default logging destination to separate log file
- decrease housekeeping timer only if player is idle
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.2.0 (2019-01-18)
- add configuration option to prevent showing confirmation dialog if no subtitles file was downloaded
- add ability to shrink subtitle time if it overlaps the next subtitle
v1.1.0 (2018-10-27)
- implement context menu for easier management of 'noautosubs' file/extension
- change default logging destination to separate log file
Expand Down
12 changes: 10 additions & 2 deletions resources/language/resource.language.cs_cz/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ msgid "Include subtitles already found on disk"
msgstr "Obsahuje titulky již nalezené na disku"

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr "Nevyvolat dialog pokud jsou nalezené nezpracované titulky"

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr "Nevyvolávat dialog potvrzení pokud nejsou nalezeny stáhnuté titulky"

msgctxt "#32020"
msgid "Logging level"
msgstr "Úroveň logů"
Expand Down Expand Up @@ -106,7 +110,7 @@ msgstr "Samostatný soubor logů(smangler.log)"

msgctxt "#32033"
msgid "Show 'noautosubs' context menu item"
msgstr ""
msgstr "Ukázat 'noautosubs' context menu"

msgctxt "#32040"
msgid "No new subtitles file has been detected."
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr "Nastavit čas zobrazení tituklů"

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr "Zmenšit přerývající se čas titulků"

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr "Hledání souborů titulků"
Expand Down
14 changes: 11 additions & 3 deletions resources/language/resource.language.de_de/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ msgid "Include subtitles already found on disk"
msgstr "füge Untertitel hinzu, welche bereits auf der Festplatte vorhanden sind"

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr "das Suchfenster nicht anzeigen, wenn lokale unverarbeitete Untertitel vorhanden sind"

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr "Wenn keine heruntergeladenen Untertitel gefunden werden rufe keinen Bestätigungsdialog auf"

msgctxt "#32020"
msgid "Logging level"
msgstr "Protokollierungsstufe"
Expand Down Expand Up @@ -106,7 +110,7 @@ msgstr "eine separate Protokolldatei (smangler.log)"

msgctxt "#32033"
msgid "Show 'noautosubs' context menu item"
msgstr ""
msgstr "Anzeigen von 'noautosubs" im Kontextmenü"

msgctxt "#32040"
msgid "No new subtitles file has been detected."
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr "Anpassung der Anzeigezeit der Untertitel"

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr "Verkürzen der überlappenden Untertitelzeit"

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr "Nach Untertiteldateien suchen"
Expand Down Expand Up @@ -246,4 +254,4 @@ msgstr "'noautosubs' Datei IST AKTIV fuer Ordner:"

msgctxt "#32108"
msgid "'noautosubs' file IS CLEARED for folder:"
msgstr "'noautosubs' Datei IST GELOESCHT fuer Ordner:""
msgstr "'noautosubs' Datei IST GELOESCHT fuer Ordner:"
10 changes: 9 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ msgid "Include subtitles already found on disk"
msgstr ""

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr ""

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr ""

msgctxt "#32020"
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr ""

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr ""

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr ""
Expand Down
12 changes: 10 additions & 2 deletions resources/language/resource.language.hu_hu/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ msgid "Include subtitles already found on disk"
msgstr "Csatolt felirat található a lemezen"

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr "Ne indítsa a folyamatot ha helyi nem feldolgozott feliratot talált"

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr "Ne hozza fel a megerõsítõ ablakot, ha a letöltött felirat fájlok nem találhatóak"

msgctxt "#32020"
msgid "Logging level"
msgstr "Logolási szint"
Expand Down Expand Up @@ -106,7 +110,7 @@ msgstr "Egyedi lg fájl (smangler.log)"

msgctxt "#32033"
msgid "Show 'noautosubs' context menu item"
msgstr ""
msgstr "Mutassa a 'noautosubs' menü tartalmat"

msgctxt "#32040"
msgid "No new subtitles file has been detected."
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr "Javítsa a felirat megjelenítési időt"

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr "Felirat átfedési idõ csökkentése"

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr "Felirat fájlok keresése"
Expand Down
10 changes: 9 additions & 1 deletion resources/language/resource.language.pl_pl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ msgid "Include subtitles already found on disk"
msgstr "Konwertuj napisy już istniejące na dysku"

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr "Nie pokazuj okna wyszukiwania jeśli istnieją lokalne nieprzetworzone napisy"

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr "Nie pokazuj okna potwierdzenia jeśli nie znaleziono pobranych napisów"

msgctxt "#32020"
msgid "Logging level"
msgstr "Poziom logowania zdarzeń"
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr "Koryguj czas wyświetlania napisów"

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr "Skracaj czas napisów zachodzących na siebie"

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr "Poszukiwanie plików z napisami"
Expand Down
12 changes: 10 additions & 2 deletions resources/language/resource.language.sk_sk/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ msgid "Include subtitles already found on disk"
msgstr "Obsahuje titulky už nájdené na disku"

msgctxt "#32013"
msgid "Don't invoke dialog if local unprocessed subs are found"
msgid "Don't invoke search dialog if local unprocessed subs are found"
msgstr "Nevyvolať dialóg ak sú nájdené nespracované titulky"

msgctxt "#32014"
msgid "Don't invoke confirmation dialog if downloaded subs are not found"
msgstr "Nevyvolávať dialóg potvrdenie pokiaľ nie sú nájdené stiahnuté titulky"

msgctxt "#32020"
msgid "Logging level"
msgstr "Úroveň logů"
Expand Down Expand Up @@ -106,7 +110,7 @@ msgstr "Samostatný súbor logov (smangler.log)"

msgctxt "#32033"
msgid "Show 'noautosubs' context menu item"
msgstr ""
msgstr "Ukázať 'noautosubs' context menu"

msgctxt "#32040"
msgid "No new subtitles file has been detected."
Expand Down Expand Up @@ -204,6 +208,10 @@ msgctxt "#32081"
msgid "Adjust subtitle display time"
msgstr "Nastaviť čas zobrazenia tituklů"

msgctxt "#32082"
msgid "Shrink overlapping subtitle time"
msgstr "Zmenšiť přerývající sa čas titulkov"

msgctxt "#32090"
msgid "Scanning for subtitle files"
msgstr "Hledání souborů titulků"
Expand Down
50 changes: 28 additions & 22 deletions resources/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def GetSettings():
global setting_PauseOnConversion
global setting_AutoInvokeSubsDialog
global setting_NoAutoInvokeIfLocalUnprocSubsFound
global setting_NoConfirmationInvokeIfDownloadedSubsNotFound
global setting_AutoUpdateDef
global setting_SeparateLogFile
global setting_AutoRemoveOldSubs
Expand All @@ -120,9 +121,11 @@ def GetSettings():
global setting_RemoveUnprocessedSubs
global setting_SimulateRemovalOnly
global setting_AdjustSubDisplayTime
global setting_FixOverlappingSubDisplayTime

setting_AutoInvokeSubsDialog = GetBool(__addon__.getSetting("AutoInvokeSubsDialog"))
setting_NoAutoInvokeIfLocalUnprocSubsFound = GetBool(__addon__.getSetting("NoAutoInvokeIfLocalUnprocSubsFound"))
setting_NoConfirmationInvokeIfDownloadedSubsNotFound = GetBool(__addon__.getSetting("NoConfirmationInvokeIfDownloadedSubsNotFound"))
setting_ShowNoautosubsContextItem = GetBool(__addon__.getSetting("ShowNoautosubsContextItem"))
setting_ConversionServiceEnabled = GetBool(__addon__.getSetting("ConversionServiceEnabled"))
setting_AlsoConvertExistingSubtitles = GetBool(__addon__.getSetting("AlsoConvertExistingSubtitles"))
Expand All @@ -134,6 +137,7 @@ def GetSettings():
setting_RemoveCCmarks = GetBool(__addon__.getSetting("RemoveCCmarks"))
setting_RemoveAds = GetBool(__addon__.getSetting("RemoveAdds"))
setting_AdjustSubDisplayTime = GetBool(__addon__.getSetting("AdjustSubDisplayTime"))
setting_FixOverlappingSubDisplayTime = GetBool(__addon__.getSetting("FixOverlappingSubDisplayTime"))
setting_PauseOnConversion = GetBool(__addon__.getSetting("PauseOnConversion"))
setting_BackupOldSubs = GetBool(__addon__.getSetting("BackupOldSubs"))
setting_AutoRemoveOldSubs = GetBool(__addon__.getSetting("AutoRemoveOldSubs"))
Expand All @@ -145,28 +149,30 @@ def GetSettings():
setting_SeparateLogFile = int(__addon__.getSetting("SeparateLogFile"))

Log("Reading settings.", xbmc.LOGINFO)
Log("Setting: AutoInvokeSubsDialog = " + str(setting_AutoInvokeSubsDialog), xbmc.LOGINFO)
Log(" NoAutoInvokeIfLocalUnprocSubsFound = " + str(setting_NoAutoInvokeIfLocalUnprocSubsFound), xbmc.LOGINFO)
Log(" ShowNoautosubsContextItem = " + str(setting_ShowNoautosubsContextItem), xbmc.LOGINFO)
Log(" ConversionServiceEnabled = " + str(setting_ConversionServiceEnabled), xbmc.LOGINFO)
Log(" AlsoConvertExistingSubtitles = " + str(setting_AlsoConvertExistingSubtitles), xbmc.LOGINFO)
Log(" SubsFontSize = " + str(setting_SubsFontSize), xbmc.LOGINFO)
Log(" ForegroundColor = " + str(setting_ForegroundColor), xbmc.LOGINFO)
Log(" BackgroundColor = " + str(setting_BackgroundColor), xbmc.LOGINFO)
Log(" BackgroundTransparency = " + str(setting_BackgroundTransparency), xbmc.LOGINFO)
Log(" MaintainBiggerLineSpacing = " + str(setting_MaintainBiggerLineSpacing), xbmc.LOGINFO)
Log(" RemoveCCmarks = " + str(setting_RemoveCCmarks), xbmc.LOGINFO)
Log(" RemoveAds = " + str(setting_RemoveAds), xbmc.LOGINFO)
Log(" AdjustSubDisplayTime = " + str(setting_AdjustSubDisplayTime), xbmc.LOGINFO)
Log(" PauseOnConversion = " + str(setting_PauseOnConversion), xbmc.LOGINFO)
Log(" BackupOldSubs = " + str(setting_BackupOldSubs), xbmc.LOGINFO)
Log(" AutoRemoveOldSubs = " + str(setting_AutoRemoveOldSubs), xbmc.LOGINFO)
Log(" RemoveSubsBackup = " + str(setting_RemoveSubsBackup), xbmc.LOGINFO)
Log(" RemoveUnprocessedSubs = " + str(setting_RemoveUnprocessedSubs), xbmc.LOGINFO)
Log(" SimulateRemovalOnly = " + str(setting_SimulateRemovalOnly), xbmc.LOGINFO)
Log(" AutoUpdateDef = " + str(setting_AutoUpdateDef), xbmc.LOGINFO)
Log(" LogLevel = " + str(setting_LogLevel), xbmc.LOGINFO)
Log(" SeparateLogFile = " + str(setting_SeparateLogFile), xbmc.LOGINFO)
Log("Setting: AutoInvokeSubsDialog = " + str(setting_AutoInvokeSubsDialog), xbmc.LOGINFO)
Log(" NoAutoInvokeIfLocalUnprocSubsFound = " + str(setting_NoAutoInvokeIfLocalUnprocSubsFound), xbmc.LOGINFO)
Log(" NoConfirmationInvokeIfDownloadedSubsNotFound = " + str(setting_NoConfirmationInvokeIfDownloadedSubsNotFound), xbmc.LOGINFO)
Log(" ShowNoautosubsContextItem = " + str(setting_ShowNoautosubsContextItem), xbmc.LOGINFO)
Log(" ConversionServiceEnabled = " + str(setting_ConversionServiceEnabled), xbmc.LOGINFO)
Log(" AlsoConvertExistingSubtitles = " + str(setting_AlsoConvertExistingSubtitles), xbmc.LOGINFO)
Log(" SubsFontSize = " + str(setting_SubsFontSize), xbmc.LOGINFO)
Log(" ForegroundColor = " + str(setting_ForegroundColor), xbmc.LOGINFO)
Log(" BackgroundColor = " + str(setting_BackgroundColor), xbmc.LOGINFO)
Log(" BackgroundTransparency = " + str(setting_BackgroundTransparency), xbmc.LOGINFO)
Log(" MaintainBiggerLineSpacing = " + str(setting_MaintainBiggerLineSpacing), xbmc.LOGINFO)
Log(" RemoveCCmarks = " + str(setting_RemoveCCmarks), xbmc.LOGINFO)
Log(" RemoveAds = " + str(setting_RemoveAds), xbmc.LOGINFO)
Log(" AdjustSubDisplayTime = " + str(setting_AdjustSubDisplayTime), xbmc.LOGINFO)
Log(" FixOverlappingSubDisplayTime = " + str(setting_FixOverlappingSubDisplayTime), xbmc.LOGINFO)
Log(" PauseOnConversion = " + str(setting_PauseOnConversion), xbmc.LOGINFO)
Log(" BackupOldSubs = " + str(setting_BackupOldSubs), xbmc.LOGINFO)
Log(" AutoRemoveOldSubs = " + str(setting_AutoRemoveOldSubs), xbmc.LOGINFO)
Log(" RemoveSubsBackup = " + str(setting_RemoveSubsBackup), xbmc.LOGINFO)
Log(" RemoveUnprocessedSubs = " + str(setting_RemoveUnprocessedSubs), xbmc.LOGINFO)
Log(" SimulateRemovalOnly = " + str(setting_SimulateRemovalOnly), xbmc.LOGINFO)
Log(" AutoUpdateDef = " + str(setting_AutoUpdateDef), xbmc.LOGINFO)
Log(" LogLevel = " + str(setting_LogLevel), xbmc.LOGINFO)
Log(" SeparateLogFile = " + str(setting_SeparateLogFile), xbmc.LOGINFO)

# set setting value into the skin
if setting_ShowNoautosubsContextItem:
Expand Down
Loading

0 comments on commit f66840d

Please sign in to comment.