Skip to content

Commit

Permalink
Merge pull request #60 from alecastle/master
Browse files Browse the repository at this point in the history
Implemented and tested CLI for multi-language support.
  • Loading branch information
manojmj92 authored Apr 16, 2018
2 parents 5e25e97 + 676b07e commit a39866a
Show file tree
Hide file tree
Showing 12 changed files with 470 additions and 141 deletions.
2 changes: 1 addition & 1 deletion Subtitle.cmd → bin/Subtitle.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IF EXIST C:\Python34\ SET PATH=%PATH%;C:\Python34\
IF EXIST C:\Python27\ SET PATH=%PATH%;C:\Python27\
:my_loop
IF %1=="" GOTO completed
python C:\subtitle-downloader.py %1
python C:\subtitle_downloader.py %1
SHIFT
GOTO my_loop
:completed
2 changes: 1 addition & 1 deletion Subtitles_In_English.sh → bin/Subtitles_In_English.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ IFS="
"

for line in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
full_path="/home/"$USER"/Desktop/"subtitle-downloader.py
full_path="/home/"$USER"/Desktop/"subtitle_downloader.py
python $full_path $line
notify-send $line
done
Expand Down
2 changes: 1 addition & 1 deletion Subtitles_In_English_for_nemo.sh → bin/Subtitles_In_English_for_nemo.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ IFS="
"

for line in $NEMO_SCRIPT_SELECTED_FILE_PATHS; do
full_path="/home/"$USER"/Desktop/"subtitle-downloader.py
full_path="/home/"$USER"/Desktop/subtitle-downloader/"subtitle_downloader.py
python $full_path $line
notify-send $line
done
Expand Down
36 changes: 36 additions & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# to be run in the same directory as "setup.py"

# Must use this unless there is an official release
development_build()
{
python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -e .
chmod +x bin/*.sh
}

development_build_uninstall()
{
rm -rf env/ subtitle-downloader.egg-info/
pip uninstall .
}

# Version to use if offical release ever happens
production_build()
{
pip install subtitle-downloader
}

if [ $1 = "uninstall" ]; then
development_build_uninstall
exit 0
fi

if [ $1 = "reinstall" ]; then
development_build_uninstall
fi

development_build
10 changes: 10 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# to be run in the same directory as "setup.py"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Forward all arguments directly to the program itself.
# e.g. running "./bin/run.sh --list -v" is equivalent to
# "python subtitle-downloader/subtitle_downloader.py --list -v"
python $DIR/../subtitle-downloader/subtitle_downloader.py "$@"
4 changes: 4 additions & 0 deletions bin/subtitle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for i in "$@"
do
python subtitle-downloader/subtitle_downloader.py "$i"
done
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Subtitle downloader."""


from setuptools import setup


setup(
name='subtitle-downloader',
version='0.1.0',
packages=['subtitle-downloader'],
include_package_data=True,
install_requires=[
"beautifulsoup4==4.6.0",
"bs4==0.0.1",
"certifi==2017.4.17",
"chardet==3.0.3",
"click==6.7",
"idna==2.5",
"lxml==3.8.0",
"requests==2.17.3",
"sh==1.12.14",
"urllib3==1.21.1"
]
)
134 changes: 0 additions & 134 deletions subtitle-downloader.py

This file was deleted.

2 changes: 2 additions & 0 deletions subtitle-downloader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Subtitle downloader package initialization."""
from subtitle_downloader import *
Loading

0 comments on commit a39866a

Please sign in to comment.