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

accuraterip-checksum: convert to python C extension #274

Merged
merged 2 commits into from
Oct 26, 2019
Merged
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
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ install:
# Testing dependencies
- pip install twisted flake8

# Build bundled C utils
- cd src
- sudo make install
- cd ..

# Installing
- python setup.py install

Expand Down
35 changes: 35 additions & 0 deletions scripts/accuraterip-checksum
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python
# SPDX-License-Identifier: GPL-3.0-only

import accuraterip
import sys


if len(sys.argv) == 2 and sys.argv[1] == '--version':
print('accuraterip-checksum version 2.0')
exit(0)

use_v1 = None
if len(sys.argv) == 4:
offset = 0
use_v1 = False
elif len(sys.argv) == 5:
offset = 1
if sys.argv[1] == '--accuraterip-v1':
use_v1 = True
elif sys.argv[1] == '--accuraterip-v2':
use_v1 = False

if use_v1 is None:
print('Syntax: accuraterip-checksum [--version / --accuraterip-v1 / --accuraterip-v2 (default)] filename track_number total_tracks')
exit(1)

filename = sys.argv[offset + 1]
track_number = int(sys.argv[offset + 2])
total_tracks = int(sys.argv[offset + 3])

v1, v2 = accuraterip.compute(filename, track_number, total_tracks)
if use_v1:
print('%08X' % v1)
else:
print('%08X' % v2)
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import setup, find_packages, Extension

setup(
name="whipper",
Expand All @@ -11,6 +11,11 @@
python_requires='>=2.7,<3',
packages=find_packages(),
setup_requires=['setuptools_scm'],
ext_modules=[
Extension('accuraterip',
libraries=['sndfile'],
sources=['src/accuraterip-checksum.c'])
],
entry_points={
'console_scripts': [
'whipper = whipper.command.main:main'
Expand All @@ -19,4 +24,7 @@
data_files=[
('share/metainfo', ['com.github.whipper_team.Whipper.metainfo.xml']),
],
scripts=[
'scripts/accuraterip-checksum',
],
)
1 change: 0 additions & 1 deletion src/.gitignore

This file was deleted.

47 changes: 0 additions & 47 deletions src/Makefile

This file was deleted.

Loading