Subdownloader CLI crashes when subs already exist

Bug #722084 reported by Raj B
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SubDownloader
Fix Committed
High
Marco Ferreira

Bug Description

when using the cli version of subdownloader, I get the following if subs already exist in the same directory. this bug is in the current
bzr version

I'm running subdownloader as python run.py -l eng -c

<earlier part snipped>
[18:05] DEBUG::subdownloader.FileManagement.Subtitle # scoring for Buffy the Vampire Slayer - 6x01 - 6x02Bargaining (1).en.srt is 7
[18:05] DEBUG::subdownloader.cli.filter # Subtitle choosen by match
[18:05] DEBUG::subdownloader.cli.filter # - adding: Buffy the Vampire Slayer - 6x01 - 6x02Bargaining (1).en.srt
[18:05] DEBUG::subdownloader.cli.filter # (total: 3 online: 1...
Traceback (most recent call last):
  File "/root/subdownloader/subdownloader/run.py", line 79, in <module>
    cli.start_session()
  File "/root/subdownloader/subdownloader/cli/main.py", line 107, in start_session
    self.handle_operation(self.options.operation)
  File "/root/subdownloader/subdownloader/cli/main.py", line 156, in handle_operation
    self.DownloadSubtitles(_filter.subtitles_to_download())
  File "/root/subdownloader/subdownloader/modules/filter.py", line 33, in subtitles_to_download
    self.log.debug("- adding: %s: %s"% (subtitle.getIdFileOnline(), subtitle.getFileName()))
  File "/root/subdownloader/subdownloader/modules/subtitlefile.py", line 73, in getIdFileOnline
    return self._onlineFileId
AttributeError: 'SubtitleFile' object has no attribute '_onlineFileId'

Revision history for this message
Raj B (bigwoof) wrote :

my python version is
Python 2.7.1+ b.t.w.

Revision history for this message
Elisiano Petrini (elisiano) wrote :

Same here on Ubuntu Natty
These are the versions used:

$ dpkg -l|awk '$2 ~ /^python[[:digit:]]|subdownloader/{print $2,$3}'
python2.7 2.7.1-5ubuntu1
python2.7-dev 2.7.1-5ubuntu1
python2.7-minimal 2.7.1-5ubuntu1
subdownloader 2.0.14-1

In the GUI everything works as expected and in my case also removing all existing subtitle files before running with cli interface.
But as long as there is an existing sub, the above happens.

Revision history for this message
henriq (henriq) wrote :

I have the same issue running the latest subdownloader version. The command I use is

$ subdownloader -q -l en -c --rename-subs -d --video='path'

Changed in subdownloader:
importance: Undecided → Critical
status: New → In Progress
assignee: nobody → Marco Ferreira (mferreira)
Revision history for this message
Marco Ferreira (mferreira) wrote :

There seems to be an issue with OS api server.

To make sure this is the case, could someone with an older version of SubDownloader tell if it works properly?

Thanks

Revision history for this message
henriq (henriq) wrote :

I tried it with older bazaar releases (tried rev 517 and rev 500). Still got the same error with both of them. The latest bazaar release gave a slightly different message however:

[12:40] DEBUG::subdownloader.SDService.SDService # Connection to the server failed/other error:(<class 'xml.parsers.expat.ExpatError'>, ExpatError('syntax error: line 12, column 0',), <traceback object at 0x8f2ae3c>)
[12:40] ERROR::subdownloader.SDService.TimeoutFunction # (<class 'xml.parsers.expat.ExpatError'>, ExpatError('syntax error: line 12, column 0',), <traceback object at 0x8f1b6e4>)
Traceback (most recent call last):
  File "/var/subdownloader/run.py", line 79, in <module>
    cli.start_session()
  File "/var/subdownloader/cli/main.py", line 107, in start_session
    self.handle_operation(self.options.operation)
  File "/var/subdownloader/cli/main.py", line 156, in handle_operation
    self.DownloadSubtitles(_filter.subtitles_to_download())
  File "/var/subdownloader/modules/SDService.py", line 374, in DownloadSubtitles
    return DownloadSubtitles(subtitles)
  File "/var/subdownloader/modules/SDService.py", line 72, in __call__
    raise e
xml.parsers.expat.ExpatError: syntax error: line 12, column 0

Revision history for this message
Marco Ferreira (mferreira) wrote :

Thanks henriq.

The original error that opened the bug should be fixed in the trunk now.
XML error, on the other hand, I suspect that is some issue with the subtitle server itself (opensubtitles.org).

Great movies everyone.
MF

Changed in subdownloader:
status: In Progress → Fix Committed
importance: Critical → High
Revision history for this message
henriq (henriq) wrote :

Thanks Marco, that issue is gone now.

Apparently some files are missing the idFileOnline, and they crash the party when they are added to the download matrix in filter.py (I've only encountered this on files that shouldn't be downloaded in any case since they have local subs, might be a problem if --sol is specified). I made a simple check for the existance of this field before adding the file and that resolves the crashes.

I'm attaching the patch that solves this issue for me. I guess someone should investigate why the field is missing, but this works in the mean time.

Cheers.
Fredrik

Revision history for this message
Marco Ferreira (mferreira) wrote :

henriq, can you open a new bug for that and post the debug log?

Thanks

Revision history for this message
Kenny Root (kennyr) wrote :

It seems there's a self._id_file_online and self._onlineFileId, but only one is initialized. Is self._id_file_online meant to be self._onlineFileId instead?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.