decryptune 1.0.0__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {decryptune-1.0.0 → decryptune-1.1.0}/Cargo.lock +1 -1
- {decryptune-1.0.0 → decryptune-1.1.0}/Cargo.toml +1 -1
- {decryptune-1.0.0 → decryptune-1.1.0}/PKG-INFO +15 -26
- {decryptune-1.0.0 → decryptune-1.1.0}/README.md +14 -25
- {decryptune-1.0.0 → decryptune-1.1.0}/decryptune.py +12 -7
- {decryptune-1.0.0 → decryptune-1.1.0}/python/decryptune/__init__.py +11 -6
- {decryptune-1.0.0 → decryptune-1.1.0}/src/lib.rs +18 -4
- {decryptune-1.0.0 → decryptune-1.1.0}/src/meta.rs +1 -1
- {decryptune-1.0.0 → decryptune-1.1.0}/src/process.rs +7 -8
- {decryptune-1.0.0 → decryptune-1.1.0}/tests/test_decryptune.py +15 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/.gitattributes +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/.github/workflows/build.yml +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/.gitignore +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/LICENSE +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/pyproject.toml +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/src/boxes.rs +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/src/cover.rs +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/tests/fixtures/big.jpg +0 -0
- {decryptune-1.0.0 → decryptune-1.1.0}/tests/fixtures/tiny.jpg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: decryptune
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -21,20 +21,13 @@ Fast, native M4A (fMP4/CENC) decryptor + MP4 sanitizer + iTunes tagger in one li
|
|
|
21
21
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
|
-
**Wheel (recommended)** — the native module ships inside the package, fixed at install time:
|
|
25
|
-
|
|
26
24
|
```bash
|
|
27
|
-
pip install decryptune
|
|
25
|
+
pip install decryptune
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
**Standalone (no install)** — keep `decryptune.py` next to the extension binary:
|
|
28
|
+
**Standalone (no install)** — keep `decryptune.py` next to the extension binary and pass its path: `DecrypTune("./libdecryptune.so")`
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
from decryptune import DecrypTune
|
|
34
|
-
sp = DecrypTune("./libdecryptune.so")
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
From source (needs Rust 1.85+ and Python 3.12+): `pip install maturin && maturin build --release`
|
|
30
|
+
From source (needs Rust 1.85+ and Python 3.12+): `pip install maturin && maturin build --release` — this is also the macOS path (it builds and runs the same; prebuilt wheels and zips ship for Linux and Windows).
|
|
38
31
|
|
|
39
32
|
## Usage
|
|
40
33
|
|
|
@@ -57,7 +50,7 @@ sp.proc(
|
|
|
57
50
|
# date=..., album=..., genre=..., lyrics=..., composer=...,
|
|
58
51
|
# track=..., track_total=..., disc=..., disc_total=...
|
|
59
52
|
),
|
|
60
|
-
strict=True
|
|
53
|
+
strict=True # raise (code 8, per-fragment chi² evidence) when a fragment
|
|
61
54
|
) # decrypts to statistical noise — a wrong/fake key
|
|
62
55
|
|
|
63
56
|
# async twin — same options, same result:
|
|
@@ -70,23 +63,19 @@ Rules that hold for both `proc` and `aproc`:
|
|
|
70
63
|
- `out` is a path → the file is written **atomically** (tmp + rename) and `None` is returned; `out` is `None` → the processed `bytes` are returned.
|
|
71
64
|
- `key=None` → **fix-only pass**: headers sanitized, audio payload untouched.
|
|
72
65
|
- A `meta` **wipes** the existing tag block and rebuilds it solely from the given fields — `None` / `0` / empty values are skipped; without `meta` the original metadata passes through untouched.
|
|
73
|
-
- Any problem raises `DecrypTuneError` with a stable numeric code (1–
|
|
74
|
-
|
|
75
|
-
## Build
|
|
66
|
+
- Any problem raises `DecrypTuneError` with a stable numeric code (1–13) and a message authored in the native core: `1` invalid key · `2` invalid kid · `3` input not found · `4` not an MP4 · `6` write failed · `7` KID mismatch · `8` corrupt audio detected · `9` bad input type · `10` bad out type · `11` tags need a fragmented file · `12` bad cover · `13` cover file not found.
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
cargo build --release && cp target/release/libdecryptune.so .
|
|
79
|
-
maturin build --release # → target/wheels/*.whl
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Tests
|
|
68
|
+
## Benchmark
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
python3 -m pytest tests/
|
|
86
|
-
DECRYPTUNE_WHEEL=1 python3 -m pytest tests/ # against the installed wheel
|
|
87
|
-
```
|
|
70
|
+
Real 3.0MB fragmented track, Intel i7-11800H (8C/16T), WSL2, v1.1.0:
|
|
88
71
|
|
|
89
|
-
|
|
72
|
+
| scenario | result |
|
|
73
|
+
|---|---|
|
|
74
|
+
| decrypt + fix, strict (bytes in/out) | 3.7 ms median — ~0.8 GB/s |
|
|
75
|
+
| fix-only pass (no key) | 1.7 ms |
|
|
76
|
+
| full tags + cover resize (877KB JPEG) | 101 ms |
|
|
77
|
+
| 32 calls: sequential → `asyncio.gather` | 74 ms → 29 ms (**×2.5**) |
|
|
78
|
+
| event-loop max lag under 8 concurrent heavy calls | < 4 ms |
|
|
90
79
|
|
|
91
80
|
## License
|
|
92
81
|
|
|
@@ -4,20 +4,13 @@ Fast, native M4A (fMP4/CENC) decryptor + MP4 sanitizer + iTunes tagger in one li
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
**Wheel (recommended)** — the native module ships inside the package, fixed at install time:
|
|
8
|
-
|
|
9
7
|
```bash
|
|
10
|
-
pip install decryptune
|
|
8
|
+
pip install decryptune
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
**Standalone (no install)** — keep `decryptune.py` next to the extension binary:
|
|
11
|
+
**Standalone (no install)** — keep `decryptune.py` next to the extension binary and pass its path: `DecrypTune("./libdecryptune.so")`
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
from decryptune import DecrypTune
|
|
17
|
-
sp = DecrypTune("./libdecryptune.so")
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
From source (needs Rust 1.85+ and Python 3.12+): `pip install maturin && maturin build --release`
|
|
13
|
+
From source (needs Rust 1.85+ and Python 3.12+): `pip install maturin && maturin build --release` — this is also the macOS path (it builds and runs the same; prebuilt wheels and zips ship for Linux and Windows).
|
|
21
14
|
|
|
22
15
|
## Usage
|
|
23
16
|
|
|
@@ -40,7 +33,7 @@ sp.proc(
|
|
|
40
33
|
# date=..., album=..., genre=..., lyrics=..., composer=...,
|
|
41
34
|
# track=..., track_total=..., disc=..., disc_total=...
|
|
42
35
|
),
|
|
43
|
-
strict=True
|
|
36
|
+
strict=True # raise (code 8, per-fragment chi² evidence) when a fragment
|
|
44
37
|
) # decrypts to statistical noise — a wrong/fake key
|
|
45
38
|
|
|
46
39
|
# async twin — same options, same result:
|
|
@@ -53,23 +46,19 @@ Rules that hold for both `proc` and `aproc`:
|
|
|
53
46
|
- `out` is a path → the file is written **atomically** (tmp + rename) and `None` is returned; `out` is `None` → the processed `bytes` are returned.
|
|
54
47
|
- `key=None` → **fix-only pass**: headers sanitized, audio payload untouched.
|
|
55
48
|
- A `meta` **wipes** the existing tag block and rebuilds it solely from the given fields — `None` / `0` / empty values are skipped; without `meta` the original metadata passes through untouched.
|
|
56
|
-
- Any problem raises `DecrypTuneError` with a stable numeric code (1–
|
|
57
|
-
|
|
58
|
-
## Build
|
|
49
|
+
- Any problem raises `DecrypTuneError` with a stable numeric code (1–13) and a message authored in the native core: `1` invalid key · `2` invalid kid · `3` input not found · `4` not an MP4 · `6` write failed · `7` KID mismatch · `8` corrupt audio detected · `9` bad input type · `10` bad out type · `11` tags need a fragmented file · `12` bad cover · `13` cover file not found.
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
cargo build --release && cp target/release/libdecryptune.so .
|
|
62
|
-
maturin build --release # → target/wheels/*.whl
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Tests
|
|
51
|
+
## Benchmark
|
|
66
52
|
|
|
67
|
-
|
|
68
|
-
python3 -m pytest tests/
|
|
69
|
-
DECRYPTUNE_WHEEL=1 python3 -m pytest tests/ # against the installed wheel
|
|
70
|
-
```
|
|
53
|
+
Real 3.0MB fragmented track, Intel i7-11800H (8C/16T), WSL2, v1.1.0:
|
|
71
54
|
|
|
72
|
-
|
|
55
|
+
| scenario | result |
|
|
56
|
+
|---|---|
|
|
57
|
+
| decrypt + fix, strict (bytes in/out) | 3.7 ms median — ~0.8 GB/s |
|
|
58
|
+
| fix-only pass (no key) | 1.7 ms |
|
|
59
|
+
| full tags + cover resize (877KB JPEG) | 101 ms |
|
|
60
|
+
| 32 calls: sequential → `asyncio.gather` | 74 ms → 29 ms (**×2.5**) |
|
|
61
|
+
| event-loop max lag under 8 concurrent heavy calls | < 4 ms |
|
|
73
62
|
|
|
74
63
|
## License
|
|
75
64
|
|
|
@@ -16,7 +16,7 @@ from importlib.machinery import ModuleSpec
|
|
|
16
16
|
from importlib.util import module_from_spec, spec_from_file_location
|
|
17
17
|
from types import ModuleType
|
|
18
18
|
|
|
19
|
-
__version__ = "1.
|
|
19
|
+
__version__ = "1.1.0"
|
|
20
20
|
__all__ = ["DecrypTune", "DecrypTuneError", "TuneMeta", "__version__"]
|
|
21
21
|
|
|
22
22
|
|
|
@@ -37,8 +37,9 @@ class DecrypTuneError(Exception):
|
|
|
37
37
|
return f"DecrypTuneError(code={self.code}, message={self.message!r})"
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
# all error messages are authored by the native core — this wrapper relays [code] + message
|
|
41
|
-
|
|
40
|
+
# all error messages are authored by the native core — this wrapper relays [code] + message;
|
|
41
|
+
# anything without a [N] prefix is not a native error and propagates unchanged
|
|
42
|
+
def _to_err(exc: Exception) -> DecrypTuneError | None:
|
|
42
43
|
msg: str = str(exc)
|
|
43
44
|
end: int = msg.find("]")
|
|
44
45
|
if msg.startswith("[") and end != -1:
|
|
@@ -46,7 +47,7 @@ def _to_err(exc: Exception) -> DecrypTuneError:
|
|
|
46
47
|
return DecrypTuneError(int(msg[1:end]), msg[end + 1:].strip())
|
|
47
48
|
except ValueError:
|
|
48
49
|
pass
|
|
49
|
-
return
|
|
50
|
+
return None
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
_loaded: ModuleType | None = None # one native module per process — its pyclass
|
|
@@ -75,7 +76,7 @@ class DecrypTune:
|
|
|
75
76
|
"""Interface to the decryptune native extension.
|
|
76
77
|
|
|
77
78
|
Args:
|
|
78
|
-
lib_path: path to the compiled extension (.so on Linux
|
|
79
|
+
lib_path: path to the compiled extension (.so on Linux, .pyd on Windows)
|
|
79
80
|
"""
|
|
80
81
|
|
|
81
82
|
__slots__ = ("_lib",)
|
|
@@ -117,7 +118,9 @@ class DecrypTune:
|
|
|
117
118
|
try:
|
|
118
119
|
return self._lib.proc(input=input, out=out, key=key, kid=kid, meta=meta, strict=strict)
|
|
119
120
|
except Exception as e:
|
|
120
|
-
|
|
121
|
+
if (err := _to_err(e)) is not None:
|
|
122
|
+
raise err from None
|
|
123
|
+
raise
|
|
121
124
|
|
|
122
125
|
async def aproc(
|
|
123
126
|
self,
|
|
@@ -140,7 +143,9 @@ class DecrypTune:
|
|
|
140
143
|
try:
|
|
141
144
|
return await self._lib.aproc(input=input, out=out, key=key, kid=kid, meta=meta, strict=strict)
|
|
142
145
|
except Exception as e:
|
|
143
|
-
|
|
146
|
+
if (err := _to_err(e)) is not None:
|
|
147
|
+
raise err from None
|
|
148
|
+
raise
|
|
144
149
|
|
|
145
150
|
|
|
146
151
|
def TuneMeta(
|
|
@@ -8,7 +8,7 @@ tree. Keep this file in sync with it (same API surface, loader differs).
|
|
|
8
8
|
|
|
9
9
|
from . import decryptune as _native
|
|
10
10
|
|
|
11
|
-
__version__ = "1.
|
|
11
|
+
__version__ = "1.1.0"
|
|
12
12
|
__all__ = ["DecrypTune", "DecrypTuneError", "TuneMeta", "__version__"]
|
|
13
13
|
|
|
14
14
|
|
|
@@ -29,8 +29,9 @@ class DecrypTuneError(Exception):
|
|
|
29
29
|
return f"DecrypTuneError(code={self.code}, message={self.message!r})"
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
# all error messages are authored by the native core — this wrapper relays [code] + message
|
|
33
|
-
|
|
32
|
+
# all error messages are authored by the native core — this wrapper relays [code] + message;
|
|
33
|
+
# anything without a [N] prefix is not a native error and propagates unchanged
|
|
34
|
+
def _to_err(exc: Exception) -> DecrypTuneError | None:
|
|
34
35
|
msg: str = str(exc)
|
|
35
36
|
end: int = msg.find("]")
|
|
36
37
|
if msg.startswith("[") and end != -1:
|
|
@@ -38,7 +39,7 @@ def _to_err(exc: Exception) -> DecrypTuneError:
|
|
|
38
39
|
return DecrypTuneError(int(msg[1:end]), msg[end + 1:].strip())
|
|
39
40
|
except ValueError:
|
|
40
41
|
pass
|
|
41
|
-
return
|
|
42
|
+
return None
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
class DecrypTune:
|
|
@@ -86,7 +87,9 @@ class DecrypTune:
|
|
|
86
87
|
try:
|
|
87
88
|
return self._lib.proc(input=input, out=out, key=key, kid=kid, meta=meta, strict=strict)
|
|
88
89
|
except Exception as e:
|
|
89
|
-
|
|
90
|
+
if (err := _to_err(e)) is not None:
|
|
91
|
+
raise err from None
|
|
92
|
+
raise
|
|
90
93
|
|
|
91
94
|
async def aproc(
|
|
92
95
|
self,
|
|
@@ -109,7 +112,9 @@ class DecrypTune:
|
|
|
109
112
|
try:
|
|
110
113
|
return await self._lib.aproc(input=input, out=out, key=key, kid=kid, meta=meta, strict=strict)
|
|
111
114
|
except Exception as e:
|
|
112
|
-
|
|
115
|
+
if (err := _to_err(e)) is not None:
|
|
116
|
+
raise err from None
|
|
117
|
+
raise
|
|
113
118
|
|
|
114
119
|
|
|
115
120
|
def TuneMeta(
|
|
@@ -42,7 +42,8 @@ enum Err {
|
|
|
42
42
|
BadInput = 9,
|
|
43
43
|
BadOutput = 10,
|
|
44
44
|
MetaNeedsFragmented = 11,
|
|
45
|
-
BadCover = 12
|
|
45
|
+
BadCover = 12,
|
|
46
|
+
CoverNotFound = 13 // additive: a missing cover path must not read as a missing input
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
impl Err {
|
|
@@ -51,6 +52,7 @@ impl Err {
|
|
|
51
52
|
Err::InvalidKey => "invalid key: must be 32 hex characters",
|
|
52
53
|
Err::InvalidKid => "invalid kid: must be 32 hex characters",
|
|
53
54
|
Err::InputNotFound => "input file not found",
|
|
55
|
+
Err::CoverNotFound => "cover file not found",
|
|
54
56
|
Err::InvalidMp4 => "input is not a valid MP4",
|
|
55
57
|
Err::DecryptFailed => "decrypt failed: corrupt or unsupported fragment",
|
|
56
58
|
Err::WriteFailed => "failed to write output file",
|
|
@@ -92,9 +94,10 @@ fn guard_kid(data: &[u8], kid: Option<&str>) -> Result<(), Err> {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
// unique temp name — two concurrent writers to the same output must not collide
|
|
97
|
+
// (counter + pid: uniqueness across processes too, not just within one)
|
|
95
98
|
fn tmp_path(out_path: &str) -> String {
|
|
96
99
|
static N: AtomicU64 = AtomicU64::new(0);
|
|
97
|
-
format!("{}.{}.tmp", out_path, N.fetch_add(1, Ordering::Relaxed))
|
|
100
|
+
format!("{}.{}.{}.tmp", out_path, std::process::id(), N.fetch_add(1, Ordering::Relaxed))
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
// write to <out>.<n>.tmp then rename — no partial outputs on crash
|
|
@@ -128,8 +131,18 @@ fn parse_input(value: &Bound<'_, PyAny>) -> PyResult<Input> {
|
|
|
128
131
|
|
|
129
132
|
fn parse_output(out: Option<&Bound<'_, PyAny>>) -> PyResult<Output> {
|
|
130
133
|
match out {
|
|
131
|
-
None
|
|
132
|
-
Some(v) =>
|
|
134
|
+
None => Ok(Output::Return),
|
|
135
|
+
Some(v) => {
|
|
136
|
+
// same path handling as input — os.PathLike accepted too
|
|
137
|
+
let path: String = if let Ok(s) = v.cast::<PyString>() {
|
|
138
|
+
s.to_str()?.to_string()
|
|
139
|
+
} else if let Ok(p) = v.call_method0("__fspath__") {
|
|
140
|
+
p.cast::<PyString>()?.to_str()?.to_string()
|
|
141
|
+
} else {
|
|
142
|
+
return Err(Err::BadOutput.into());
|
|
143
|
+
};
|
|
144
|
+
Ok(Output::Path(path))
|
|
145
|
+
}
|
|
133
146
|
}
|
|
134
147
|
}
|
|
135
148
|
|
|
@@ -202,6 +215,7 @@ struct TuneMeta {
|
|
|
202
215
|
#[pymethods]
|
|
203
216
|
impl TuneMeta {
|
|
204
217
|
#[new]
|
|
218
|
+
#[allow(clippy::too_many_arguments)] // 13 optional tag fields are the public API
|
|
205
219
|
#[pyo3(signature = (title=None, date=None, artists=None, isrc=None,
|
|
206
220
|
track=None, track_total=None, disc=None, disc_total=None,
|
|
207
221
|
album=None, genre=None, lyrics=None, composer=None, cover=None))]
|
|
@@ -22,7 +22,7 @@ impl RawCover {
|
|
|
22
22
|
fn materialize(&self) -> Result<Cow<'_, [u8]>, Err> {
|
|
23
23
|
match self {
|
|
24
24
|
RawCover::Bytes(b) => Ok(Cow::Borrowed(b)),
|
|
25
|
-
RawCover::Path(p) => std::fs::read(p).map(Cow::Owned).map_err(|_| Err::
|
|
25
|
+
RawCover::Path(p) => std::fs::read(p).map(Cow::Owned).map_err(|_| Err::CoverNotFound)
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -87,11 +87,11 @@ pub fn process(data: &[u8], key: Option<&[u8; 16]>, strict: bool, meta: Option<&
|
|
|
87
87
|
// patch sidx referenced sizes in place, now that fragment deltas are known
|
|
88
88
|
for (frag_base, words) in &patches {
|
|
89
89
|
for (k, &off) in words.iter().enumerate() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
let fi: usize = frag_base + k;
|
|
91
|
+
if fi >= deltas.len() || deltas[fi] <= 0 || off + 4 > out.len() { continue; }
|
|
92
|
+
let d: u32 = (deltas[fi] as u64).min(0x7FFF_FFFF) as u32;
|
|
93
|
+
let word: u32 = u32::from_be_bytes(out[off..off + 4].try_into().unwrap());
|
|
94
|
+
let new: u32 = (word & 0x7FFF_FFFF).saturating_sub(d);
|
|
95
95
|
out[off..off + 4].copy_from_slice(&((word & 0x8000_0000) | (new & 0x7FFF_FFFF)).to_be_bytes());
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -203,9 +203,8 @@ fn has_chunk_offsets(children: &[u8], depth: usize) -> bool {
|
|
|
203
203
|
&& u32::from_be_bytes(children[child.content_start + 4..child.content_start + 8].try_into().unwrap()) > 0 => return true,
|
|
204
204
|
b"co64" if child.end - child.content_start >= 12
|
|
205
205
|
&& u64::from_be_bytes(children[child.content_start + 4..child.content_start + 12].try_into().unwrap()) > 0 => return true,
|
|
206
|
-
typ if matches!(typ, b"moov" | b"trak" | b"mdia" | b"minf" | b"stbl")
|
|
207
|
-
|
|
208
|
-
}
|
|
206
|
+
typ if matches!(typ, b"moov" | b"trak" | b"mdia" | b"minf" | b"stbl")
|
|
207
|
+
&& has_chunk_offsets(&children[child.content_start..child.end], depth + 1) => return true,
|
|
209
208
|
_ => {}
|
|
210
209
|
}
|
|
211
210
|
}
|
|
@@ -401,6 +401,21 @@ def test_error_bad_cover(sp, src_file):
|
|
|
401
401
|
assert e.value.code == 12
|
|
402
402
|
|
|
403
403
|
|
|
404
|
+
def test_error_cover_missing(sp, src_file):
|
|
405
|
+
# additive code 13 — a missing cover path names the cover, not the input
|
|
406
|
+
with pytest.raises(DecrypTuneError) as e:
|
|
407
|
+
sp.proc(input=src_file, key=KEY_HEX, meta=TuneMeta(cover="no_such_cover.jpg"))
|
|
408
|
+
assert e.value.code == 13
|
|
409
|
+
assert "cover file not found" in e.value.message
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def test_path_out_pathlib(sp, src_file, tmp_path):
|
|
413
|
+
# out accepts os.PathLike exactly like input
|
|
414
|
+
dst = tmp_path / "out_pathlib.m4a"
|
|
415
|
+
assert sp.proc(input=src_file, out=dst, key=KEY_HEX) is None
|
|
416
|
+
assert dst.read_bytes() == sp.proc(input=src_file, key=KEY_HEX)
|
|
417
|
+
|
|
418
|
+
|
|
404
419
|
def test_error_tags_need_fragmented(sp):
|
|
405
420
|
# a non-empty stco dangles once moov grows with tags -> refused
|
|
406
421
|
stco = full_box(b"stco", 0, 0, u32(1) + u32(100))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|