Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Paul van Tilburg | 51c3874820 | |
Paul van Tilburg | fd4e1b00a1 | |
Paul van Tilburg | bae34b6858 | |
Paul van Tilburg | 501bd9329c | |
Paul van Tilburg | 81979cd5e0 | |
Paul van Tilburg | 8e4045572c | |
Paul van Tilburg | 83d025c785 | |
Paul van Tilburg | 7f1120fd47 | |
Paul van Tilburg | 371b758962 | |
Paul van Tilburg | 2cd756254b |
|
@ -0,0 +1,83 @@
|
|||
name: "Check, Test and Lint Using Cargo"
|
||||
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
- workflow_dispatch
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: debian-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: https://github.com/actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Use sparse Cargo index for crates.io
|
||||
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
|
||||
|
||||
- name: Run cargo check
|
||||
uses: https://github.com/actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
||||
# TODO: Add a test suite first!
|
||||
# test:
|
||||
# name: Test Suite
|
||||
# runs-on: debian-latest
|
||||
# steps:
|
||||
# - name: Checkout sources
|
||||
# uses: actions/checkout@v3
|
||||
#
|
||||
# - name: Install stable toolchain
|
||||
# uses: https://github.com/actions-rs/toolchain@v1
|
||||
# with:
|
||||
# profile: minimal
|
||||
# toolchain: stable
|
||||
# override: true
|
||||
#
|
||||
# - name: Use sparse Cargo index for crates.io
|
||||
# run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
|
||||
#
|
||||
# - name: Run cargo test
|
||||
# uses: https://github.com/actions-rs/cargo@v1
|
||||
# with:
|
||||
# command: test
|
||||
# args: --all-features
|
||||
|
||||
lints:
|
||||
name: Lints
|
||||
runs-on: debian-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: https://github.com/actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Use sparse Cargo index for crates.io
|
||||
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
|
||||
|
||||
- name: Run cargo fmt
|
||||
uses: https://github.com/actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
- name: Run cargo clippy
|
||||
uses: https://github.com/actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -- -D warnings
|
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.4.0] - 2023-03-24
|
||||
|
||||
### Added
|
||||
|
||||
* Add Gitea Actions workflow for cargo
|
||||
|
||||
### Changed
|
||||
|
||||
* Update dependencies on `cached` and `youtube_dl`
|
||||
* Update to `rocket` version 0.5.0-rc.3
|
||||
* Select MP4 audio streams only (experimental)
|
||||
* Remove parameters from MIME types to prevent clients tripping over them
|
||||
|
||||
### Fixed
|
||||
|
||||
* Bump the dependency on `ytextract` (#14)
|
||||
* Fix typo in the documentation
|
||||
|
||||
## [0.3.0] - 2022-12-24
|
||||
|
||||
### Added
|
||||
|
@ -56,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
Initial release.
|
||||
|
||||
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.3.0...HEAD
|
||||
[0.1.0]: https://git.luon.net/paul/podbringer/commits/tag/v0.1.0
|
||||
[0.2.0]: https://git.luon.net/paul/podbringer/compare/v0.1.0..v0.2.0
|
||||
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.4.0...HEAD
|
||||
[0.4.0]: https://git.luon.net/paul/podbringer/compare/v0.3.0..v0.4.0
|
||||
[0.3.0]: https://git.luon.net/paul/podbringer/compare/v0.2.0..v0.3.0
|
||||
[0.2.0]: https://git.luon.net/paul/podbringer/compare/v0.1.0..v0.2.0
|
||||
[0.1.0]: https://git.luon.net/paul/podbringer/commits/tag/v0.1.0
|
||||
|
|
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "podbringer"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["Paul van Tilburg <paul@luon.net>"]
|
||||
edition = "2021"
|
||||
description = "Web service that provides podcasts for services that don't offer them (anymore)"
|
||||
|
@ -9,18 +9,18 @@ license = "MIT"
|
|||
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
cached = { version = "0.41.0", features = ["async"] }
|
||||
cached = { version = "0.42.0", features = ["async"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
enum_dispatch = "0.3.8"
|
||||
mime-db = "1.6.0"
|
||||
reqwest = { version = "0.11.10", features = ["json"] }
|
||||
rocket = { version = "0.5.0-rc.2", features = ["json"] }
|
||||
rocket = { version = "0.5.0-rc.3", features = ["json"] }
|
||||
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
|
||||
rss = "2.0.1"
|
||||
thiserror = "1.0.31"
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
youtube_dl = { version = "0.7.0", features = ["tokio"] }
|
||||
ytextract = "0.11.1"
|
||||
youtube_dl = { version = "0.8.0", features = ["tokio"] }
|
||||
ytextract = "0.11.2"
|
||||
|
||||
[package.metadata.deb]
|
||||
maintainer = "Paul van Tilburg <paul@luon.net>"
|
||||
|
|
|
@ -65,7 +65,7 @@ provide the limit in the URL by setting the `limit` parameter.
|
|||
For example, to get up until 1000 items the URL becomes:
|
||||
|
||||
```text
|
||||
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband?limit=1000`
|
||||
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband?limit=1000
|
||||
```
|
||||
|
||||
### Service: Mixcloud
|
||||
|
|
|
@ -182,10 +182,13 @@ impl From<YouTubeVideoWithStream> for Item {
|
|||
) -> Self {
|
||||
let id = video.id().to_string();
|
||||
|
||||
let mime_type = stream.mime_type().to_string();
|
||||
// Ignore everything from MIME type parameter seperator on for extension look-up.
|
||||
let mime_sep = mime_type.find(';').unwrap_or(mime_type.len());
|
||||
let extension = mime_db::extension(&mime_type[..mime_sep]).unwrap_or_default();
|
||||
// Strip parameters from MIME type; some clients are scared of them and they are no
|
||||
// necessary.
|
||||
let mut mime_type = stream.mime_type().to_string();
|
||||
if let Some(sep_idx) = mime_type.find(';') {
|
||||
mime_type.truncate(sep_idx);
|
||||
}
|
||||
let extension = mime_db::extension(&mime_type).unwrap_or_default();
|
||||
let file = PathBuf::from(&id).with_extension(extension);
|
||||
let enclosure = Enclosure {
|
||||
file,
|
||||
|
@ -305,7 +308,9 @@ async fn fetch_stream(
|
|||
.streams()
|
||||
.await
|
||||
.ok()?
|
||||
.filter(|v| v.is_audio())
|
||||
// Select the well-supported, almost always available MP4 container format with
|
||||
// only an audio stream and then the one with the highest bitrate.
|
||||
.filter(|v| v.is_audio() && v.mime_type().contains("mp4"))
|
||||
.max_by_key(|v| v.bitrate())?;
|
||||
let content_length = stream.content_length().await.ok()?;
|
||||
|
||||
|
@ -334,7 +339,9 @@ async fn retrieve_redirect_url(client: &Client, video_id: &str) -> Result<String
|
|||
let stream = video
|
||||
.streams()
|
||||
.await?
|
||||
.filter(|v| v.is_audio())
|
||||
// Select the well-supported, almost always available MP4 container format with only an
|
||||
// audio stream and then the one with the highest bitrate.
|
||||
.filter(|v| v.is_audio() && v.mime_type().contains("mp4"))
|
||||
.max_by_key(|v| v.bitrate())
|
||||
.ok_or(Error::NoRedirectUrlFound)?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue