ArchLinux : des sous-titres pour vos vidéos en console

C'est grâce à l'ami Korben que j'ai découvert Subliminal, ce petit outil en console permettant de récupérer des sous-titres pour nos séries / films préféré(e)s !

Pour l'installer sous ArchLinux, rien de plus simple, utilisons AUR :

yaourt subliminal

Yaourt va s'occuper de récupérer les dépendances, à savoir :

  • python2
  • python2-beautifulsoup4
  • python2-guessit
  • python2-requests
  • python2-enzyme
  • python2-html5lib
  • python2-distribute

Puis, pour l'utiliser :

subliminal -l fr Game.of.Thrones.S01E02.720p.BluRay.X264-REWARD.mkv

Remplacez "fr" par la langue choisie pour vos sous-titres. Chez moi, cette commande génère une erreur :

subliminal -l fr Game.of.Thrones.S01E02.720p.BluRay.X264-REWARD.mkv 
Traceback (most recent call last):
  File "/usr/bin/subliminal", line 99, in <module>
    main()
  File "/usr/bin/subliminal", line 83, in main
    force=args.force, multi=args.multi, scan_filter=scan_filter)
  File "/usr/lib/python2.7/site-packages/subliminal/async.py", line 134, in download_subtitles
    subtitles_by_video = self.list_subtitles(paths, languages, services, force, multi, cache_dir, max_depth, scan_filter)
  File "/usr/lib/python2.7/site-packages/subliminal/async.py", line 120, in list_subtitles
    tasks = create_list_tasks(paths, languages, services, force, multi, cache_dir, max_depth, scan_filter)
  File "/usr/lib/python2.7/site-packages/subliminal/core.py", line 57, in create_list_tasks
    scan_result.extend(scan(p, max_depth, scan_filter))
  File "/usr/lib/python2.7/site-packages/subliminal/videos.py", line 231, in scan
    return [(video, video.scan())]
  File "/usr/lib/python2.7/site-packages/subliminal/videos.py", line 138, in scan
    existing = [f for f in os.listdir(folder) if f.startswith(basename)]
OSError: [Errno 2] No such file or directory: ''

Pour contouner cette erreur, ajoutez "./" à votre fichier, comme ci :

subliminal -l fr ./Game.of.Thrones.S01E02.720p.BluRay.X264-REWARD.mkv

Cela me génère toujours des erreurs, mais à la fin vous pouvez constater la ligne Downloaded 1 subtitle(s) for 1 video(s).

subliminal -l fr ./Game.of.Thrones.S01E02.720p.BluRay.X264-REWARD.mkv 
WARNING: subliminal.core Service bierdopje not available: none of available features could be used. One of ['xml'] required
ERROR: subliminal.async Exception raised in worker Thread-2
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subliminal/async.py", line 47, in run
    result = consume_task(task, self.services)
  File "/usr/lib/python2.7/site-packages/subliminal/core.py", line 131, in consume_task
    result = service.list(task.video, task.languages)
  File "/usr/lib/python2.7/site-packages/subliminal/services/__init__.py", line 154, in list
    return self.list_checked(video, languages)
  File "/usr/lib/python2.7/site-packages/subliminal/services/subswiki.py", line 49, in list_checked
    results = self.query(video.path or video.release, languages, get_keywords(video.guess), series=video.series, season=video.season, episode=video.episode)
  File "/usr/lib/python2.7/site-packages/subliminal/services/subswiki.py", line 81, in query
    sub_keywords = split_keyword(self.release_pattern.search(sub.contents[1]).group(1).lower())
AttributeError: 'NoneType' object has no attribute 'group'
**************************************************
Downloaded 1 subtitle(s) for 1 video(s)
./Game.of.Thrones.S01E02.720p.BluRay.X264-REWARD.srt from tvsubtitles
**************************************************
Vus : 1330
Publié par Jeoffrey Bauvin : 48