also split auto-title words on /

This commit is contained in:
jesopo 2019-10-09 12:58:25 +01:00
parent ab2701837c
commit 6b8323b6f5

View file

@ -5,6 +5,8 @@
import hashlib, re, urllib.parse import hashlib, re, urllib.parse
from src import EventManager, ModuleManager, utils from src import EventManager, ModuleManager, utils
RE_WORDSPLIT = re.compile("[\s/]")
@utils.export("channelset", utils.BoolSetting("auto-title", @utils.export("channelset", utils.BoolSetting("auto-title",
"Disable/Enable automatically getting info titles from URLs")) "Disable/Enable automatically getting info titles from URLs"))
@utils.export("channelset", utils.BoolSetting("title-shorten", @utils.export("channelset", utils.BoolSetting("title-shorten",
@ -22,7 +24,7 @@ class Module(ModuleManager.BaseModule):
def _different(self, url, title): def _different(self, url, title):
url = url.lower() url = url.lower()
title_words = [] title_words = []
for title_word in title.split(): for title_word in RE_WORDSPLIT.split(title):
if len(title_word) > 1 or title_word.isalpha(): if len(title_word) > 1 or title_word.isalpha():
title_words.append(title_word.lower()) title_words.append(title_word.lower())