mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Cleanups from @mvdbeek
Thanks! Co-authored-by: Marius van den Beek <m.vandenbeek@gmail.com>
This commit is contained in:
committed by
mvdbeek
co-authored by
Marius van den Beek
parent
22c63a4aed
commit
18a5ac20d0
@@ -19,8 +19,6 @@ variables:
|
||||
run: sudo pip install tox
|
||||
install_ffprobe: &install_ffprobe
|
||||
run: sudo apt-get update && sudo apt-get install ffmpeg -y
|
||||
install_wave: &install_wave
|
||||
run: sudo pip install wave
|
||||
set_workdir: &set_workdir
|
||||
working_directory: ~/repo
|
||||
requires_get_code: &requires_get_code
|
||||
@@ -108,7 +106,6 @@ jobs:
|
||||
steps:
|
||||
- *restore_repo_cache
|
||||
- *install_tox
|
||||
- *install_wave
|
||||
- *install_ffprobe
|
||||
- run: tox -e py35-unit
|
||||
py35_first_startup:
|
||||
@@ -139,7 +136,6 @@ jobs:
|
||||
steps:
|
||||
- *restore_repo_cache
|
||||
- *install_tox
|
||||
- *install_wave
|
||||
- *install_ffprobe
|
||||
- run: tox -e test_galaxy_packages
|
||||
js_unit:
|
||||
|
||||
@@ -55,10 +55,9 @@ jobs:
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('galaxy root/requirements.txt') }}
|
||||
- name: Install wave
|
||||
run: pip install wave
|
||||
- name: Install ffmpeg
|
||||
run: sudo apt-get update && sudo apt-get install ffmpeg -y
|
||||
if: matrix.subset == 'upload_datatype'
|
||||
- name: Run tests
|
||||
run: './run_tests.sh -integration test/integration -- -k "${{ matrix.subset }}"'
|
||||
working-directory: 'galaxy root'
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
"""Video classes"""
|
||||
import json
|
||||
import subprocess
|
||||
try:
|
||||
import wave
|
||||
except ImportError:
|
||||
wave = None
|
||||
import wave
|
||||
|
||||
from galaxy.datatypes.binary import Binary
|
||||
from galaxy.datatypes.metadata import ListParameter, MetadataElement
|
||||
@@ -76,8 +73,6 @@ class Mkv(Video):
|
||||
if which('ffprobe'):
|
||||
metadata, streams = ffprobe(filename)
|
||||
return 'matroska' in metadata['format_name'].split(',')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class Mp4(Video):
|
||||
@@ -97,8 +92,6 @@ class Mp4(Video):
|
||||
if which('ffprobe'):
|
||||
metadata, streams = ffprobe(filename)
|
||||
return 'mp4' in metadata['format_name'].split(',')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class Flv(Video):
|
||||
@@ -108,8 +101,6 @@ class Flv(Video):
|
||||
if which('ffprobe'):
|
||||
metadata, streams = ffprobe(filename)
|
||||
return 'flv' in metadata['format_name'].split(',')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class Mpg(Video):
|
||||
@@ -119,8 +110,6 @@ class Mpg(Video):
|
||||
if which('ffprobe'):
|
||||
metadata, streams = ffprobe(filename)
|
||||
return 'mpegvideo' in metadata['format_name'].split(',')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class Mp3(Audio):
|
||||
@@ -139,8 +128,6 @@ class Mp3(Audio):
|
||||
if which('ffprobe'):
|
||||
metadata, streams = ffprobe(filename)
|
||||
return 'mp3' in metadata['format_name'].split(',')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class WAV(Binary):
|
||||
@@ -181,26 +168,18 @@ class WAV(Binary):
|
||||
>>> WAV().sniff(fname)
|
||||
False
|
||||
"""
|
||||
if wave:
|
||||
try:
|
||||
fp = wave.open(filename, 'rb')
|
||||
fp.close()
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
with wave.open(filename, 'rb') as fp:
|
||||
return True
|
||||
|
||||
def set_meta(self, dataset, overwrite=True, **kwd):
|
||||
"""Set the metadata for this dataset from the file contents
|
||||
"""
|
||||
|
||||
try:
|
||||
fd = wave.open(dataset.dataset.file_name, 'rb')
|
||||
dataset.metadata.rate = fd.getframerate()
|
||||
dataset.metadata.nframes = fd.getnframes()
|
||||
dataset.metadata.sampwidth = fd.getsampwidth()
|
||||
dataset.metadata.nchannels = fd.getnchannels()
|
||||
with wave.open(dataset.dataset.file_name, 'rb') as fd:
|
||||
dataset.metadata.rate = fd.getframerate()
|
||||
dataset.metadata.nframes = fd.getnframes()
|
||||
dataset.metadata.sampwidth = fd.getsampwidth()
|
||||
dataset.metadata.nchannels = fd.getnchannels()
|
||||
except wave.Error:
|
||||
pass
|
||||
finally:
|
||||
fd.close()
|
||||
|
||||
@@ -10,7 +10,6 @@ class TextGrid(Text):
|
||||
>>> fname = get_test_fname('1_1119_2_22_001.textgrid')
|
||||
>>> TextGrid().sniff(fname)
|
||||
True
|
||||
|
||||
>>> fname = get_test_fname('drugbank_drugs.cml')
|
||||
>>> TextGrid().sniff(fname)
|
||||
False
|
||||
@@ -28,11 +27,8 @@ class TextGrid(Text):
|
||||
|
||||
with open(filename, 'r') as fd:
|
||||
text = fd.read(len(self.header))
|
||||
|
||||
return text == self.header
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class BPF(Text):
|
||||
"""Munich BPF annotation format
|
||||
@@ -42,11 +38,9 @@ class BPF(Text):
|
||||
>>> fname = get_test_fname('1_1119_2_22_001.par')
|
||||
>>> BPF().sniff(fname)
|
||||
True
|
||||
|
||||
>>> fname = get_test_fname('1_1119_2_22_001-1.par')
|
||||
>>> BPF().sniff(fname)
|
||||
True
|
||||
|
||||
>>> fname = get_test_fname('drugbank_drugs.cml')
|
||||
>>> BPF().sniff(fname)
|
||||
False
|
||||
|
||||
Reference in New Issue
Block a user