Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Python 3 #36

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[flake8]
exclude =
.git,
build,
dist,
*.egg-info,
venv,
__pycache__,

extend-ignore =
E501, # max line length
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tests/media
dist
build
tests.json
*.egg-info
18 changes: 8 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
dist: bionic
language: python
python:
- 3.5
- 3.6
- 3.7
- 3.8

virtualenv:
system_site_packages: true
before_install:
- sudo apt-get update
- sudo apt-get install python-opencv
- sudo dpkg -L python-opencv
- sudo ln /dev/null /dev/raw1394
install:
- "pip install -r requirements.txt"
- pip install opencv-python-headless
- pip install -r requirements.txt

python:
- "2.7"
script:
- python run-tests.py
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Do note that WAV is not the only format Sushi can work with. It can process audi
### Requirements
Sushi should work on Windows, Linux and OS X. Please open an issue if it doesn't. To run it, you have to have the following installed:

1. [Python 2.7.x][5]
1. [Python 3.5 or higher][5]
2. [NumPy][6] (1.8 or newer)
3. [OpenCV 2.4.x or newer][7] (on Windows putting [this file][8] in the same folder as Sushi should be enough, assuming you use x86 Python)
3. [OpenCV 2.4.x or newer][7]

Optionally, you might want:

Expand All @@ -41,16 +41,21 @@ The provided Windows binaries include all required components and Colorama so yo

#### Installation on Mac OS X

No binary packages are provided for OS X right now so you'll have to use the script form. Assuming you have python 2, pip and [homebrew](http://brew.sh/) installed, run the following:
No binary packages are provided for OS X right now so you'll have to use the script form. Assuming you have Python 3, pip and [homebrew](http://brew.sh/) installed, run the following:
```bash
brew tap homebrew/science
brew install git opencv
pip install numpy
git clone https://github.com/tp7/sushi
# create a symlink if you want to run sushi globally
ln -s `pwd`/sushi/sushi.py /usr/local/bin/sushi
pip3 install numpy
# install some optional dependencies
brew install ffmpeg mkvtoolnix

# fetch sushi
git clone https://github.com/tp7/sushi
# run from source
python3 -m sushi args…
# install globally (for your user)
python3 setup.py install --user
sushi args…
```
If you don't have pip, you can install numpy with homebrew, but that will probably add a few more dependencies.
```bash
Expand All @@ -62,9 +67,13 @@ brew install numpy
If you have apt-get available, the installation process is trivial.
```bash
sudo apt-get update
sudo apt-get install git python python-numpy python-opencv
sudo apt-get install git python3 python3-numpy python3-opencv
git clone https://github.com/tp7/sushi
ln -s `pwd`/sushi/sushi.py /usr/local/bin/sushi
# run from source
python3 -m sushi args…
# install globally (for your user; ensure ~/.local/bin is in your PATH)
python3 setup.py install --user
sushi args…
```

### Limitations
Expand All @@ -82,7 +91,6 @@ In short, while this might be safe for immediate viewing, you probably shouldn't
[5]: https://www.python.org/downloads/
[6]: http://www.scipy.org/scipylib/download.html
[7]: http://opencv.org/
[8]: https://www.dropbox.com/s/nlylgdh4bgrjgxv/cv2.pyd?dl=0
[9]: http://www.ffmpeg.org/download.html
[10]: http://www.bunkus.org/videotools/mkvtoolnix/downloads.html
[11]: https://github.com/soyokaze/SCXvid-standalone/releases
5 changes: 3 additions & 2 deletions build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ pyinstaller --noupx --onefile --noconfirm ^
--exclude-module Tkconstants ^
--exclude-module Tkinter ^
--exclude-module matplotlib ^
sushi.py
--name sushi ^
sushi/__main__.py

mkdir dist\licenses
copy /Y licenses\* dist\licenses\*
copy LICENSE dist\licenses\Sushi.txt
copy README.md dist\readme.md
copy README.md dist\readme.md
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
numpy
mock
9 changes: 5 additions & 4 deletions run-tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest
from tests.timecodes import *
from tests.main import *
from tests.subtitles import *
from tests.demuxing import *

from tests.timecodes import * # noqa
from tests.main import * # noqa
from tests.subtitles import * # noqa
from tests.demuxing import * # noqa

unittest.main(verbosity=0)
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from distutils.core import setup
from setuptools import setup
import sushi

setup(
name='Sushi',
description='Automatic subtitle shifter based on audio',
packages=['sushi'],
version=sushi.VERSION,
url='https://github.com/tp7/Sushi',
console=['sushi.py'],
license='MIT'
license='MIT',
entry_points={
'console_scripts': [
"sushi=sushi.__main__:main",
],
},
)

Loading