Skip to content

Commit

Permalink
Make ld-decode into a Python package.
Browse files Browse the repository at this point in the history
The modules are now all in an "lddecode" package. The scripts that are
useful for end-users will be installed.

I've done this with distutils.core rather than setuptools because it
doesn't need any of the extra stuff setuptools provides, and
distutils.core is usefully less picky about where it installs to.

I've also trimmed some imports that aren't being used.
  • Loading branch information
atsampson committed Dec 25, 2019
1 parent 84d9831 commit 1049f1c
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ tbc-pal32
numpy
scipy

# Some odd python thing
# Python build results
/MANIFEST
__pycache__
/build
/dist

# Prerequisites
*.d
Expand Down
5 changes: 2 additions & 3 deletions cx-expander.py → cx-expander
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!python3
#!/usr/bin/env python3

from datetime import datetime
import getopt
Expand All @@ -13,8 +13,7 @@
import scipy.signal as sps
import scipy.fftpack as fftpack

from lddutils import *
import lddecode_core as ldd
from lddecode.utils import *

'''
Expand Down
5 changes: 2 additions & 3 deletions ld-cut.py → ld-cut
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
import traceback
import subprocess

from lddutils import *
import lddecode_core
from lddecode_core import *
from lddecode.core import *
from lddecode.utils import *

parser = argparse.ArgumentParser(description='Extracts a sample area from raw RF laserdisc captures')
parser.add_argument('infile', metavar='infile', type=str, help='source file')
Expand Down
5 changes: 2 additions & 3 deletions ld-decode.py → ld-decode
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
import json
import traceback

from lddutils import *
import lddecode_core
from lddecode_core import *
from lddecode.core import *
from lddecode.utils import *

options_epilog = """FREQ can be a bare number in MHz, or a number with one of the case-insensitive suffixes Hz, kHz, MHz, GHz, fSC (meaning NTSC) or fSCPAL."""
parser = argparse.ArgumentParser(description='Extracts audio and video from raw RF laserdisc captures', epilog=options_epilog)
Expand Down
12 changes: 12 additions & 0 deletions lddecode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python3
# Initialisation for the lddecode package.

__all__ = [
'commpy_filters',
'core',
'efm_pll',
'fdls',
'fft8',
'plot_utils',
'utils',
]
File renamed without changes.
7 changes: 2 additions & 5 deletions lddecode_core.py → lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@
import numpy.fft as npfft

#internal libraries
import commpy_filters

import fdls
import efm_pll
from lddutils import *
from lddecode import efm_pll
from lddecode.utils import *

try:
# If Anaconda's numpy is installed, mkl will use all threads for fft etc
Expand Down
File renamed without changes.
File renamed without changes.
0 fft8.py → lddecode/fft8.py
100755 → 100644
File renamed without changes.
2 changes: 0 additions & 2 deletions ld_utils.py → lddecode/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import scipy.signal as sps
import sys

import fdls as fdls
import matplotlib.pyplot as plt
import fft8 as fft8

pi = np.pi
tau = np.pi * 2
Expand Down
3 changes: 0 additions & 3 deletions lddutils.py → lddecode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
import matplotlib
import matplotlib.pyplot as plt

#internal libraries which may or may not get used
import fdls

def todb(y, zero = False):
db = 20 * np.log10(np.abs(y))
if zero:
Expand Down
2 changes: 1 addition & 1 deletion scripts/decode-ralf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ralf includes a bit of extra data on each side - will be useful for seeking and limits later
python3 ld-decode.py ~/ralf_side1_6x_2018-10-09_21-41-14.lds ralf -s 7 -l 244 --NTSCJ --EFM
python3 ld-decode ~/ralf_side1_6x_2018-10-09_21-41-14.lds ralf -s 7 -l 244 --NTSCJ --EFM
#
# -I 0 sets ire to 0, HE-010 is a Japanese LD
ld-chroma-decoder --3d -l 245 ralf.tbc ralf.rgb
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/test-decode
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def run_ld_decode(args):

clean(args, ['.tbc', '.tbc.json', '.efm', '.pcm'])

cmd = [src_dir + '/ld-decode.py']
cmd = [src_dir + '/ld-decode']
cmd += ['--ignoreleadout']
if args.pal:
cmd += ['--pal']
Expand Down
37 changes: 37 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/python3

from distutils.core import setup

setup(
name='ld-decode',
version='7',

description='Software defined LaserDisc decoder',
url='https://github.com/happycube/ld-decode',
keywords=['video', 'LaserDisc'],
classifiers=[
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Video :: Capture',
],

packages=['lddecode'],
scripts=[
'cx-expander',
'ld-cut',
'ld-decode',
'scripts/ld-compress',
],

# These are just the minimal runtime dependencies for the Python scripts --
# see the documentation for the full list of dependencies.
provides=['lddecode'],
requires=[
'numba',
'numpy',
'scipy',
],
)

0 comments on commit 1049f1c

Please sign in to comment.