Skip to content

Commit

Permalink
Fixed some misspellings, minor refactoring, added README and a screen…
Browse files Browse the repository at this point in the history
…shot
  • Loading branch information
iboshkov committed Apr 28, 2017
1 parent 08318ca commit d392451
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 101 deletions.
89 changes: 0 additions & 89 deletions OpenSubSarchLib/ISubService.cs

This file was deleted.

2 changes: 1 addition & 1 deletion OpenSubSearch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSubSearch", "OpenSubSea
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSubSearchCLI", "OpenSubSearchCLI\OpenSubSearchCLI.csproj", "{3F3003AB-FFB4-4FC2-B170-2BDAE92ADEAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSubSarchLib", "OpenSubSarchLib\OpenSubSarchLib.csproj", "{BFF759AB-08E0-437B-9BC4-AF558B5D4B21}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSubSearchLib", "OpenSubSearchLib\OpenSubSearchLib.csproj", "{BFF759AB-08E0-437B-9BC4-AF558B5D4B21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
3 changes: 0 additions & 3 deletions OpenSubSearch/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;
using OpenSubSarchLib;
using OpenSubSearchLib;

namespace OpenSubSearch
Expand Down Expand Up @@ -197,8 +196,6 @@ private void searchHash_Click(object sender, EventArgs e)
private void download_Click(object sender, EventArgs e)
{
var sub = listView1.SelectedItems[0].Tag as Subtitle;
MessageBox.Show(this, sub.downloadLink.ToString());

Process.Start(sub.downloadLink.ToString());
}

Expand Down
4 changes: 2 additions & 2 deletions OpenSubSearch/OpenSubSearch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenSubSarchLib\OpenSubSarchLib.csproj">
<ProjectReference Include="..\OpenSubSearchLib\OpenSubSearchLib.csproj">
<Project>{bff759ab-08e0-437b-9bc4-af558b5d4b21}</Project>
<Name>OpenSubSarchLib</Name>
<Name>OpenSubSearchLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
4 changes: 2 additions & 2 deletions OpenSubSearchCLI/OpenSubSearchCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenSubSarchLib\OpenSubSarchLib.csproj">
<ProjectReference Include="..\OpenSubSearchLib\OpenSubSearchLib.csproj">
<Project>{bff759ab-08e0-437b-9bc4-af558b5d4b21}</Project>
<Name>OpenSubSarchLib</Name>
<Name>OpenSubSearchLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion OpenSubSearchCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Program
{
static void Main(string[] args)
{
FilenameParser parser = new FilenameParser("Fifty.Shades.Darker.2017.UNRATED.1080p.WEB-DL.DD5.1.H264-FGT");
FilenameParser parser = new FilenameParser("");
Console.WriteLine(parser.parse());
Console.ReadKey();
}
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions OpenSubSearchLib/ISubService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;

namespace OpenSubSearchLib
{
public interface ISubService
{
IList<Subtitle> searchSubtitlesFromFile(string languages, string filePath);
IList<Subtitle> searchSubtitlesFromQuery(string languages, string query, int? season = null, int? episode = null);

IList<Language> getAvailableLanguages();

string serviceId();
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace OpenSubSarchLib
namespace OpenSubSearchLib
{
public class OSDBService : ISubService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@
<ItemGroup>
<Compile Include="FilenameParser.cs" />
<Compile Include="HashUtils.cs" />
<Compile Include="ISubService.cs" />
<Compile Include="Metadata.cs" />
<Compile Include="OSDBService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ISubService.cs" />
<Compile Include="SubDataTypes.cs" />
<Compile Include="SubServiceFactory.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
File renamed without changes.
37 changes: 37 additions & 0 deletions OpenSubSearchLib/SubDataTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Text;
using System.Threading.Tasks;
using OSDBnet;

namespace OpenSubSearchLib
{
public class Subtitle
{
public string id { get; set; }
public string hash { get; set; }
public string fileName { get; set; }
public string moveId { get; set; }
public string imdbId { get; set; }
public string title { get; set; }
public string originalTitle { get; set; }
public int year { get; set; }
public string languageId { get; set; }
public string languageName { get; set; }
public string rating { get; set; }
public string bad { get; set; }
public Uri downloadLink { get; set; }
public Uri pageLink { get; set; }
}

public class Language
{
public String id_iso639;
public String service_id;
public String name;

public override string ToString()
{
return name;
}
}
}
33 changes: 33 additions & 0 deletions OpenSubSearchLib/SubServiceFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenSubSearchLib
{
public class SubServiceFactory
{
private Dictionary<String, ISubService> svcMap;

public SubServiceFactory()
{
svcMap = new Dictionary<string, ISubService>();
OSDBService svc = new OSDBService();
svcMap[svc.serviceId()] = svc;
}

public ISubService getService(string id)
{
return svcMap[id];
}

public List<String> getServiceIds()
{
return svcMap.Keys.ToList();
}

public ISubService getFirstService()
{
return svcMap.Values.ToList()[0];
}
}
}
File renamed without changes.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# open-sub-search
# Open Sub Search

Open Sub Search is a little side project I did in a few days as part of a project related to a course at my university and I though I might as well something I would use on a somewhat regular basis.

### What it does:
- Parses metadata from a given filename, extracting relevant information such as season, episode release group and so on.
- Searches through a subtitle provider based on given parameters or a file hash
- Provides quick downloading of a chosen subtitle
- Currently only supports OpenSubtitles.com but I hope to add more services in the future.

### Installation
Just grab a binary release from the [Releases page](https://github.com/iboshkov/open-sub-search/releases)


### How to use:
- Drag and drop a file into the application window, or use the "Open File" button to select a file to use as reference.
- Press either **"Search by Name"** or **"Search by Hash"**.
- Select a subtitle and press **"Download Subtitle"**

### Screenshots
![Open Sub Search](./screenshot.png "Main View")

### License
MIT (Check LICENSE for more info)
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d392451

Please sign in to comment.