acomputerguru / periscope

Automatically exported from code.google.com/p/periscope
0 stars 0 forks source link

Download subtitles for many languages #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Usually I prefer subtitles in english, to improve my skill in this
language, but my wife prefers potuguese-brazilian or spanish...

What is the expected output? What do you see instead?
I would like to have an option of downloading more than one subtitle
language, I suggest that the config could be like this, to keep
compatibility with previous version:

[DEFAULT]
lang = en,pb,pt,es
lang2 = pb,pt,es

Meaning: download first of (en,pb,pt,es) AND first of (pb,pt,es)

The files should be named with the language before the extension, like
X.en.srt.

What version of the product are you using? On what operating system?
0.1.5, on Ubuntu 9.10 (installed from the .deb files, could not install via
ppa repository)

Original issue reported on code.google.com by lfsrteix...@gmail.com on 3 Dec 2009 at 2:12

GoogleCodeExporter commented 9 years ago
This is a good suggestion. The only thing I'm not convinced about is the 
X.[lang].srt
as I don't think most video players in Ubuntu are able to find the subtitle 
files
unless it has the exact name of the video (at least Totem an MPlayer don't do 
that on
my machine).

In the meantime, if you're not afraid of the command-line, you can do $> 
pericope -l
pb -l pt -l es <path/to/your/file>

And for information, the ISO code for brazilian portuguese is coded in 
periscope as
"pt-br" not "pb". I used the definition of ISO standards as stated here:
http://en.wikipedia.org/wiki/Brazilian_Portuguese#pt-BR

And about 9.10 and ppa, I haven't had the time to migrate to Ubuntu 9.10 yet, 
I'll
release one last version of periscope for 9.4 before making the switch. There 
should
be a 9.10 ppa version before the end of the year.

Original comment by patrick....@gmail.com on 3 Dec 2009 at 9:34

GoogleCodeExporter commented 9 years ago
I am a satisfied user of SMPlayer (based on MPlayer) and it can present various
subtitles to be chosen from, provided that they are in the same directory as the
video file.

As for the command line, it is not that I am afraid of it, but it is more 
convenient
to download directly from nautilus.

The "code" "pb" is used by subdownloader in the (old) version I use - and that 
I have
kind of integrated into nautilus, using nautilus scripts. But it only downloads 
from
"opensubtitles.org", and is a bit "bloated" in my opinion (the newer version is 
even
more...). If the ISO code is different, that is the one to be used, for sure!

You are really doing a great work here, there is no problem to wait for the 
9.10 ppa.
Thanks!

Original comment by lfsrteix...@gmail.com on 3 Dec 2009 at 10:37

GoogleCodeExporter commented 9 years ago
Since the subtitles are (generally) small files, I suggest you to implement this
logic, that should work with any player:

1) download all subs with the X.[lang].srt filename
2) copy (or symbolic link?) the first X.[lang].srt to X.srt, assuming that is 
the
most preferred subtitle (and will work by default in totem)

For instance, as much as I remember, Totem has the option to read a subtitle 
from a
file, but at least in the version I used, it went to the home directory, making 
this
process not practical.

Original comment by lfsrteix...@gmail.com on 3 Dec 2009 at 10:42

GoogleCodeExporter commented 9 years ago
I'm using the following code to download different subtitles:
#!/opt/bin/python2.6
# -*- coding: utf-8 -*-

import periscope
import sys
import logging
import os
import string
logging.basicConfig(level=logging.DEBUG)

subdl = periscope.Periscope()
filepath = sys.argv[1]
print "\nSearch for English subtitle:"
print "=============================="
subtitle1 = subdl.downloadSubtitle(filepath, ['en']) # English
if subtitle1 :
    print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle1['plugin'], subtitle1['lang'], subtitle1['subtitlepath'])
    os.rename(subtitle1['subtitlepath'], string.join(string.split(subtitle1['subtitlepath'], ".srt"), ".en.srt"))

print "\nSearch for Dutch subtitle:"
print "=============================="
subtitle2 = subdl.downloadSubtitle(filepath, ['nl']) # Dutch
if subtitle2 :
    print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle2['plugin'], subtitle2['lang'], subtitle2['subtitlepath'])
    os.rename(subtitle2['subtitlepath'], string.join(string.split(subtitle2['subtitlepath'], ".srt"), ".nl.srt"))

Original comment by jeroen.v...@gmail.com on 8 Jan 2011 at 8:12

GoogleCodeExporter commented 9 years ago
The only issue I have with this is that some video players do not recognize a 
<file>.<lang>.srt format

If I remember correctly, Totem (Gnome) and Mplayer do not recognize those by 
default.
I'm trying to keep the default as simple as possible but I'm considering adding 
this in the config file

Original comment by patrick....@gmail.com on 8 Jan 2011 at 9:40

GoogleCodeExporter commented 9 years ago
lfsrteix is right. I bet MANY people want this. The backwards compatible syntax 
in the config file is a pain, but I could live with it.
In Comment 3 lfsrteix gives a great solution to the "some players dont find the 
subtitles files if name is not exactly the same" problem.
But in any case this is a bug in the players. Many subtitles for a single movie 
should be NORMAL.
Keep going with this great project!

Original comment by alelon...@gmail.com on 20 Jan 2011 at 12:37

GoogleCodeExporter commented 9 years ago
Issue 67 has been merged into this issue.

Original comment by patrick....@gmail.com on 4 Feb 2011 at 9:43

GoogleCodeExporter commented 9 years ago
yes needed too
as single AND multi language subtitles files works on XBMC ;)

Original comment by nomor...@gmail.com on 26 Mar 2011 at 1:03

GoogleCodeExporter commented 9 years ago
For sickbeard, I made a quick solution with a modification in call-periscope : 

http://code.google.com/p/call-periscope/issues/detail?id=2

Original comment by nomor...@gmail.com on 26 Mar 2011 at 3:09

GoogleCodeExporter commented 9 years ago
I think the backward handling can be addressed trough a new command line 
parameter. Currently the languages handling works like fall back, in another 
words, if the first didn't work the script falls back to the second.

We would just add a new parameter, eg; --enable-multi-lang that would use the 
magic pointed by lfsrteix. If multi-language is on, check for 
basename.lang[n].srt if not found, download appending the lang code to the file 
name

Original comment by an...@mrx.com.br on 21 Sep 2011 at 8:46

GoogleCodeExporter commented 9 years ago
Issue 142 has been merged into this issue.

Original comment by patrick....@gmail.com on 13 Nov 2012 at 3:46