Projects
Multimedia
netease-cloud-music
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 4
View file
netease-cloud-music.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Wed May 11 08:06:21 UTC 2022 - Hillwood Yang <hillwood@opensuse.org> + +- Fix can not flayback flac + +------------------------------------------------------------------- Sat Jun 13 13:57:43 UTC 2020 - Hillwood Yang <hillwood@opensuse.org> - Rename netease-cloud-music-appdata.xml to netease-cloud-music.appdata.xml
View file
netease-cloud-music.spec
Changed
@@ -26,8 +26,11 @@ Url: http://music.163.com/ Source0: %{name}.sh.in Source1: %{name}.bash +Source2: patch.c Source99: %{name}.appdata.xml BuildRequires: hicolor-icon-theme +BuildRequires: pkgconfig(libvlc) +BuildRequires: gcc Requires: desktop-file-utils Requires: hicolor-icon-theme Requires: binutils @@ -58,6 +61,7 @@ %prep %build +cc -O2 -fPIC -shared -I /usr/include/vlc/plugins/ -o libnetease-patch.so %{SOURCE2} %install %suse_install_update_script %{SOURCE0} @@ -75,6 +79,7 @@ install -d %{buildroot}/opt/netease/netease-cloud-music/plugins/platforminputcontexts install -d %{buildroot}/opt/netease/netease-cloud-music/plugins/imageformats install -d %{buildroot}/opt/netease/netease-cloud-music/plugins/iconengines +install -m 755 libnetease-patch.so %{buildroot}/opt/netease/netease-cloud-music/libnetease-patch.so install -d %{buildroot}%{_datadir}/applications/ install -d %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/ install -d %{buildroot}%{_datadir}/doc/netease-cloud-music/ @@ -316,6 +321,7 @@ %ghost /opt/netease/netease-cloud-music/plugins/imageformats/libqsvg.so %ghost /opt/netease/netease-cloud-music/plugins/imageformats/libqjpeg.so %ghost /opt/netease/netease-cloud-music/plugins/iconengines/libqsvgicon.so +/opt/netease/netease-cloud-music/libnetease-patch.so %ghost %{_datadir}/applications/netease-cloud-music.desktop %ghost %{_datadir}/icons/hicolor/scalable/apps/netease-cloud-music.svg %ghost %{_datadir}/doc/netease-cloud-music/changelog.gz
View file
netease-cloud-music-appdata.xml
Added
@@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component type="desktop"> + <id>netease-cloud-music.desktop</id> + <metadata_license>CC0-1.0</metadata_license> + <name>Netease Cloud Music</name> + <name xml:lang="zh_CN">网易云音乐</name> + <name xml:lang="zh_TW">網易云音樂</name> + <summary>Netease Cloud Music</summary> + <summary xml:lang="zh_CN">网易云音乐</summary> + <summary xml:lang="zh_TW">網易云音樂</summary> + <summary xml:lang="zh_HK">網易云音樂/summary> + <description> + <p> +This is a installer script for NetEase Cloud Music, it can help you to +install NetEase Cloud Music in your openSUSE. + +NetEase Cloud Music is an app to stream music and download songs to your +device's memory. The best thing about it is that it lets you do this with +thousands of songs, all completely free. + +NetEase Cloud Music is something like a free Chinese Spotify that gives +unlimited access to almost any song you can imagine. Even if the app is +designed mainly for people in China, you can still use it to find almost +all the big-name international musicians. + </p> + <p xml:lang="zh_CN"> + 网易云音乐是一款播放流音乐和下载音乐到你设备的应用,可以下载成千上万免费的正版音乐。 + </p> + <p xml:lang="zh_TW"> + 網易云音樂是一款播放流音樂和下載音樂到你設備的應用,可以下載成千上萬免費的正版音樂。 + </p> + <p xml:lang="zh_HK"> + 網易云音樂是一款播放流音樂和下載音樂到你設備的應用,可以下載成千上萬免費的正版音樂。 + </p> + </description> + <url type="homepage">http://music.163.com/</url> + <url type="bugtracker">http://feedback.deepin.org/feedback</url> + <releases> + <release version="1.1.0" date="2017-11-20"></release> + </releases> + <project_license>SUSE-NonFree</project_license> + <developer_name> + NetEase, Inc. + Wuhan Deepin Technology Co., Ltd. + </developer_name> + <screenshots> + <screenshot type="default">https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-1.png</screenshot> + <screenshot type="default">https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-2.png</screenshot> + <screenshot type="default">https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-3.png</screenshot> + </screenshots> +</component>
View file
netease-cloud-music.appdata.xml
Deleted
@@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component type="desktop"> - <id>netease-cloud-music.desktop</id> - <metadata_license>CC0-1.0</metadata_license> - <name>Netease Cloud Music</name> - <name xml:lang="zh_CN">网易云音乐</name> - <name xml:lang="zh_TW">網易云音樂</name> - <summary>Netease Cloud Music</summary> - <summary xml:lang="zh_CN">网易云音乐</summary> - <summary xml:lang="zh_TW">網易云音樂</summary> - <summary xml:lang="zh_HK">網易云音樂</summary> - <description> - <p> -This is a installer script for NetEase Cloud Music, it can help you to -install NetEase Cloud Music in your openSUSE. - -NetEase Cloud Music is an app to stream music and download songs to your -device's memory. The best thing about it is that it lets you do this with -thousands of songs, all completely free. - -NetEase Cloud Music is something like a free Chinese Spotify that gives -unlimited access to almost any song you can imagine. Even if the app is -designed mainly for people in China, you can still use it to find almost -all the big-name international musicians. - </p> - <p xml:lang="zh_CN"> - 网易云音乐是一款播放流音乐和下载音乐到你设备的应用,可以下载成千上万免费的正版音乐。 - </p> - <p xml:lang="zh_TW"> - 網易云音樂是一款播放流音樂和下載音樂到你設備的應用,可以下載成千上萬免費的正版音樂。 - </p> - <p xml:lang="zh_HK"> - 網易云音樂是一款播放流音樂和下載音樂到你設備的應用,可以下載成千上萬免費的正版音樂。 - </p> - </description> - <url type="homepage">http://music.163.com/</url> - <url type="bugtracker">http://feedback.deepin.org/feedback</url> - <releases> - <release version="1.2.1" date="2019-04-28"></release> - <release version="1.1.0" date="2017-11-20"></release> - </releases> - <project_license>SUSE-NonFree</project_license> - <developer_name> - NetEase, Inc. \n - Wuhan Deepin Technology Co., Ltd. - </developer_name> - <screenshots> - <screenshot type="default"> - <image>https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-1.png</image> - </screenshot> - <screenshot type="default"> - <image>https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-2.png</image> - </screenshot> - <screenshot type="default"> - <image>https://www.deepin.org/wp-content/uploads/2016/12/netease-cloud-music-3.png</image> - </screenshot> - </screenshots> -</component>
View file
netease-cloud-music.bash
Changed
@@ -3,4 +3,5 @@ export LD_LIBRARY_PATH="${HERE}"/libs:/usr/lib64:/usr/lib64/pulseaudio/ export QT_PLUGIN_PATH="${HERE}"/plugins export QT_QPA_PLATFORM_PLUGIN_PATH="${HERE}"/plugins/platforms +export LD_PRELOAD="${HERE}"/libnetease-patch.so exec "${HERE}"/netease-cloud-music $@
View file
patch.c
Added
@@ -0,0 +1,144 @@ +// SPDX-License-Identifier: BSD-3-Clause +/** + * Copyright (c) 2021 kXuan. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#define _GNU_SOURCE + +#include <dlfcn.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <unistd.h> +#include <vlc/vlc.h> +#include <vlc/plugins/vlc_common.h> +#include <vlc/plugins/vlc_stream.h> + +static void *load_sym(void *override_func, const char *name) +{ + void *ptr = dlsym(RTLD_NEXT, name); + if (ptr == NULL) { + fprintf(stderr, "Cannot load symbol '%s' %s. Please report bug on AUR.\n", name, dlerror()); + exit(1); + } + if (ptr == override_func) { + fprintf(stderr, "circular reference '%s'. Please report bug on AUR.\n", name); + exit(1); + } + return ptr; +} + +static int is_flac(const char *url) +{ + static const char suffix = ".flac"; + if (!url) { + return 0; + } + size_t len = strlen(url); + if (len < sizeof(suffix)) { + return 0; + } + + return strcasecmp(url + len - sizeof(suffix) + 1, suffix) == 0; +} + +/** + * The netease cloud music server set the Content-Type of .flac format to mpeg/audio, which results vlc unable to decode + * the music and play. + * + * To make vlc works correctly, we rewrite the Content-Type to audio/flac. + * + * @param s + * @param query + * @param args + * @return + */ +int vlc_stream_vaControl(stream_t *s, int query, va_list args) +{ + static typeof(vlc_stream_vaControl) *orig_fn; + if (orig_fn == NULL) { + orig_fn = load_sym(vlc_stream_vaControl, __func__); + } + if (query == STREAM_GET_CONTENT_TYPE && is_flac(s->psz_url)) { + *va_arg(args, char **) = strdup("audio/flac"); + return VLC_SUCCESS; + } else { + return orig_fn(s, query, args); + } +} + +struct string_with_len { + const char *s; + size_t len; +}; +#define STRING_WITH_LEN_INIT(s) {s, sizeof(s)-1} + +/** + * drop all library fixes. + * + * Library fixes should only be applied to the netease-cloud-music main process. Sometime, netease-cloud-music execute + * external program, such as `xdg-open`, `kde-open5`. Those external programs use newer version qt and other new + * libraries. If we don't drop these environment variables, those programs may not work, because some symbol may not + * exist in the bundled old library. + * + * @param path + * @param argv + * @param envp + * @return + */ +int execve(const char *path, char *const argv, char *const envp) +{ + static typeof(execve) *orig_fn; + if (orig_fn == NULL) { + orig_fn = load_sym(execve, "execve"); + } + + static struct string_with_len drop_env = { + STRING_WITH_LEN_INIT("LD_LIBRARY_PATH="), + STRING_WITH_LEN_INIT("LD_PRELOAD="), + STRING_WITH_LEN_INIT("QT_PLUGIN_PATH="), + STRING_WITH_LEN_INIT("QT_QPA_PLATFORM_PLUGIN_PATH="), + STRING_WITH_LEN_INIT("QT_QPA_PLATFORM="), + }; + + size_t nenv; + for (nenv = 0; envpnenv; nenv++); + + char *new_envpnenv + 1; + char *const *src = envp; + char **dst = new_envp; + + while (*src) { + for (int i = 0; i < sizeof(drop_env) / sizeof(*drop_env); ++i) { + if (strncmp(drop_envi.s, *src, drop_envi.len) == 0) { + goto next_env; + } + } + *dst = *src; + ++dst; +next_env: + ++src; + } + + *dst = NULL; + return orig_fn(path, argv, new_envp); +} +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.