mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4332b1beef | ||
|
|
2cf9125de3 |
2 changed files with 9 additions and 17 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
> ~~This project has been sunset as Crunchyroll moved to a DRM-only system. See [#362](https://github.com/crunchy-labs/crunchy-cli/issues/362).~~
|
# This project has been sunset as Crunchyroll moved to a DRM-only system. See [#362](https://github.com/crunchy-labs/crunchy-cli/issues/362).
|
||||||
>
|
|
||||||
> Well there is one endpoint which still has DRM-free streams, I guess I still have a bit time until (finally) everything is DRM-only.
|
|
||||||
|
|
||||||
# crunchy-cli
|
# crunchy-cli
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -322,20 +322,14 @@ impl Downloader {
|
||||||
|
|
||||||
if let Some(offsets) = offsets {
|
if let Some(offsets) = offsets {
|
||||||
let mut root_format_idx = 0;
|
let mut root_format_idx = 0;
|
||||||
let mut root_format_length = 0;
|
let mut root_format_offset = u64::MAX;
|
||||||
|
|
||||||
for (i, format) in self.formats.iter().enumerate() {
|
for (i, format) in self.formats.iter().enumerate() {
|
||||||
let offset = offsets.get(&i).copied().unwrap_or_default();
|
let offset = offsets.get(&i).copied().unwrap_or_default();
|
||||||
let format_len = format
|
let format_offset = offset.num_milliseconds() as u64;
|
||||||
.video
|
if format_offset < root_format_offset {
|
||||||
.0
|
|
||||||
.segments()
|
|
||||||
.iter()
|
|
||||||
.map(|s| s.length.as_millis())
|
|
||||||
.sum::<u128>() as u64
|
|
||||||
- offset.num_milliseconds() as u64;
|
|
||||||
if format_len > root_format_length {
|
|
||||||
root_format_idx = i;
|
root_format_idx = i;
|
||||||
root_format_length = format_len;
|
root_format_offset = format_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
for _ in &format.audios {
|
for _ in &format.audios {
|
||||||
|
|
@ -567,7 +561,7 @@ impl Downloader {
|
||||||
|
|
||||||
for (i, meta) in videos.iter().enumerate() {
|
for (i, meta) in videos.iter().enumerate() {
|
||||||
if let Some(start_time) = meta.start_time {
|
if let Some(start_time) = meta.start_time {
|
||||||
input.extend(["-ss".to_string(), format_time_delta(&start_time)])
|
input.extend(["-itsoffset".to_string(), format_time_delta(&start_time)])
|
||||||
}
|
}
|
||||||
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
||||||
maps.extend(["-map".to_string(), i.to_string()]);
|
maps.extend(["-map".to_string(), i.to_string()]);
|
||||||
|
|
@ -588,7 +582,7 @@ impl Downloader {
|
||||||
}
|
}
|
||||||
for (i, meta) in audios.iter().enumerate() {
|
for (i, meta) in audios.iter().enumerate() {
|
||||||
if let Some(start_time) = meta.start_time {
|
if let Some(start_time) = meta.start_time {
|
||||||
input.extend(["-ss".to_string(), format_time_delta(&start_time)])
|
input.extend(["-itsoffset".to_string(), format_time_delta(&start_time)])
|
||||||
}
|
}
|
||||||
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
||||||
maps.extend(["-map".to_string(), (i + videos.len()).to_string()]);
|
maps.extend(["-map".to_string(), (i + videos.len()).to_string()]);
|
||||||
|
|
@ -635,7 +629,7 @@ impl Downloader {
|
||||||
if container_supports_softsubs {
|
if container_supports_softsubs {
|
||||||
for (i, meta) in subtitles.iter().enumerate() {
|
for (i, meta) in subtitles.iter().enumerate() {
|
||||||
if let Some(start_time) = meta.start_time {
|
if let Some(start_time) = meta.start_time {
|
||||||
input.extend(["-ss".to_string(), format_time_delta(&start_time)])
|
input.extend(["-itsoffset".to_string(), format_time_delta(&start_time)])
|
||||||
}
|
}
|
||||||
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
input.extend(["-i".to_string(), meta.path.to_string_lossy().to_string()]);
|
||||||
maps.extend([
|
maps.extend([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue