player: register MPEG and WMV support cleanly
Some checks failed
Validate .desktop files / validate (push) Has been cancelled
Some checks failed
Validate .desktop files / validate (push) Has been cancelled
This commit is contained in:
parent
fd03f98738
commit
a670d2afd7
4 changed files with 52 additions and 2 deletions
22
redeploy.sh
22
redeploy.sh
|
|
@ -42,6 +42,28 @@ while IFS= read -r icon; do
|
||||||
sudo install -Dm0644 "$icon" "$PREFIX/share/icons/hicolor/$rel"
|
sudo install -Dm0644 "$icon" "$PREFIX/share/icons/hicolor/$rel"
|
||||||
done < <(find "res/icons/hicolor" -type f -name "$APPID.svg" | sort)
|
done < <(find "res/icons/hicolor" -type f -name "$APPID.svg" | sort)
|
||||||
|
|
||||||
|
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||||
|
echo "==> Refresh desktop database"
|
||||||
|
if [[ -w "$PREFIX/share/applications" ]]; then
|
||||||
|
update-desktop-database "$PREFIX/share/applications" || true
|
||||||
|
else
|
||||||
|
sudo -n update-desktop-database "$PREFIX/share/applications" 2>/dev/null || \
|
||||||
|
echo " skipped: sudo authentication required"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v xdg-mime >/dev/null 2>&1; then
|
||||||
|
echo "==> Register common legacy video defaults"
|
||||||
|
xdg-mime default "$APPID.desktop" \
|
||||||
|
video/mpeg \
|
||||||
|
video/x-mpeg \
|
||||||
|
video/x-mpeg2 \
|
||||||
|
video/x-ms-wmv \
|
||||||
|
video/x-ms-wm \
|
||||||
|
video/x-ms-asf \
|
||||||
|
application/vnd.ms-asf
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Installed version"
|
echo "==> Installed version"
|
||||||
"$bin_target" --version
|
"$bin_target" --version
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ mod config;
|
||||||
mod key_bind;
|
mod key_bind;
|
||||||
mod localize;
|
mod localize;
|
||||||
mod menu;
|
mod menu;
|
||||||
|
mod mime;
|
||||||
#[cfg(feature = "mpris-server")]
|
#[cfg(feature = "mpris-server")]
|
||||||
mod mpris;
|
mod mpris;
|
||||||
mod project;
|
mod project;
|
||||||
|
|
|
||||||
27
src/mime.rs
Normal file
27
src/mime.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
const DESKTOP_ENTRY: &str = include_str!("../res/com.system76.CosmicPlayer.desktop");
|
||||||
|
|
||||||
|
pub fn supported_mime_types() -> Vec<String> {
|
||||||
|
DESKTOP_ENTRY
|
||||||
|
.lines()
|
||||||
|
.find_map(|line| line.strip_prefix("MimeType="))
|
||||||
|
.map(|mime_types| {
|
||||||
|
mime_types
|
||||||
|
.split(';')
|
||||||
|
.filter(|mime_type| !mime_type.is_empty())
|
||||||
|
.map(ToOwned::to_owned)
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn supported_uri_schemes() -> Vec<String> {
|
||||||
|
supported_mime_types()
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|mime_type| {
|
||||||
|
mime_type
|
||||||
|
.strip_prefix("x-scheme-handler/")
|
||||||
|
.map(ToOwned::to_owned)
|
||||||
|
})
|
||||||
|
.chain(["file".to_string(), "http".to_string(), "https".to_string()])
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
@ -138,12 +138,12 @@ impl RootInterface for Player {
|
||||||
|
|
||||||
async fn supported_uri_schemes(&self) -> fdo::Result<Vec<String>> {
|
async fn supported_uri_schemes(&self) -> fdo::Result<Vec<String>> {
|
||||||
log::info!("SupportedUriSchemes");
|
log::info!("SupportedUriSchemes");
|
||||||
Ok(vec![])
|
Ok(crate::mime::supported_uri_schemes())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn supported_mime_types(&self) -> fdo::Result<Vec<String>> {
|
async fn supported_mime_types(&self) -> fdo::Result<Vec<String>> {
|
||||||
log::info!("SupportedMimeTypes");
|
log::info!("SupportedMimeTypes");
|
||||||
Ok(vec![])
|
Ok(crate::mime::supported_mime_types())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue