Elive / periscope

Python module searching subtitles on the web. Used in plugins for the GNOME desktop.
http://code.google.com/p/periscope/
0 stars 1 forks source link

Error triggered #1

Open Thanatermesis opened 2 years ago

Thanatermesis commented 2 years ago

@thetechrobo, I have made a fork of a fork of the original project to make it working for python3, but now i have an error, maybe you know more about how to fix it than me since i don't know python:

~/D/t/f/movies ❯❯❯ periscope -l es Un\ amor\ entre\ dos\ mundos\ \(HDRip\)\ \(EliteTorrent.net\)_v29_h264.mkv
Traceback (most recent call last):
  File "/usr/bin/periscope", line 185, in <module>
    main()
  File "/usr/bin/periscope", line 49, in main
    parser = OptionParser("usage: %prog [options] file1 file2", version = periscope.VERSION)
AttributeError: module 'periscope' has no attribute 'VERSION'
~/D/t/f/movies ❯❯❯

see this commit from another fork, which seems to fix the problem but i tried it and doesn't seems to change anything (or i think its already included in the code) https://github.com/oskarirauta/periscope/commit/03025cdc7a4eda6c1c0c9601370bd5335fbc1914

TheTechRobo commented 2 years ago

Uh, I'll have to try after school tomorrow.

Thanatermesis commented 2 years ago

keep me updated, will be needed to use this version for the next build (old version requires python2 as default in bullseye)

TheTechRobo commented 2 years ago

Huh? periscope is apparently a built-in module in Python now. I can't find a single source in the documentation for this...

EDIT: Nope, it isn't.

TheTechRobo commented 2 years ago

Alright, I've filed python/cpython#92525 because it made it harder for me to actually find the problem.

Basically, PEP 420 makes it so that folders even without __init__.py are automatically treated as packages. This causes the problem of when the periscope folder is in the home directory, it sees setup.py and version.py and treats it like a package... I'll put a workaround in the code, but it's very annoying behaviour.

TheTechRobo commented 2 years ago

Still working on this.

triantares commented 2 years ago

I noticed there's no module 'version' in python3 so you will need to also copy the 'version.py' to be available in the same directory from where the setup script is called. (it's the only one that imports) i.e 'periscope/bin/'

TheTechRobo commented 2 years ago

Already fixed in my pull request by doing some ugly hacks to sys.path.

Thanatermesis commented 2 years ago

tell me when you* want me to do a new test to verify if downloads subtitles correctly now

triantares commented 2 years ago

|>Already fixed in my pull request by doing some ugly hacks to sys.path.

I can't see that in your repo. i.e 'version.py' should also be in the 'periscope/bin/' directory where 'setup.py' is....and that setup needs to be run again for correct installation.

NVM, that doesn't work either. This whole 'version' thingy is a bit daft IMO.

Thanatermesis commented 2 years ago

I can't see that in your repo.

Yeah i have not imported anything yet, just waiting confirmation that is working (or, to use your* repo for a verification that is downloading subtitles for some movie tests)

TheTechRobo commented 2 years ago

@triantares I didn't fix it by doing that. As I just said, i did some hacks to sys.path so Python would look for files in the right folders.

TheTechRobo commented 2 years ago

tell me when you* want me to do a new test to verify if downloads subtitles correctly now

Didn't I already ask...?

triantares commented 2 years ago

@Thanatermesis and @TheTechRobo I don't mind testing but I don't know any other way than to run it from terminal with 'python periscope.py' and then I don't know what it's supposed to do. I'm baffled. :( At least it installs with 'python setup.py install' now.

TheTechRobo commented 2 years ago

bin/periscope

Thanatermesis commented 2 years ago

Didn't I already ask...?

yes, and it failed, I showed you the result on IRC: https://pastebin.com/2jn8zjET

@triantares run the periscope command with "-l en" similar to the previous paste with a movie as a parameter (better a known one, not reconverted/renamed), it should automatically download a .srt file after a few seconds which is the subtitles of the movie

triantares commented 2 years ago

Isn't this a helluva lot of work to get something working that's trivial on 'smplayer' and/or 'vlc'?

TheTechRobo commented 2 years ago

or just get a movie with decent metadata

Thanatermesis commented 2 years ago

Isn't this a helluva lot of work to get something working that's trivial on 'smplayer' and/or 'vlc'?

nah, it is one the things that makes elive so unique :) everytime i show this to an user that never seen linux before, they are so amazed that they switches to elive lol

Thanatermesis commented 2 years ago

I have merged the pull and given access rights to (this) repo to @triantares and @TheTechRobo

Actual state: the packaged versions gives an error about "VERSION" but as @TheTechRobo suggested, running it from the git tree as "./bin/periscope -l yourlanguage movie.mp4", it does something, but shows this error:

/t/s/periscope git:master ❯❯❯ ./bin/periscope -l es The.Comeback.Trail.2021.1080P-Dual-Lat-Cine-Calidad.Com.mp4
INFO:periscope:Searching subtitles for The.Comeback.Trail.2021.1080P-Dual-Lat-Cine-Calidad.Com.mp4 with langs ['es']
INFO:__main__:Starting thread <Thread(Thread-1, started 140349651490560)>
INFO:periscope:Searching on OpenSubtitles
INFO:periscope:Searching on Subtitulos
ERROR:plugins.SubtitleDatabase:Error occured
Traceback (most recent call last):
  File "/tmp/sources/periscope/./bin/../periscope/plugins/SubtitleDatabase.py", line 45, in searchInThread
    subs = self.process(filename, langs)
  File "/tmp/sources/periscope/./bin/../periscope/plugins/OpenSubtitles.py", line 147, in process
    return self.query(movie=movie, myear=myear, mteams=mteams, mdados=mdados, tvshow=None, season=None, episode=None, epname=None, teams=None, dados=None, moviehash=None, langs=langs, bytesize=None, filename=fname)
  File "/tmp/sources/periscope/./bin/../periscope/plugins/OpenSubtitles.py", line 201, in query
    self.server = xmlrpclib.Server(self.server_url)
AttributeError: module 'xmlrpc' has no attribute 'Server'
INFO:periscope:Searching on Podnapisi
INFO:plugins.SubtitleDatabase:Subtitulos writing 0 items to queue
INFO:periscope:Searching on TheSubDB
INFO:periscope:Searching on SubsWiki
INFO:periscope:Searching on LegendasTV
INFO:plugins.SubtitleDatabase:SubsWiki writing 0 items to queue
ERROR:plugins.LegendasTV:LegendasTV requires a personnal username/password. Set one up in your ~/.config/periscope/config file
INFO:periscope:Searching on SubDivX
INFO:plugins.SubtitleDatabase:LegendasTV writing 0 items to queue
/tmp/sources/periscope/./bin/../periscope/plugins/SubDivX.py:112: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 112 of the file /tmp/sources/periscope/./bin/../periscope/plugins/SubDivX.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

  soup = BeautifulSoup(content)
INFO:plugins.SubtitleDatabase:SubDivX writing 0 items to queue
WARNING:plugins.SubtitleDatabase:URL Error: [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1123) - http://simple.podnapisi.net/ppodnapisi/search?sK=The.Comeback.Trail.2021.1080P-Dual-Lat-Cine-Calidad.Com&sJ=28
ERROR:plugins.Podnapisi:Error raised by plugin Podnapisi: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last):
  File "/tmp/sources/periscope/./bin/../periscope/plugins/Podnapisi.py", line 51, in process
    subs_lang = self.query(fname, [lang])
  File "/tmp/sources/periscope/./bin/../periscope/plugins/Podnapisi.py", line 84, in query
    content = content.replace("scr'+'ipt", "script")
AttributeError: 'NoneType' object has no attribute 'replace'
INFO:plugins.SubtitleDatabase:Podnapisi writing 0 items to queue
ERROR:plugins.SubtitleDatabase:Error occured
Traceback (most recent call last):
  File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.9/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3.9/http/client.py", line 921, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.9/socket.py", line 843, in create_connection
    raise err
  File "/usr/lib/python3.9/socket.py", line 831, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/sources/periscope/./bin/../periscope/plugins/SubtitleDatabase.py", line 45, in searchInThread
    subs = self.process(filename, langs)
  File "/tmp/sources/periscope/./bin/../periscope/plugins/TheSubDB.py", line 65, in process
    page = urllib.request.urlopen(req, timeout=5)
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 1375, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error timed out>
INFO:__main__:**************************************************
INFO:__main__:Downloaded 0 subtitles
INFO:__main__:**************************************************