
download_opensubtitle
Source (link to git-repo or to original if based on someone elses unmodified work):
Description:
This is a service menu to download subtitles from opensubtitle.org
just right click on a video file -> actions -> download subtitle, it will show you a list of subtitles select one and it will be downloaded and saved with the same name as the video (with a subtitle extension of course), so your player will detect automatically the subtitle
The search is done extracting a hash from the file, this way you will get the correct subtitle for sure (no more async problems)
thank you to opensubtitles.org for that great service, hope this will be implemented directly in media players
- To install:
KDE3: Copy download_subtitle.desktop to ~/.kde/share/apps/konqueror/servicemenus
KDE4: Copy download_subtitle.desktop to ~.kde/share/kde4/services/ServiceMenus
Copy download_subtitle.py to some dir of your path (i.e. ~/bin)
- Dependencies:
python
wget
kdialog
The default language is english, you can change it in the python file Last changelog:
just right click on a video file -> actions -> download subtitle, it will show you a list of subtitles select one and it will be downloaded and saved with the same name as the video (with a subtitle extension of course), so your player will detect automatically the subtitle
The search is done extracting a hash from the file, this way you will get the correct subtitle for sure (no more async problems)
thank you to opensubtitles.org for that great service, hope this will be implemented directly in media players
- To install:
KDE3: Copy download_subtitle.desktop to ~/.kde/share/apps/konqueror/servicemenus
KDE4: Copy download_subtitle.desktop to ~.kde/share/kde4/services/ServiceMenus
Copy download_subtitle.py to some dir of your path (i.e. ~/bin)
- Dependencies:
python
wget
kdialog
The default language is english, you can change it in the python file
Added support for the new OpenSubtitles API - Thanks Nicola Felice!
Ratings & Comments
26 Comments
I've uploaded a working version named kdeServiceMenuOpenSubtitles here: http://kde-apps.org/content/show.php/kdeServiceMenuOpenSubtitles?content=169223 The problem was caused by OpenSubtitles.org guys changing the user agent used for development purposes used by this script. Now i requested a regulard user agent so this wont happen anymore. I've also made some minor changes in the dialogs but everything else is the same.
Try changing session = server.LogIn("","","en","python") to session = server.LogIn("","","en","OS Test User Agent")
Thanks. It solved the problem.
I have a similar problem: Login failed: 415 Disabled user agent
I've uploaded a working version here: http://kde-apps.org/content/show.php/kdeServiceMenuOpenSubtitles?content=169223 The problem was caused by OpenSubtitles.org guys changing the user agent used for development purposes used by this script.
I did everything that zipizap123 has written and still it doesn't work. When I clock on Download subtitle from opensubtitles.net in the service menu, a task titled "Download Subtitles from opensubtitle" opens for a few seconds, no window, only visible in the task manager, and then it automatically closes without any error or result. Any solution?
The script version 0.3 (last updated in Jan 17 2009) was proved to work in KDE4 (KDE4.4.2), with the following procedure for Kubuntu (or any other debian/ubuntu based system) 1- Download the script using this page "download" button 2- Open a console in the folder where you downloaded the script 3- Untar the downloaded file (it will create a directory named "download_opensubtitle/".). Type in the console: [b] tar -zxvf 65444-download_opensubtitle.tar.gz" [\b] 4- Install the Service-menu-script file to the correct location (the following destination directory is for KDE4. For KDE3 it is different). Type in the console: [b] ServiceMenu_script_file_kde4="download_opensubtitle/kde4/download_opensubtitle.desktop" Destination_dir_kde4="$HOME/.kde/share/kde4/services/ServiceMenus" mkdir -p $Destination_dir_kde4 cp -v $ServiceMenu_script_file_kde4 $Destination_dir_kde4 [\b] 4.99- At the current version 0.3 of the script there is an error in line 56 (as explained by <<eneko>> in the above comments) of the python file, and it needs to be corrected so that it works. Type this in the console to correct it: [b] sed --in-place 's_http://www.opensubtitles.org/xml-rpc_http://api.opensubtitles.org/xml-rpc_g' download_opensubtitle/download_opensubtitle.py [\b] 5- Install the python file to "/usr/local/bin" [b] Python_file_kde4="download_opensubtitle/download_opensubtitle.py" cp -v $Python_file_kde4 /usr/local/bin [\b] 6- Check that your system has all the needed dependencies (most probably it will already have them installed, but if not just you can install them this way). Type this in a console, inserting your password when asked: sudo apt-get install wget python And you are done - it will be working by now, try it in konqueror :) My respects to the creator and to eneko for the great sharings - this post is intended to make an updated resume of how to make this service-menu-script work without worries. Hope to see this comment replied some day with something like "thanks" or maybe even with a "no-more-need-for-this-as-the-script-has-been-updated-by-author" :) zipizap
well, my previous post looks horrible - the BBCode formating is not working and I can't do anything to fix it, not at my control... simply ignore completely all the "[b]" and "[\b]" and it will work
The script version 0.3 (last updated in Jan 17 2009) was proved to work in KDE4 (KDE4.4.2), with the following procedure for Kubuntu (or any other debian/ubuntu based system) 1- Download the script using this page "download" button 2- Open a console in the folder where you downloaded the script 3- Untar the downloaded file (it will create a directory named "download_opensubtitle/".). Type in the console: [b] tar -zxvf 65444-download_opensubtitle.tar.gz" [\b] 4- Install the Service-menu-script file to the correct location (the following destination directory is for KDE4. For KDE3 it is different). Type in the console: [b] ServiceMenu_script_file_kde4="download_opensubtitle/kde4/download_opensubtitle.desktop" Destination_dir_kde4="$HOME/.kde/share/kde4/services/ServiceMenus" mkdir -p $Destination_dir_kde4 cp -v $ServiceMenu_script_file_kde4 $Destination_dir_kde4 [\b] 4.99- At the current version 0.3 of the script there is an error in line 56 (as explained by <<eneko>> in the above comments) of the python file, and it needs to be corrected so that it works. Type this in the console to correct it: [b] sed --in-place 's_http://www.opensubtitles.org/xml-rpc_http://api.opensubtitles.org/xml-rpc_g' download_opensubtitle/download_opensubtitle.py [\b] 5- Install the python file to "/usr/local/bin" [b] Python_file_kde4="download_opensubtitle/download_opensubtitle.py" cp -v $Python_file_kde4 /usr/local/bin [\b] 6- Check that your system has all the needed dependencies (most probably it will already have them installed, but if not just you can install them this way). Type this in a console, inserting your password when asked: sudo apt-get install wget python And you are done - it will be working by now, try it in konqueror :) My respects to the creator and to eneko for the great sharings - this post is intended to make an updated resume of how to make this service-menu-script work without worries. Hope to see this comment replied some day with something like "thanks" or maybe even with a "no-more-need-for-this-as-the-script-has-been-updated-by-author" :) zipizap
I try the script, but it always crushes... it only displays a dialgobox saying "An Error ocurred".... I tryed to run it from Konsole and I get the same error, but no explanation about what could it be...
When I try downloading subtitles with this script, it crashes with the following error message: Quote:
Traceback (most recent call last):
File "download_opensubtitle.py", line 64, in <module>
token = session["token"]
KeyError: 'token'
Any ideas what went wrong?
Thanks,
Stefan
URL of the opensubtitles.com API has changed, you must correct this in download_opensubtitle.py: Line 56: BEFORE (wrong) server = ServerProxy("http://www.opensubtitles.org/xml-rpc") AFTER (correct) ServerProxy("http://api.opensubtitles.org/xml-rpc") Changing the URL solved the problem for me, hope it helps anyone else. Nice work Hirs! Eneko
support for rmvb and other formats? thanks for this script
Thank you for this little gem!
i can't get it to work with croatian subs, i tried hr, hrv and cro... all i get is: No subtitles found. message, but i know there is at least one.
Try scr Found codes here: http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes Remember that may be there are subtitles for that title but not for that file
for example i tried this one: http://www.opensubtitles.org/en/subtitles/23530/the-family-man-hr ... it matches almost every line in the movie, and it didn't find anything with scr, hr or hrv... i think it should be hrv because when i click on the link: Find all subtitles for this movie in this language... it takes me to this page: http://www.opensubtitles.org/en/search/sublanguageid-hrv/idmovie-3561
Thanks, it's working great! And I like the widget style you're using, specially the first shot. What is it?
It's domino widget style, the best polished style I've ever used
Ditto :) What style is it? I can't place the rounded menus, but they look pretty slick.
Hi, I've tried your servicemenu and I noticed that it has problems with files containing spaces. I believe it can be fixed by adding apostrophes around destination file in wget command: response = os.system('wget -O - ' + subURL + ' | gunzip > ' + "'" + subDirName + '/' + subFileName + "'" ). I wanted to send you a patch but I was not able to find your mail address. You can contact me at petr(dot)uzel(at)centrum(dot)cz
thanks knot
An error ocurred downloading or writing the subtitle
Can you create and write files in your video directory? Or may be something went wrong with wget, do you have wget installed?
yes i can create and write files in my directory . and wget is installed