Closed GoogleCodeExporter closed 9 years ago
I don't really get what goes wrong here. I justed tested it, and it works for
me.
----BEGIN----
Hi,
AutoSub downloaded the following subtitle (language: nl):
Akta.Manniskor.S01E07.SWEDISH.720p.HDTV.H.264-ToK.srt
For the videofile:
Akta.Manniskor.S01E07.SWEDISH.720p.HDTV.H.264-ToK.mkv
----END----
What is the location on your file system (maybe directory name is too long?)?
Are you using any other notification?
Is the subtitle save correctly on your file system or does the real subtitle
file also mist the last 'k'?
Original comment by romke.va...@gmail.com
on 9 Nov 2012 at 6:21
Hello Romke,
Thx for checking the issue.
The whole directory name is about 36 chars, so not very long.
I only use the autosub standard notification.
The real subtitle file also misses the last 'K' in the file.
I had a look at the code and the problem is caused by the fact the video file
has an extension of 2 chars long, as it's 'TS' and the code in checkSub.py
assumes the extension is always 3 characters long it seems.
Extensions with 3 chars work OK, like '.mkv' and '.mp4,' but '.TS' does not.
The following code-change fixes the issue:
auto-sub/autosub# diff checkSub.py.org checkSub.py
46c46
< srtfile = os.path.join(originalfile[:-4] + ".srt")
---
> srtfile = os.path.splitext(originalfile)[0] + ".srt"
Then I get:
AutoSub downloaded the following subtitle (language: nl):
Akta.Manniskor.S01E07.SWEDISH.720p.HDTV.H.264-ToK.srt
For the videofile:
Akta.Manniskor.S01E07.SWEDISH.720p.HDTV.H.264-ToK.ts
There are more places and files where the construction of '[:-4] + ".srt"' is
used and maybe these need to be changed too.
I hope this helps.
Please feel free to contact me at id2test@hotmail.com for any more info or
testing.
Kind regards, Ids.
Original comment by id2t...@hotmail.com
on 10 Nov 2012 at 8:10
A yeah, that explains a lot, that [:-4] has been there since the beginning of
auto-sub, never caused a problem so never really paid attention to it.
Thanks for your detail look, your fix as been implemented.
Original comment by romke.va...@gmail.com
on 10 Nov 2012 at 8:54
Hello Romke,
Thanks for the quick fix.
I had a look at the new code in source and saw the new code is:
os.path.splitext(originalfile)[0] + u".srt"
Are you sure this - the last part being '+ u".srt"' is correct?
And also; the fixed lines have the same content now, so no longer different for
SUBNL, standard, and SUBENG like in the original source?
Please also note a similar fix needs to be implemented in files (which also use
[:-4]) :
scanDisk.py
checkRss.py
This to prevent the srt file to be not found and downloaded over and over again
as part of each check.
In which version is the fix intended to be included?
Below is a diff of the 3 files I think need to be modified.
Thx.
Regards, Ids.
------
auto-sub/autosub# diff checkSub.py.org checkSub.py
44c44
< srtfile = os.path.join(originalfile[:-4] + "." +
autosub.SUBNL + ".srt")
---
> srtfile = os.path.splitext(originalfile)[0] + "." +
autosub.SUBNL + ".srt"
46c46
< srtfile = os.path.join(originalfile[:-4] + ".srt")
---
> srtfile = os.path.splitext(originalfile)[0] + ".srt"
48c48
< engsrtfile = os.path.join(originalfile[:-4] + "." +
autosub.SUBENG + ".srt")
---
> engsrtfile = os.path.splitext(originalfile)[0] + "." +
autosub.SUBENG + ".srt"
auto-sub/autosub# diff scanDisk.py.org scanDisk.py
37c37
< srtfile = os.path.join(filename[:-4] + "." +
autosub.SUBNL + ".srt")
---
> srtfile = os.path.splitext(filename)[0] + "." +
autosub.SUBNL + ".srt"
39c39
< srtfile = os.path.join(filename[:-4] + ".srt")
---
> srtfile = os.path.splitext(filename)[0] + ".srt"
41c41
< srtfileeng = os.path.join(filename[:-4] + "." +
autosub.SUBENG + ".srt")
---
> srtfileeng = os.path.splitext(filename)[0] + "." +
autosub.SUBENG + ".srt"
auto-sub/autosub# diff checkRss.py.org checkRss.py
154c154
< srtfile = os.path.join(originalfile[:-4] +
"." + autosub.SUBNL + ".srt")
---
> srtfile = os.path.splitext(originalfile)[0] +
"." + autosub.SUBNL + ".srt"
156c156
< srtfile = os.path.join(originalfile[:-4] +
".srt")
---
> srtfile = os.path.splitext(originalfile)[0] +
".srt"
159c159
< srtfile = os.path.join(originalfile[:-4] +
"." + autosub.SUBENG + ".srt")
---
> srtfile = os.path.splitext(originalfile)[0] +
"." + autosub.SUBENG + ".srt"
161c161
< srtfile = os.path.join(originalfile[:-4] +
".srt")
---
> srtfile = os.path.splitext(originalfile)[0] +
".srt"
Original comment by id2t...@hotmail.com
on 11 Nov 2012 at 10:03
Hi, thanks for point out the mistake. Yeah indeed, I forgot to add the subnl
etc stuff.
the u".srt" part is correct, because all the config settings are unicode.
Thanks god that python allows combining string with unicode string without a
problem. But it is 'nicer' just to combine the right types :)
Thanks again, I hope my last push fixes this issue completely
Original comment by romke.va...@gmail.com
on 11 Nov 2012 at 11:47
Ow, and this fix will be implemented in next major release. So the upcoming
0.5.6 beta. Which you can expect is about a week time.
Original comment by romke.va...@gmail.com
on 11 Nov 2012 at 11:48
Hello Romke,
Thanks for the reply.
It seems there are still 2 incorrect updates - note the last line each time
below where string autosub.SUBNL is added to the english srt filename - in
files checkSub.py and scanDisk.py:
checkSub.py now contains:
if autosub.SUBNL != "":
srtfile = os.path.splitext(originalfile)[0] + u"." + autosub.SUBNL + u".srt"
else:
srtfile = os.path.splitext(originalfile)[0] + u".srt"
engsrtfile = os.path.splitext(originalfile)[0] + u"." + autosub.SUBNL + u".srt"
I think this should be:
if autosub.SUBNL != "":
srtfile = os.path.splitext(originalfile)[0] + u"." + autosub.SUBNL + u".srt"
else:
srtfile = os.path.splitext(originalfile)[0] + u".srt"
engsrtfile = os.path.splitext(originalfile)[0] + u"." + autosub.SUBENG + u".srt"
scanDisk.py now contains:
if autosub.SUBNL != "":
srtfile = os.path.splitext(filename)[0] + u"." + autosub.SUBNL + u".srt"
else:
srtfile = os.path.splitext(filename)[0] + u".srt"
srtfileeng = os.path.splitext(filename)[0] + u"." + autosub.SUBNL + u".srt"
I think this should be:
if autosub.SUBNL != "":
srtfile = os.path.splitext(filename)[0] + u"." + autosub.SUBNL + u".srt"
else:
srtfile = os.path.splitext(filename)[0] + u".srt"
srtfileeng = os.path.splitext(filename)[0] + u"." + autosub.SUBENG + u".srt"
Regards, Ids.
Original comment by id2t...@hotmail.com
on 11 Nov 2012 at 5:16
Thanks again,
Kinda busy today and don't really have time to look at auto-sub, so thanks for
keeping an eye out. Hope it is fixed this time :)
Many thanks
Original comment by romke.va...@gmail.com
on 11 Nov 2012 at 5:51
Original issue reported on code.google.com by
id2t...@hotmail.com
on 9 Nov 2012 at 1:05