Skip to content

Commit c78b868

Browse files
author
Calvin Xu
committed
Bug Fix & PyPI
1 parent 6717334 commit c78b868

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

mach3/cli.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
from mach3.db_index import add_entries
55
import sqlalchemy
66
from textwrap import dedent
7-
try:
8-
from mach3.db_query import index_search
9-
except sqlalchemy.exc.NoSuchTableError:
10-
print("No index database found. Please index this directory first.")
11-
exit(0)
7+
from mach3.db_query import index_search
128
from mach3.mkv_interface import mkv_play
139

1410

@@ -32,7 +28,11 @@ def main(index, search, help, dir_query):
3228
click.echo("Indexing complete")
3329
elif search:
3430
click.echo("Searching {} from index".format(dir_query))
35-
options = index_search(dir_query)
31+
try:
32+
options = index_search(dir_query)
33+
except NameError:
34+
click.echo("No index database found. Please index this directory first: $ mach3 -i")
35+
exit(0)
3636
if len(options) == 0:
3737
click.echo("I cannot find anything for you, Misaka tries and fails.")
3838
exit(0)

mach3/db_query.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
from sqlalchemy.orm import sessionmaker
22
from sqlalchemy import create_engine
33
from sqlalchemy.ext.declarative import declarative_base
4+
import sqlalchemy
45

56
engine = create_engine('sqlite:///index_mach3.db', echo=False)
67

78
Base = declarative_base(engine)
89

9-
10-
class Subtitle(Base):
11-
__tablename__ = "subtitle"
12-
__table_args__ = {"autoload": True}
10+
try:
11+
class Subtitle(Base):
12+
__tablename__ = "subtitle"
13+
__table_args__ = {"autoload": True}
14+
except sqlalchemy.exc.NoSuchTableError:
15+
print("No index database found. Please index this directory first: $ mach3 -i")
1316

1417

1518
def loadSession():

setup.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@
33
"""
44
from setuptools import find_packages, setup
55

6-
dependencies = ['click', 'ass', 'sqlalchemy']
7-
86
setup(
97
name='mach3',
10-
version='0.1.0',
8+
version='0.1.1.0.4',
119
url='https://github.com/Calvin-Xu/mach3-cli',
12-
license='BSD',
10+
download_url = 'https://github.com/Calvin-Xu/mach3-cli/archive/0.1.tar.gz',
11+
license='MIT',
1312
author='Pinlin Xu',
1413
author_email='[email protected]',
1514
description='Recursively parse and index subtitle text for future use.',
1615
long_description=__doc__,
1716
packages=find_packages(exclude=['tests']),
18-
include_package_data=True,
1917
zip_safe=False,
2018
platforms='any',
21-
install_requires=dependencies,
19+
install_requires=['click', 'ass', 'SQLAlchemy'],
2220
python_requires='>=3',
2321
entry_points={
2422
'console_scripts': [

0 commit comments

Comments
 (0)