Diaoul / subliminal

Subtitles, faster than your thoughts
http://subliminal.readthedocs.org
MIT License
2.4k stars 312 forks source link

Existing subtitle files always replaced #99

Closed nicoulaj closed 12 years ago

nicoulaj commented 12 years ago

Maybe I'm misunderstanding the meaning of the --force option, but whether I use it or not, srt files are always replaced as if it was always on. Also, it seems to be a regression introduced by the most recent fixes in develop as I cannot reproduce it on 0.6.0.

Diaoul commented 12 years ago

Well nothing changed here so that's weird.

Diaoul commented 12 years ago
➜  bin  ./subliminal -l en -l fr -m /mnt/syno/video/Series/The\ Big\ C/Season\ 03 -s opensubtitles --force
**************************************************
Downloaded 2 subtitle(s) for 2 video(s)
/mnt/xxxx/video/The Big C/Season 03/S03E07 - How Bazaar - HD TV.en.srt from opensubtitles
/mnt/xxxx/video/The Big C/Season 03/S03E08 - Killjoy - HD TV.en.srt from opensubtitles
**************************************************
➜  bin  ./subliminal -l en -l fr -m /mnt/syno/video/Series/The\ Big\ C/Season\ 03 -s opensubtitles        
No subtitles downloaded

That works for me, using latest from develop branch.

Diaoul commented 12 years ago

If you can reproduce this, show me full log by adding -v -v to the command line

nicoulaj commented 12 years ago

Here is a log with several invokations on the same file, the last one with full verbose.

Diaoul commented 12 years ago

Oh yeah now I remember :) That's a feature not a bug : https://github.com/Diaoul/subliminal/blob/develop/subliminal/videos.py#L220 When you give a single file to subliminal, we trust your input and search for subtitles anyway. If you already have good subtitles, why would you search again this specific file? If not to override existing subtitles.

nicoulaj commented 12 years ago

Makes sense :)

Actually the issue seems to be trickier than that: only some of the subtitles always get replaced. Here is a log with several invokations, you can see 6 of the subtitles always get replaced.

nicoulaj commented 12 years ago

After taking a closer look, the 6 subtitles in question are iso-8859-1 encoded, the other ones are all UTF-8. Is this behaviour expected ?

Diaoul commented 12 years ago

Indeed. Try to reproduce this with the -m flag. I think this issue is specific to multi=False.

Diaoul commented 12 years ago

Should subliminal convert subtitles to utf-8 after download?

cristiangauma commented 12 years ago

About search the file again for the subtitles.

In my case I've a cron on my download folder every 15 minutes (a find with an exec :) ) that search for subtitles. It would be nice to add the option that if there is one .srt, subliminal doesn't search for a new one :).

Diaoul commented 12 years ago

Well that's a waste because subliminal is optimized to be run on multiple files at the same time.

nicoulaj commented 12 years ago

I'm reproducing it with the -m flag too.

I don't think it is subliminal's job to convert subtitles, but its behaviour should not be dependant on the file encoding to me. Besides, converting subtitles does not solve the issue if there are subtiles downloaded by other means.

Diaoul commented 12 years ago

Try with 2 languages

cristiangauma commented 12 years ago

I know, but i'm thinking for example when a TVShow's downloaded at 4AM (europe), and the subtitle is released two, three, four... five hours later. When I wake up I have my TVShow organized with his subtitle on my NAS.

BTW if you think that it's not useful to develop, I can do an "if" on my cron and without problems :).

Diaoul commented 12 years ago

That's the --force option. And it exists. What's your python version?

Diaoul commented 12 years ago

I bet you use 2.6

cristiangauma commented 12 years ago

Yep, 2.6.6

nicoulaj commented 12 years ago

I think what @cristiangauma is asking for is a --no-force option to inhibit the "always force when single file" behaviour...

I tested with -m and multiple languages, and the bug does not occur.

Also, I use Python 2.7.3.

Diaoul commented 12 years ago

Ok great, so you can reproduce my behavior. I'll be able to fix this :)

Diaoul commented 12 years ago

I think the comes from the changes I pulled from wackou's branch. I need to try to optimize the scan of external subtitles a bit.

Diaoul commented 12 years ago

Could you try with latest of develop? 4a177b60088d60fe03a5786ef3d18862167101eb should fix this.

nicoulaj commented 12 years ago

Yep, it works fine now. Thanks !