SubtitleDownloader

Discussion in 'SubCentral' started by seco, October 7, 2009.

  1. seco
    • Team MediaPortal

    seco Development Group

    Joined:
    August 7, 2007
    Messages:
    1,579
    Likes Received:
    897
    Gender:
    Male
    Ratings:
    +1,234 / 4
    Home Country:
    Finland Finland
    Show System Specs
    SubtitleDownloader is a C# API library for downloading subtitles from various multi-language subtitle sites.
    It was originally developed to be used with MediaPortal plugins but it can be also used in any .NET project.

    Note: SubtitleDownloader is not a plugin for Mediaportal, My TVSeries or Moving Pictures. It is a standalone library which can be easily re-used in C# applications such as Mediaportal plugins and MP2. This way subtitle sites, searching & downloading logic can be centralized to one library and not directly to one specific plugin.

    If you find the project useful, you can support the development by donating via PayPal

    brotips/subtitledownloader


     
    Last edited: October 20, 2018
    • Like Like x 37
    • Thank You! Thank You! x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. seco
    • Team MediaPortal

    seco Development Group

    Joined:
    August 7, 2007
    Messages:
    1,579
    Likes Received:
    897
    Gender:
    Male
    Ratings:
    +1,234 / 4
    Home Country:
    Finland Finland
    Show System Specs
    Code examples

    Searching subtitles
    Code (Text):
    1. ISubtitlesDownloader downloader = new OpenSubtitlesDownloader();
    2. SearchQuery query = new SearchQuery("batman");
    3. query.Year = "2005";
    4. query.LanguageCodes = new string[] { "fin", "swe" };
    5.  
    6. List<Subtitle> results = downloader.SearchSubtitles(query); // return Finnish and Swedish subtitles for "Batman Begins";
    7. ISubtitlesDownloader downloader = new SubtitleSourceDownloaderV2();
    8. ImdbSearchQuery query = new ImdbSearchQuery("0372784");
    9. query.LanguageCodes = new string[] { Languages.GetLanguageCode("Swedish") };
    10.  
    11. List<Subtitle> results = downloader.SearchSubtitles(query); // return Swedish subtitles for "Batman Begins";
    12. ISubtitlesDownloader downloader = new SublightDownloader();
    13.  
    14. EpisodeSearchQuery query = new EpisodeSearchQuery("Heroes", 1, 3);
    15. //query.LanguageCodes = new string[] { "fin" };// default language is "eng"
    16. List<Subtitle> results = downloader.SearchSubtitles(query); // return English subtitles for "Heroes" season 1 episode 3;
    Saving subtitles
    Code (Text):
    1. ISubtitlesDownloader downloader = new OpenSubtitlesDownloader();
    2.  
    3. // Perform search
    4. List<Subtitle> results = ...
    5.  
    6. // Download & save
    7. Subtitle subtitle = results[0];
    8. List<FileInfo> subtitleFiles = downloader.SaveSubtitle(subtitle);
    9. FileInfo subtitleFile = subtitleFiles[0];
    10.  
    11. string videoFileName = "C:\Heroes.S04E03.720p.HDTV.X264-DIMENSION.avi";
    12. string targetSubtitleFile = FileUtils.GetFileNameForSubtitle(subtitleFile.FileName, subtitle.LanguageCode, videoFileName);
    13.  
    14. // targetSubtitleFile is now "C:\Heroes.S04E03.720p.HDTV.X264-DIMENSION.English.srt"
    15. // if targetSubtitleFile exists, dialog for overwrite
    16. File.Move(subtitleFileName.FullName, targetSubtitleFile);
     
    Last edited: October 20, 2018
    • Like Like x 2
  4. 1stdead

    1stdead Portal Pro

    Joined:
    February 1, 2008
    Messages:
    1,089
    Likes Received:
    139
    Location:
    Copenhagen
    Ratings:
    +139 / 0
    Home Country:
    Denmark Denmark
    Cool. I know this might be difficult. But why not adding subscene.com? Most subtitles are released here. Unfortunately you can't use hash"codes" only name. Series might be hard to filter also. But i think that would be great.
    Tvsubtitles is great for series(MPTVseries currently uses it)
    maybe Moviesubtitles.org - Download latest DivX/Xvid movies subtitles is worth considering as well?

    But really great work i must say. Remember to talk to the devs :)
     
  5. kgk

    kgk Portal Member

    Joined:
    October 31, 2006
    Messages:
    27
    Likes Received:
    2
    Ratings:
    +2 / 0
    Home Country:
    Netherlands Netherlands
    OMG! Yay!. This sound awsome. Thank you for doing the work on this. Hopefully this will lead to much better and more robust auto subtitle download feature .
     
  6. rasmuskarlsen

    rasmuskarlsen Portal Pro

    Joined:
    October 9, 2008
    Messages:
    235
    Likes Received:
    12
    Ratings:
    +12 / 0
    Home Country:
    Denmark Denmark
    Can this also be used for movies?
     
  7. seco
    • Team MediaPortal

    seco Development Group

    Joined:
    August 7, 2007
    Messages:
    1,579
    Likes Received:
    897
    Gender:
    Male
    Ratings:
    +1,234 / 4
    Home Country:
    Finland Finland
    Show System Specs
    Yes, of course. SubtitleDownloader is an independent library which can be used in any C# program to find subtitles for TV series, movies etc.

    As I said in the first post, "The idea is that this library could be used by both My TVSeries and Moving Pictures in the near future."
     
  8. rasmuskarlsen

    rasmuskarlsen Portal Pro

    Joined:
    October 9, 2008
    Messages:
    235
    Likes Received:
    12
    Ratings:
    +12 / 0
    Home Country:
    Denmark Denmark
    Sounds really nice... When do yuo think it would be ready for using it with movies!?
     
  9. seco
    • Team MediaPortal

    seco Development Group

    Joined:
    August 7, 2007
    Messages:
    1,579
    Likes Received:
    897
    Gender:
    Male
    Ratings:
    +1,234 / 4
    Home Country:
    Finland Finland
    Show System Specs
    I'm currently finishing v0.3 up which is more suitable for movies. After this, there should be no more changes to API.

    In v0.3 movie subtitles can be queried by IMDB ID (already supported in v0.2):

    Code (Text):
    1. ISubtitlesDownloader downloader = new SubtitleSourceDownloaderV2();
    2. ImdbSearchQuery query = new ImdbSearchQuery("0372784");
    3. List<Subtitle> results = new List<Subtitle>();
    4. results = downloader.SearchSubtitles(query);              // return subtitles for "Batman Begins"
    or by query string and optionally a year:

    Code (Text):
    1. ISubtitlesDownloader downloader = new OpenSubtitlesDownloader();
    2. SearchQuery query = new SearchQuery("batman");
    3. query.Year = "2005";
    4. List<Subtitle> results = new List<Subtitle>();
    5. results = downloader.SearchSubtitles(query);              // return subtitles for "Batman Begins"
     
  10. rasmuskarlsen

    rasmuskarlsen Portal Pro

    Joined:
    October 9, 2008
    Messages:
    235
    Likes Received:
    12
    Ratings:
    +12 / 0
    Home Country:
    Denmark Denmark
    Which site does your plugin get subtitles from!?

    Because i have allready tried: vroksub - Project Hosting on Google Code

    And it's getting from Opensibtitles.org, and that site isn't one of the best :/ Ex. Subscene is way much better, and holds many more subtitles for movies.. Ex, if i use Opensubtitles.org i can aprox get 5/10 subtitles downloaded (In combination between english and my native language), but if i use Subscene.com, i can aprox get 9/10 downloaded :)
     
  11. Spragleknas
    • Team MediaPortal
    • Administrator

    Spragleknas Administrator

    Joined:
    December 21, 2005
    Messages:
    9,472
    Likes Received:
    1,385
    Gender:
    Male
    Occupation:
    Occupied
    Location:
    Located
    Ratings:
    +1,892 / 12
    Home Country:
    Norway Norway
    Show System Specs
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!