Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Some minor improvements to the code #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Please Note: Subtitle file will be downloaded in to the same folder as the corre

![ezgif com-gif-maker](https://user-images.githubusercontent.com/55880211/79194420-21ebc280-7e4a-11ea-84b2-f155d43dcd0a.gif)

### Requirements
* Microsoft Windows
* Python 3
* git

### Git Installation
```
# clone the repo
Expand Down
15 changes: 6 additions & 9 deletions sbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import time
import hashlib
import requests
sameera-madushan marked this conversation as resolved.
Show resolved Hide resolved
import sys
import ctypes
import clr
from System.Windows.Forms import OpenFileDialog

banner = r'''
___ ___ ___ __ __
Expand All @@ -21,17 +25,10 @@

# got this from https://stackoverflow.com/a/58861718/13276219
def file_path():
import sys
import ctypes

co_initialize = ctypes.windll.ole32.CoInitialize
co_initialize(None)

import clr

clr.AddReference('System.Windows.Forms')

from System.Windows.Forms import OpenFileDialog

file_dialog = OpenFileDialog()
ret = file_dialog.ShowDialog()
Expand Down Expand Up @@ -69,7 +66,7 @@ def create_url():
url = "http://api.thesubdb.com/?action=search&hash={}".format(film_hash)
return url

def request_subtitile():
def request_subtitle():
url = create_url()
header = { "user-agent": "SubDB/1.0 (SubtitleBOX/1.0; https://github.com/sameera-madushan/SubtitleBOX.git)" }
req = requests.get(url, headers=header)
Expand All @@ -86,7 +83,7 @@ def request_subtitile():
print("Oops!! Subtitle not found.")
exit()

request_subtitile()
request_subtitle()

def download(data):
filename = file_path[:-4]
Expand Down