MestreLion / legendastv

API for Legendas.TV website, world's largest repository of Brazilian Portuguese Movie/TV Series subtitles. Utilities to search, retrieve info, download, extract and match subtitles.
15 stars 3 forks source link

error finding subtitles for some titles #21

Closed cassioac closed 8 years ago

cassioac commented 8 years ago

Now I get this error when running on a folder with multiple movies subfolders:

2016-01-02 01:25:10,147 DEBUG 1 OpenSubtitles titles found: {'SeenCount': '66', 'MovieImdbID': '3736876', 'MovieKind': 'episode', 'SeriesSeason': '1', 'SeriesEpisode': '7', 'MovieHash': '80f8a688dbdb0122', 'SubCount': '12', 'MovieName': '"Narcos" You Will Cry Tears of Blood', 'MovieYear': '2015'} 2016-01-02 01:25:10,148 DEBUG Chosen best for 'narcos' in 'search': {'best': {u'search': '"Narcos" You Will Cry Tears of Blood', 'SeenCount': '66', 'MovieImdbID': '3736876', 'MovieKind': 'episode', 'SeriesSeason': '1', 'SeriesEpisode': '7', 'MovieHash': '80f8a688dbdb0122', 'SubCount': '12', 'MovieName': '"Narcos" You Will Cry Tears of Blood', 'MovieYear': '2015'}, 'similarity': 0.2857142857142857} 2016-01-02 01:25:10,148 NOTIFY Searching titles for 'Narcos 1st Season' 2016-01-02 01:25:10,149 DEBUG loading /util/busca_titulo/Narcos 2016-01-02 01:25:16,259 DEBUG Titles found for 'Narcos': {'title_br': u'Narcos - 1\xaa Temporada', 'title': u'Narcos', 'id': 38493, 'thumb': u'http://i.legendas.tv/poster/legendas_tv_20150728194438.jpg'} 2016-01-02 01:25:16,260 NOTIFY 1 titles found 2016-01-02 01:25:16,261 DEBUG Chosen best for 'Narcos 1' in 'search': {'best': {'title_br': u'Narcos - 1\xaa Temporada', u'search': u'Narcos 1', 'title': u'Narcos', 'id': 38493, 'thumb': u'http://i.legendas.tv/poster/legendas_tv_20150728194438.jpg'}, 'similarity': 1.0} 2016-01-02 01:25:16,261 NOTIFY Searching subs for 'Narcos - 1ª Temporada' - Episode 7 2016-01-02 01:25:16,261 DEBUG loading /util/carrega_legendas_busca_filme/38493/1 2016-01-02 01:25:17,592 NOTIFY ERROR! Check log for details 2016-01-02 01:25:17,592 CRITICAL 'builtin_function_or_method' object has no attribute 'getitem' Traceback (most recent call last): File "/root/.local/bin/legendastv", line 128, in main(sys.argv[1:]) File "/root/.local/bin/legendastv", line 101, in main subtitles.retrieve_subtitle_for_movie(videofile) File "/opt/legendastv/legendastv/subtitles.py", line 222, in retrieve_subtitle_for_movie subs = legendastv.getSubtitlesByMovie(movie) File "/opt/legendastv/legendastv/providers/legendastv.py", line 255, in getSubtitlesByMovie allpages=allpages) File "/opt/legendastv/legendastv/providers/legendastv.py", line 363, in getSubtitles url = next[0].attrib['href'] TypeError: 'builtin_function_or_method' object has no attribute 'getitem'

Please let me know if you need any log file.

Thanks

Cassio

cassioac commented 8 years ago

I've noticed that's not the recursive execution that throws the problem, but some files does it.

For example:

2016-01-04 00:02:02,731 DEBUG Target: /mnt/Volume_1/videos/filmes/Dark Knight, The (2008)/The Dark Knight.mkv 2016-01-04 00:02:02,733 DEBUG Guessed title info: 'The Dark Knight' -> {'release': u'The Dark Knight', 'title': u'The Dark Knight', 'year': u''} 2016-01-04 00:02:03,275 DEBUG OSDB.LogIn(u'', u'*', u'', u'Legendas.TV v1.0') -> {'status': '200 OK', 'seconds': 0.007, 'token': 'jv5dm9lfb4d4itl7sm1pa4c7j7'} 2016-01-04 00:02:03,710 DEBUG OSDB.CheckMovieHash2('jv5dm9lfb4d4itl7sm1pa4c7j7', ['ebf3c97a3175beb8']) -> {'status': '200 OK', 'seconds': 0.003, 'data': {'ebf3c97a3175beb8': [{'SeenCount': '1', 'MovieImdbID': '0468569', 'MovieKind': 'movie', 'SeriesSeason': '0', 'SeriesEpisode': '0', 'MovieHash': 'ebf3c97a3175beb8', 'SubCount': '1', 'MovieName': 'The Dark Knight', 'MovieYear': '2008'}]}} 2016-01-04 00:02:03,711 DEBUG 1 OpenSubtitles titles found: {'SeenCount': '1', 'MovieImdbID': '0468569', 'MovieKind': 'movie', 'SeriesSeason': '0', 'SeriesEpisode': '0', 'MovieHash': 'ebf3c97a3175beb8', 'SubCount': '1', 'MovieName': 'The Dark Knight', 'MovieYear': '2008'} 2016-01-04 00:02:03,712 DEBUG Chosen best for 'The Dark Knight' in 'search': {'best': {u'search': 'The Dark Knight', 'SeenCount': '1', 'MovieImdbID': '0468569', 'MovieKind': 'movie', 'SeriesSeason': '0', 'SeriesEpisode': '0', 'MovieHash': 'ebf3c97a3175beb8', 'SubCount': '1', 'MovieName': 'The Dark Knight', 'MovieYear': '2008'}, 'similarity': 1.0} 2016-01-04 00:02:03,712 NOTIFY Searching titles for 'The Dark Knight' 2016-01-04 00:02:03,712 DEBUG loading /util/busca_titulo/The+Dark+Knight 2016-01-04 00:02:04,728 DEBUG Titles found for 'The Dark Knight': {'title_br': u'Batman - O Cavaleiro das Trevas', 'title': u'The Dark Knight', 'id': 10725, 'thumb': u'http://i.legendas.tv/poster/tt468569.jpg'} {'title_br': u'Batman - O cavaleiro das Trevas', 'title': u'Batman - The Dark Knight', 'id': 31931, 'thumb': u'http://i.legendas.tv/poster/legendas_tv_20140201170840.png'} {'title_br': u'Batman - Cavaleiro das trevas', 'title': u'Batman - The Dark Knight', 'id': 31934, 'thumb': u'http://i.legendas.tv/poster/legendas_tv_20140201184707.png'} {'title_br': u'Batman: O Cavaleiro das Trevas - Parte 1', 'title': u'Batman: The Dark Knight Returns, Part 1', 'id': 28308, 'thumb': u'http://i.legendas.tv/poster/tt2313197.jpg'} {'title_br': u'Batman: O Cavaleiro das Trevas - Parte 2', 'title': u'Batman: The Dark Knight Returns, Part 2', 'id': 29267, 'thumb': u'http://i.legendas.tv/poster/tt2166834.jpg'} {'title_br': u'A ascen\xe7\xe3o do Cavaleiro das Trevas', 'title': u'The Dark Knight Rises', 'id': 26422, 'thumb': u'http://i.legendas.tv/poster/tt1345836.jpg'} {'title_br': u'Batman: O Cavaleiro das Trevas Ressurge', 'title': u'The Dark Knight Rises', 'id': 27548, 'thumb': u'http://i.legendas.tv/poster/tt1345836.jpg'} {'title_br': u'Batman: O Cavaleiro das Trevas Ressurge', 'title': u'The Dark Knight Rises', 'id': 28897, 'thumb': u'http://i.legendas.tv/poster/tt1345836.jpg'} 2016-01-04 00:02:04,729 NOTIFY 8 titles found 2016-01-04 00:02:04,730 DEBUG Chosen best for 'The Dark Knight' in 'search': {'best': {'title_br': u'Batman - O Cavaleiro das Trevas', u'search': u'The Dark Knight', 'title': u'The Dark Knight', 'id': 10725, 'thumb': u'http://i.legendas.tv/poster/tt468569.jpg'}, 'similarity': 1.0} 2016-01-04 00:02:04,730 NOTIFY Searching subs for 'The Dark Knight' 2016-01-04 00:02:04,730 DEBUG loading /util/carrega_legendas_busca_filme/10725/1 2016-01-04 00:02:05,929 NOTIFY ERROR! Check log for details 2016-01-04 00:02:05,930 CRITICAL 'builtin_function_or_method' object has no attribute 'getitem' Traceback (most recent call last): File "/root/.local/bin/legendastv", line 128, in main(sys.argv[1:]) File "/root/.local/bin/legendastv", line 104, in main subtitles.retrieve_subtitle_for_movie(filename) File "/opt/legendastv/legendastv/subtitles.py", line 222, in retrieve_subtitle_for_movie subs = legendastv.getSubtitlesByMovie(movie) File "/opt/legendastv/legendastv/providers/legendastv.py", line 255, in getSubtitlesByMovie allpages=allpages) File "/opt/legendastv/legendastv/providers/legendastv.py", line 363, in getSubtitles url = next[0].attrib['href'] TypeError: 'builtin_function_or_method' object has no attribute 'getitem**'

MestreLion commented 8 years ago

Oi!

Não sei se essa é a causa do bug, mas voce está usando uma versão bem antiga do legendas: a URL de busca por exemplo não é mais /util/busca_titulo/ já tem quase 1 ano. Baixe a versão mais recente e tente de novo.

De qualquer forma, vou investigar aqui os 2 casos que voce postou...

cassioac commented 8 years ago

Eu baixei a 1.6 do releases, não é essa a última??

MestreLion commented 8 years ago

1.6 era o último release oficial, eu nem lembrava que tinha feito releases desse projeto, já que normalmente trabalho com a última versão do git. Recomendo baixar sempre o zip da página principal.

De qualquer forma, acabei de "lançar" 2 novas versões: 1.6.1, que corrige exatamente o seu bug, e 1.7, que é o último commit antes de uma mudança mais profunda (mas que também contem outras melhorias, logo recomendo o zip da pagina principal)

MestreLion commented 8 years ago

Fixed in commit 4d65770194c69e03d36917c1a0d1b985d42b3dc9

cassioac commented 8 years ago

Valeu! Vou olhar...