titles = len(titles)
return titles
-def load_channels():
- """Récupère les chaînes à surveiller à partir du fichier de conf."""
- with open(serverconfig.youtube_channels_file) as f:
- channels = [l.strip("\n") for l in f.readlines()]
- channels = [l for l in channels if not (l.startswith("#") or l.strip() == "")]
- channels = [l.split("\t") for l in channels]
- # Il peut y avoir plusieurs tabulations de suite, donc on enlève les chaînes vides
- channels = [[i for i in l if not i == ''] for l in channels]
- # [id, username, regexp]
- # channels = [{"id" : l[0], "username" : l[1], "regexp" : l[2]} for l in channels]
- return channels
-
def get_parser(username, regexp=None):
""" Renvoie un parseur de chaîne youtube prêt à être appelé """
return parse_youtube(username, regexp, length=True)
return local_parser
-channels = load_channels()
+channels = serverconfig.load_file(serverconfig.youtube_channels_file)
functions = {id : get_parser(username, regexp) for (id, username, regexp) in channels}